/* === BACKTESTER — Terminal Luxe Theme === */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Noto+Sans+KR:wght@400;500;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #08080a;
    --bg-card: #111114;
    --bg-card-hover: #16161a;
    --border: #1e1e24;
    --border-hover: #2a2a32;
    --text: #f0f0f2;
    --text-secondary: #8a8a96;
    --accent: #3ecf8e;
    --accent-hover: #5ad8a0;
    --accent-dark: #2ab87a;
    --accent-glow: rgba(62, 207, 142, 0.15);
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.15);
    --blue: #5b8def;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --container: 980px;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 24px rgba(0,0,0,0.4);
    --shadow-glow: 0 0 20px var(--accent-glow);
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Noto Sans KR', 'Outfit', sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    /* Subtle noise texture */
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='256' height='256' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
}

/* Smooth reveal animation */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

.animate-in {
    animation: fadeUp 0.5s ease both;
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }

/* Container */
.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation */
.nav {
    border-bottom: 1px solid var(--border);
    padding: 14px 0;
    position: sticky;
    top: 0;
    background: rgba(8, 8, 10, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 100;
}

.nav-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--accent);
    text-decoration: none;
    text-shadow: 0 0 20px var(--accent-glow);
    transition: text-shadow 0.3s;
}

.logo:hover {
    text-shadow: 0 0 30px rgba(62, 207, 142, 0.3);
}

.nav-links {
    display: flex;
    gap: 24px;
    align-items: center;
    font-size: 14px;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--text);
}

.nav-divider {
    width: 1px;
    height: 16px;
    background: var(--border);
}

.nav-user {
    color: var(--accent) !important;
    font-weight: 600;
}

.btn-nav {
    padding: 6px 16px;
    font-size: 12px;
}

.nav-link-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
    transition: color 0.2s;
}

.nav-link-btn:hover {
    color: var(--text);
}

body.nav-open { overflow: hidden; }

.inline {
    display: inline;
}

/* Hero */
.hero {
    text-align: center;
    padding: 100px 0 60px;
    position: relative;
}

.hero::before {
    content: '';
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 400px;
    background: radial-gradient(ellipse, rgba(62, 207, 142, 0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

.hero h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 4rem;
    font-weight: 800;
    letter-spacing: -2px;
    background: linear-gradient(135deg, #fff 0%, var(--accent) 50%, var(--accent-hover) 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 4s linear infinite;
    margin-bottom: 16px;
}

.hero-desc {
    color: var(--text-secondary);
    font-size: 17px;
    line-height: 1.8;
    margin-bottom: 36px;
    animation: fadeUp 0.6s ease 0.2s both;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 40px 0;
}

.feature-card {
    background: rgba(17, 17, 20, 0.6);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(8px);
    position: relative;
    overflow: hidden;
}

.feature-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(62,207,142,0.05) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.3s;
}

.feature-card:hover {
    border-color: rgba(62, 207, 142, 0.3);
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.3), 0 0 20px var(--accent-glow);
}

.feature-card:hover::after {
    opacity: 1;
}

.feature-card h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

.feature-icon {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
    line-height: 1;
    position: relative;
    z-index: 1;
    text-shadow: 0 0 16px var(--accent-glow);
}

/* Hero extras */
.hero-badge {
    display: inline-block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--accent);
    border: 1px solid rgba(62, 207, 142, 0.25);
    padding: 6px 16px;
    border-radius: 20px;
    margin-bottom: 20px;
    background: rgba(62, 207, 142, 0.06);
}

.hero-cta {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 15px;
}

/* Stats Strip */
.stats-strip {
    display: flex;
    justify-content: center;
    gap: 48px;
    padding: 40px 0;
    margin: 20px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 28px;
    font-weight: 600;
    color: var(--accent);
    text-shadow: 0 0 20px var(--accent-glow);
}

.stat-label {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* CTA Section */
.cta-section {
    text-align: center;
    padding: 60px 0 80px;
    margin-top: 20px;
    position: relative;
}

.cta-section::before {
    content: '';
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: 400px;
    height: 200px;
    background: radial-gradient(ellipse, rgba(62, 207, 142, 0.06) 0%, transparent 70%);
    pointer-events: none;
}

.cta-section h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.cta-section p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 32px 0 16px;
}

.page-header h2 {
    font-family: 'Outfit', sans-serif;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 14px 32px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    text-decoration: none;
    border: none;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg);
    box-shadow: 0 2px 12px var(--accent-glow);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(62, 207, 142, 0.25);
}

.btn-secondary {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--text-secondary);
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    color: white;
}

.full-width {
    width: 100%;
}

/* Cards */
.page-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin: 40px 0;
    box-shadow: var(--shadow-sm);
    animation: fadeUp 0.4s ease both;
}

.auth-card {
    max-width: 400px;
    margin: 60px auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
}

.auth-card h2 {
    font-family: 'Outfit', sans-serif;
    margin-bottom: 24px;
}

.auth-link {
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

.auth-link a {
    color: var(--accent);
    text-decoration: none;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-family: 'Outfit', sans-serif;
}

.input, select {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.input:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.help {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.error {
    display: block;
    font-size: 12px;
    color: var(--danger);
    margin-top: 4px;
}

.errors {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin: 24px 0;
}

.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    transition: border-color 0.2s;
}

.metric-card:hover {
    border-color: var(--text-secondary);
}

.metric-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    font-family: 'Outfit', sans-serif;
}

.metric-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
    margin-top: 4px;
    font-family: 'JetBrains Mono', monospace;
}

/* Charts */
.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin: 16px 0;
}

.chart-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.chart-container.half {
    margin: 0;
}

/* Tables */
.yearly-table {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin: 16px 0;
}

.yearly-table h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    margin-bottom: 12px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
}

thead tr {
    border-bottom: 1px solid var(--border);
}

th {
    text-align: right;
    padding: 8px 4px;
    font-weight: 500;
    color: var(--text-secondary);
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
}

th:first-child {
    text-align: left;
}

td {
    text-align: right;
    padding: 8px 4px;
    border-bottom: 1px solid rgba(42, 42, 42, 0.5);
}

td:first-child {
    text-align: left;
    color: var(--text);
}

/* Color utilities */
.positive { color: var(--accent); }
.negative { color: var(--danger); }

/* === Result Page === */

/* Hero */
.result-hero {
    margin: 28px 0 0;
    padding: 28px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    animation: fadeUp 0.4s ease both;
    position: relative;
}

.result-hero::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 300px;
    height: 200px;
    background: radial-gradient(ellipse, var(--accent-glow) 0%, transparent 70%);
    pointer-events: none;
}

.result-hero-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.result-title {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 6px;
}

.result-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.meta-dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--text-secondary);
    opacity: 0.5;
}

/* Hero Metrics - 3 big numbers */
.hero-metrics {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.hero-metric {
    flex: 1;
    text-align: center;
    padding: 8px 16px;
}

.hero-metric-divider {
    width: 1px;
    height: 48px;
    background: var(--border);
}

.hm-value {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 32px;
    font-weight: 700;
    line-height: 1.2;
}

.hm-label {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-family: 'Outfit', sans-serif;
}

/* Sub Metrics */
.sub-metrics {
    display: flex;
    gap: 8px;
    margin: 12px 0 24px;
}

.sub-metric {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
    text-align: center;
}

.sm-label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-secondary);
    font-family: 'Outfit', sans-serif;
    margin-bottom: 4px;
}

.sm-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 16px;
    font-weight: 600;
}

/* Section Titles */
.section-title {
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

/* Composition Bar */
.composition-section {
    margin-bottom: 24px;
}

.composition-bar {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
    gap: 2px;
}

.cb-seg {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s;
}

.composition-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
}

.cb-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.cb-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex-shrink: 0;
}

.cb-ticker {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: var(--text);
}

.cb-pct {
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-secondary);
}

.cb-val {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text-secondary);
    opacity: 0.6;
}

/* Chart Sections */
.chart-section {
    margin-bottom: 16px;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.chart-card-lg {
    padding: 20px;
}

.chart-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.flex-1 { flex: 1; }

/* Yearly Table v2 */
.yearly-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px 16px 16px;
    margin-bottom: 24px;
}

.yearly-table-v2 {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.yearly-table-v2 thead tr {
    border-bottom: 1px solid var(--border);
}

.yearly-table-v2 th {
    text-align: right;
    padding: 10px 8px;
    font-weight: 500;
    color: var(--text-secondary);
    font-family: 'Outfit', sans-serif;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.yearly-table-v2 th:first-child,
.yearly-table-v2 td:first-child {
    text-align: left;
}

.yearly-table-v2 td {
    text-align: right;
    padding: 10px 8px;
    border-bottom: 1px solid rgba(42, 42, 42, 0.4);
    font-size: 13px;
}

.col-year {
    width: 60px;
    font-weight: 600;
    color: var(--text);
}

.col-bar {
    width: 120px;
}

.yr-bar-wrap {
    height: 14px;
    background: rgba(255,255,255,0.03);
    border-radius: 3px;
    overflow: hidden;
}

.yr-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
    opacity: 0.7;
}

/* Save Section */
.save-section {
    margin: 24px 0 16px;
    text-align: center;
}

.save-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
}

/* Action Bar */
.result-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin: 24px 0 12px;
}

.action-bar-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-bar-center {
    width: 100%;
    text-align: center;
}

/* Gated Content */
.gated-content {
    position: relative;
    margin: 16px 0 24px;
}

.gated-blur {
    filter: blur(8px);
    pointer-events: none;
    user-select: none;
    opacity: 0.6;
}

.gated-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.gated-cta {
    text-align: center;
    padding: 36px 48px;
    background: rgba(15, 15, 15, 0.92);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: blur(4px);
}

.gated-cta h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    margin-bottom: 8px;
}

.gated-cta p {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.gated-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
}

/* Share Dropdown */
.share-dropdown-wrap {
    position: relative;
}

.share-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px;
    min-width: 180px;
    z-index: 200;
    box-shadow: var(--shadow-md);
    animation: fadeUp 0.15s ease;
}

.share-dropdown-wrap.open .share-dropdown {
    display: block;
}

.share-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: none;
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
    text-align: left;
}

.share-item:hover {
    background: rgba(255,255,255,0.06);
}

.share-icon {
    width: 20px;
    text-align: center;
    font-weight: 700;
    font-size: 14px;
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
}

.share-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

.save-badge.saved {
    background: rgba(62, 207, 142, 0.1);
    color: var(--accent);
    border: 1px solid rgba(62, 207, 142, 0.2);
}

.save-badge.public {
    background: rgba(91, 141, 239, 0.1);
    color: #5b8def;
    border: 1px solid rgba(91, 141, 239, 0.2);
}

.save-badge.private {
    background: rgba(160, 160, 160, 0.1);
    color: var(--text-secondary);
    border: 1px solid rgba(160, 160, 160, 0.2);
}

.save-login-btn {
    text-align: center;
}

.save-hint {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* Result Actions */
.result-actions {
    display: flex;
    gap: 12px;
    margin: 8px 0 40px;
}

/* Actions */
.actions {
    margin: 24px 0;
    display: flex;
    gap: 12px;
}

/* Portfolio list */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin: 24px 0;
}

.portfolio-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: border-color 0.2s;
}

.portfolio-card:hover {
    border-color: var(--text-secondary);
}

.portfolio-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.portfolio-card h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    margin-bottom: 0;
}

.portfolio-date {
    font-size: 11px;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
}

.portfolio-assets {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 12px;
}

.asset-tag {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(255,255,255,0.05);
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
}

.asset-tag small {
    color: var(--accent);
}

.portfolio-metrics-row {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}

.pm {
    flex: 1;
    text-align: center;
}

.pm-label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-family: 'Outfit', sans-serif;
}

.pm-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 600;
}

.portfolio-actions {
    display: flex;
    gap: 8px;
}

.portfolio-actions .btn {
    padding: 8px 16px;
    font-size: 12px;
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 60px 0;
}

/* Form Sections */
.form-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.form-section:last-of-type {
    border-bottom: none;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-group.half {
    flex: 1;
}

.label-sub {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

/* Asset Rows */
.asset-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
    animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.asset-search-col {
    flex: 1;
}

.asset-weight-col {
    width: 80px;
    flex-shrink: 0;
}

.asset-weight-col .input {
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
}

.btn-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    border-color: var(--danger);
    color: var(--danger);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 12px;
    margin-top: 4px;
}

.weight-total {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(255,255,255,0.03);
}

.weight-total.valid {
    color: var(--accent);
    background: rgba(62, 207, 142, 0.1);
}

.weight-total.invalid {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* Autocomplete */
.autocomplete-wrap {
    position: relative;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 200;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-top: 4px;
    max-height: 240px;
    overflow-y: auto;
    display: none;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.autocomplete-dropdown.show {
    display: block;
}

.ac-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.1s;
    font-size: 13px;
}

.ac-item:hover {
    background: rgba(62, 207, 142, 0.08);
}

.ac-ticker {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: var(--accent);
    min-width: 80px;
}

.ac-name {
    color: var(--text);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ac-type {
    font-size: 10px;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.05);
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

.ac-empty {
    padding: 12px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}

/* Period Presets */
.period-presets {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.preset-btn {
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: all 0.15s;
}

.preset-btn:hover {
    border-color: var(--text-secondary);
    color: var(--text);
}

.preset-btn.active {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(62, 207, 142, 0.08);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(15, 15, 15, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.loading-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.loading-card {
    text-align: center;
    padding: 48px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-card h3 {
    font-family: 'Outfit', sans-serif;
    margin-bottom: 8px;
}

.loading-sub {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 24px;
}

.loading-steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.loading-step {
    font-size: 12px;
    color: var(--text-secondary);
    opacity: 0.4;
    transition: all 0.3s;
    font-family: 'JetBrains Mono', monospace;
}

.loading-step.active {
    opacity: 1;
    color: var(--accent);
}

.loading-step.done {
    opacity: 0.5;
    text-decoration: line-through;
}

/* Preset Portfolios */
.preset-portfolios {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.preset-portfolio-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.portfolio-preset {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    color: var(--text);
}

.portfolio-preset:hover {
    border-color: var(--accent);
    background: rgba(62, 207, 142, 0.04);
}

.portfolio-preset.active {
    border-color: var(--accent);
    background: rgba(62, 207, 142, 0.08);
}

.pp-name {
    display: block;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 2px;
}

.pp-desc {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
}

/* Weight Bar */
.weight-bar-wrap {
    height: 6px;
    background: rgba(255,255,255,0.04);
    border-radius: 3px;
    margin-bottom: 12px;
    overflow: hidden;
}

.weight-bar {
    display: flex;
    height: 100%;
    border-radius: 3px;
    overflow: hidden;
    transition: all 0.2s;
}

.wb-seg {
    height: 100%;
    transition: width 0.2s;
}

.wb-empty {
    background: rgba(255,255,255,0.04);
}

/* Asset Row enhancements */
.asset-color {
    width: 4px;
    height: 36px;
    border-radius: 2px;
    flex-shrink: 0;
}

.asset-search.has-value {
    border-color: rgba(62, 207, 142, 0.3);
}

.weight-input-wrap {
    position: relative;
}

.weight-suffix {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: var(--text-secondary);
    pointer-events: none;
}

.weight-input-wrap .input {
    padding-right: 28px;
    text-align: right;
}

/* Section actions */
.section-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-text {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 12px;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    padding: 4px 0;
    transition: opacity 0.15s;
}

.btn-text:hover {
    opacity: 0.8;
}

.asset-add-row {
    margin-top: 4px;
}

/* Autocomplete badges */
.ac-badge {
    font-size: 9px;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.ac-badge-us { background: rgba(91,141,239,0.15); color: #5b8def; }
.ac-badge-kr { background: rgba(245,158,11,0.15); color: #f59e0b; }
.ac-badge-global { background: rgba(139,92,246,0.15); color: #8b5cf6; }

.ac-highlight {
    background: rgba(62, 207, 142, 0.12);
}

/* Amount presets */
.amount-presets {
    display: flex;
    gap: 4px;
    margin-top: 6px;
}

.amt-btn {
    flex: 1;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 10px;
    font-family: 'JetBrains Mono', monospace;
    cursor: pointer;
    transition: all 0.15s;
}

.amt-btn:hover { border-color: var(--text-secondary); color: var(--text); }
.amt-btn.active { border-color: var(--accent); color: var(--accent); }

/* Submit section */
.submit-section {
    margin-top: 8px;
}

.submit-summary {
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-family: 'JetBrains Mono', monospace;
    min-height: 18px;
}

.submit-summary.warn { color: var(--danger); }
.submit-summary.ready { color: var(--accent); }

.btn-lg {
    padding: 16px 32px;
    font-size: 15px;
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.mono {
    font-family: 'JetBrains Mono', monospace;
}

.form-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.form-title-row h2 {
    font-family: 'Outfit', sans-serif;
    margin: 0;
}

/* === Board === */
.board-sort {
    display: flex;
    gap: 4px;
}

.sort-btn {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-family: 'Outfit', sans-serif;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.15s;
}

.sort-btn:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.sort-btn.active { color: var(--accent); background: rgba(62,207,142,0.08); }

.board-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
    margin: 16px 0;
}

.board-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.board-card:hover {
    border-color: rgba(62,207,142,0.3);
    transform: translateY(-3px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.3), 0 0 16px var(--accent-glow);
}

.bc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px 0;
}

.bc-user {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bc-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(62,207,142,0.15);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
}

.bc-username {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.bc-date {
    font-size: 11px;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
}

.bc-title {
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.bc-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.5;
}

.bc-metrics {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.bcm {
    flex: 1;
    text-align: center;
    padding: 6px 4px;
    background: rgba(255,255,255,0.02);
    border-radius: 6px;
}

.bcm-label {
    display: block;
    font-size: 9px;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-family: 'Outfit', sans-serif;
    letter-spacing: 0.3px;
}

.bcm-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 600;
}

.bc-period {
    font-size: 11px;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
}

.bc-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-top: 1px solid var(--border);
}

.bc-social {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bc-stat {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
}

.bc-stat-icon {
    font-size: 13px;
}

.bc-view-btn {
    font-size: 12px;
    color: var(--accent);
    text-decoration: none;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.15s;
}

.bc-view-btn:hover {
    background: rgba(62,207,142,0.08);
}

/* Like Button */
.like-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.15s;
    font-family: inherit;
}

.like-btn:hover { background: rgba(239,68,68,0.08); color: var(--danger); }
.like-btn.liked { color: var(--danger); }
.like-btn.liked .like-icon { color: var(--danger); }
.like-btn.disabled { cursor: default; opacity: 0.5; }

/* Scrap Button */
.scrap-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.15s;
    font-family: inherit;
}

.scrap-btn:hover { background: rgba(245,158,11,0.08); color: #f59e0b; }
.scrap-btn.scraped { color: #f59e0b; }
.scrap-btn.scraped .scrap-icon { color: #f59e0b; }

.like-count {
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
}

.bc-body {
    display: block;
    padding: 12px 16px;
    color: inherit;
}

.bc-assets {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 12px;
}

.asset-tag-sm {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    background: rgba(255,255,255,0.05);
    color: var(--text-secondary);
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Share Section */
.share-section {
    margin: 24px 0 16px;
}

.share-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
}

.share-desc {
    flex: 1;
    min-width: 200px;
    resize: vertical;
    font-size: 13px;
}

.share-status {
    font-size: 12px;
    color: var(--accent);
    align-self: center;
}

/* Social Section */
.social-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin: 16px 0;
}

.social-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.comment-count-label {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Comments */
.comments-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.comment-item {
    display: flex;
    gap: 10px;
}

.comment-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(91,141,239,0.15);
    color: #5b8def;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    flex-shrink: 0;
}

.comment-body {
    flex: 1;
    min-width: 0;
}



.comment-user {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}

.comment-date {
    font-size: 10px;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
}

.comment-delete-form {
    display: inline;
    margin-left: auto;
}

.comment-delete-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    opacity: 0;
    transition: all 0.15s;
}

.comment-item:hover .comment-delete-btn {
    opacity: 1;
}

.comment-delete-btn:hover {
    color: var(--danger);
}

.comment-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 2px;
}

.comment-text {
    font-size: 13px;
    color: var(--text);
    line-height: 1.5;
    word-break: break-word;
}

.comment-empty {
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
    padding: 12px;
}

.comment-form {
    display: flex;
    gap: 8px;
}

.comment-input {
    flex: 1;
}

.comment-login-hint {
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
}

.comment-login-hint a {
    color: var(--accent);
    text-decoration: none;
}

/* === Profile === */
.profile-page {
    max-width: 560px;
    margin: 32px auto;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
}

.profile-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(62,207,142,0.15);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    flex-shrink: 0;
}

.profile-username {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
}

.profile-joined {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.profile-stats {
    display: flex;
    gap: 8px;
    margin-bottom: 28px;
}

.profile-stat {
    flex: 1;
    text-align: center;
    padding: 16px 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.ps-value {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}

.ps-label {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
    text-transform: uppercase;
    font-family: 'Outfit', sans-serif;
}

.profile-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 12px;
}

.profile-section h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.profile-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.profile-link {
    padding: 10px 12px;
    border-radius: 6px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.15s;
}

.profile-link:hover {
    background: rgba(255,255,255,0.04);
}

.profile-danger-zone {
    border-color: rgba(239,68,68,0.2);
}

.danger-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.5;
}

/* === Legal Pages === */
.legal-page {
    max-width: 720px;
    margin: 32px auto;
    padding: 0 20px;
}

.legal-page h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    margin-bottom: 8px;
}

.legal-updated {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.legal-page section {
    margin-bottom: 28px;
}

.legal-page h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    margin-bottom: 10px;
    color: var(--text);
}

.legal-page p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 8px;
}

.legal-page ul, .legal-page ol {
    padding-left: 20px;
    margin-bottom: 8px;
}

.legal-page li {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 4px;
}

.legal-page strong {
    color: var(--text);
}

/* === Footer === */
.footer {
    border-top: 1px solid var(--border);
    padding: 32px 0;
    margin-top: 60px;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.footer-logo {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 14px;
    color: var(--accent);
}

.footer-copy {
    font-size: 11px;
    color: var(--text-secondary);
}

.footer-links {
    display: flex;
    gap: 16px;
}

.footer-links a {
    font-size: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.15s;
}

.footer-links a:hover {
    color: var(--text);
}

/* === Help Tooltip === */
.help-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    margin-left: 6px;
    vertical-align: middle;
    position: relative;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.help-tip:hover,
.help-tip.active {
    background: var(--accent);
    color: var(--bg);
}

.help-bubble {
    display: none;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: calc(100% + 8px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.6;
    color: var(--text);
    width: 280px;
    z-index: 300;
    box-shadow: var(--shadow-md);
    pointer-events: auto;
}

.help-bubble::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 8px;
    height: 8px;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    border-top: 1px solid var(--border);
}

.help-tip.active .help-bubble {
    display: block;
}

.help-bubble-portal {
    display: none;
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.6;
    color: var(--text);
    z-index: 400;
    box-shadow: var(--shadow-md);
}

.help-bubble strong {
    color: var(--accent);
}

/* Responsive */
/* === Hamburger Button === */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    z-index: 200;
}

.hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text);
    border-radius: 1px;
    transition: all 0.25s;
}

.hamburger.open span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}
.hamburger.open span:nth-child(2) {
    opacity: 0;
}
.hamburger.open span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* === Mobile: 768px === */
@media (max-width: 768px) {
    /* Nav */
    .hamburger { display: flex; }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        height: calc(100vh - 57px);
        height: calc(100dvh - 57px);
        background: var(--bg);
        flex-direction: column;
        align-items: stretch;
        padding: 16px 20px;
        gap: 4px;
        font-size: 15px;
        z-index: 150;
        border-top: 1px solid var(--border);
        overflow-y: auto;
    }

    .nav-links.open { display: flex; }

    .nav-links a, .nav-link-btn {
        padding: 12px 0;
        font-size: 15px;
        border-bottom: 1px solid var(--border);
    }

    .nav-divider { display: none; }

    .btn-nav {
        text-align: center;
        padding: 12px;
        margin-top: 4px;
    }

    /* Container */
    .container { padding: 0 16px; }

    /* Home */
    .hero { padding: 60px 0 40px; }
    .hero h1 { font-size: 2.4rem; letter-spacing: -1px; }
    .hero-desc { font-size: 14px; }
    .features-grid { grid-template-columns: 1fr; gap: 10px; }
    .stats-strip { gap: 20px; flex-wrap: wrap; }
    .stat-number { font-size: 22px; }
    .hero-cta { flex-direction: column; align-items: center; }
    .hero-badge { font-size: 10px; padding: 5px 12px; }
    .feature-card { padding: 20px 16px; }
    .cta-section { padding: 40px 0 60px; }
    .cta-section h2 { font-size: 1.4rem; }

    /* Backtest Form */
    .page-card { padding: 20px 16px; margin: 20px 0; }
    .preset-portfolio-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row { flex-direction: column; gap: 8px; }
    .asset-row { flex-wrap: wrap; }
    .asset-search-col { flex: 1 1 100%; }
    .asset-weight-col { width: 70px; }
    .period-presets { flex-wrap: wrap; }
    .amount-presets { flex-wrap: wrap; }

    /* Result Page */
    .result-hero { padding: 20px 16px; margin-top: 16px; }
    .result-hero-top { flex-direction: column; gap: 10px; }
    .result-title { font-size: 16px; }
    .result-meta { font-size: 11px; }

    .hero-metrics { flex-direction: column; gap: 4px; }
    .hero-metric { padding: 6px 8px; }
    .hero-metric-divider { width: 60%; height: 1px; margin: 0 auto; }
    .hm-value { font-size: 24px; }
    .hm-label { font-size: 10px; }

    .sub-metrics { flex-wrap: wrap; gap: 6px; }
    .sub-metric { flex: 1 1 45%; padding: 10px 8px; }
    .sm-value { font-size: 14px; }

    .chart-row { grid-template-columns: 1fr; gap: 10px; }
    .chart-card { padding: 12px 8px; }

    .composition-legend { gap: 6px 12px; }
    .cb-legend-item { font-size: 11px; }
    .cb-val { display: none; }

    .yearly-card { padding: 4px 10px 10px; }
    .yearly-table-v2 td, .yearly-table-v2 th { padding: 8px 4px; font-size: 12px; }
    .col-bar { display: none; }

    .result-action-bar { flex-direction: column; gap: 10px; padding: 14px 16px; }
    .action-bar-left, .action-bar-right { justify-content: center; }
    .result-actions { flex-wrap: wrap; justify-content: center; }

    /* Board */
    .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
    .board-grid { grid-template-columns: 1fr; }
    .bc-metrics { flex-wrap: wrap; gap: 4px; }
    .bcm { flex: 1 1 45%; }

    /* Portfolio List */
    .portfolio-grid { grid-template-columns: 1fr; }

    /* Profile */
    .profile-stats { flex-wrap: wrap; gap: 6px; }
    .profile-stat { flex: 1 1 45%; padding: 12px 4px; }
    .ps-value { font-size: 18px; }

    /* Auth */
    .auth-card { margin: 30px auto; padding: 24px 20px; }

    /* Social */
    .social-section { padding: 14px; }
    .comment-form { flex-direction: column; }
    .comment-form .btn { width: 100%; }

    /* Gated */
    .gated-cta { padding: 24px 20px; }
    .gated-cta h3 { font-size: 15px; }
    .gated-buttons { flex-direction: column; gap: 6px; }

    /* Loading */
    .loading-card { padding: 32px 24px; }

    /* Footer */
    .footer-inner { flex-direction: column; gap: 16px; text-align: center; }

    /* Table overflow containment */
    .yearly-card { overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* Help tooltip mobile — use portal instead */
    .help-tip.active .help-bubble { display: none; }

    /* Touch targets */
    .ac-item { padding: 14px 12px; font-size: 14px; }
    .btn-icon { width: 44px; height: 44px; font-size: 20px; }
    .sort-btn { padding: 10px 14px; }
    .like-btn, .scrap-btn { padding: 8px 12px; }
    .amt-btn { padding: 8px 4px; }

    /* Comment delete visible on mobile (no hover) */
    .comment-delete-btn { opacity: 0.6; }

    /* Hero CTA full width */
    .hero-cta { width: 100%; }
    .hero-cta .btn { width: 100%; text-align: center; }

    /* Hero desc br */
    .hero-desc br { display: none; }

    /* Footer links wrap */
    .footer-links { flex-wrap: wrap; justify-content: center; gap: 8px 16px; }

    /* Asset row cleanup */
    .asset-color { display: none; }
    .asset-row { position: relative; padding-right: 48px; }
    .asset-row .btn-icon.btn-remove {
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
    }

    /* Share dropdown bottom-sheet */
    .share-dropdown-wrap { position: static; }
    .share-dropdown {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        border-radius: 16px 16px 0 0;
        min-width: unset;
        padding: 16px;
        margin-top: 0;
        max-height: 60vh;
        overflow-y: auto;
    }

    /* Gated buttons full width */
    .gated-buttons .btn { width: 100%; text-align: center; }
}

@media (max-width: 480px) {
    .container { padding: 0 12px; }
    .page-card { padding: 16px 12px; margin: 12px 0; }

    /* Home */
    .hero h1 { font-size: 1.8rem; letter-spacing: -0.5px; }
    .hero-desc { font-size: 13px; }
    .hero-desc br { display: none; }
    .hero-badge { font-size: 9px; padding: 4px 10px; }
    .stats-strip { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
    .stat-number { font-size: 18px; }

    /* Form */
    .preset-portfolio-grid { grid-template-columns: 1fr; }
    .period-presets { display: grid; grid-template-columns: repeat(3, 1fr); }
    .preset-btn { text-align: center; padding: 10px 6px; }
    .amt-btn { padding: 8px 4px; font-size: 11px; }

    /* Result */
    .hm-value { font-size: 20px; }
    .sub-metric { flex: 1 1 100%; }
    .yearly-table-v2 td, .yearly-table-v2 th { padding: 6px 3px; font-size: 11px; }
    .gated-cta { padding: 20px 12px; }
    .gated-buttons .btn { width: 100%; text-align: center; }

    /* Board */
    .bcm { flex: 1 1 100%; }

    /* Profile */
    .profile-stats { display: grid; grid-template-columns: repeat(2, 1fr); }
    .profile-stat:last-child { grid-column: 1 / -1; }

    /* Footer */
    .footer-links { flex-wrap: wrap; justify-content: center; gap: 8px 16px; }

    /* Legal */
    .legal-page { padding: 0; }
}
