@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=DM+Sans:wght@300;400;500&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg: #fff;
    --fg: #000;
    --muted: #999;
    --border: #e0e0e0;
    --serif: 'Instrument Serif', Georgia, serif;
    --sans: 'DM Sans', -apple-system, sans-serif;
    --mono: 'JetBrains Mono', monospace;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }
body { font-family: var(--sans); background: var(--bg); color: var(--fg); min-height: 100vh; padding: 2.5rem 0; }
::selection { background: #000; color: #fff; }
.hidden { display: none !important; }

.container { width: 100%; max-width: 520px; padding: 0 1.5rem; margin: 0 auto; text-align: center; }

/* ===== BRAND ===== */
.brand {
    font-family: var(--serif);
    font-size: clamp(2rem, 6vw, 3rem);
    font-weight: 400;
    font-style: italic;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.tagline {
    font-size: 0.78rem;
    font-weight: 300;
    color: var(--muted);
    letter-spacing: 0.02em;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

/* ===== TABS ===== */
.tab-bar {
    display: flex;
    border: 1px solid var(--fg);
    margin-bottom: 1.5rem;
}

.tab {
    flex: 1;
    font-family: var(--sans);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.7rem;
    background: transparent;
    color: var(--muted);
    border: none;
    cursor: pointer;
    transition: all 0.15s;
}

.tab.active {
    background: var(--fg);
    color: var(--bg);
}

.tab:not(.active):hover {
    color: var(--fg);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== RICH FORM ===== */
.rich-form { text-align: left; }

.rich-desc {
    font-size: 0.78rem;
    color: var(--muted);
    font-weight: 300;
    margin-bottom: 1.5rem;
    line-height: 1.5;
    text-align: center;
}

.rich-field { margin-bottom: 1rem; }

.rich-input {
    width: 100%;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--fg);
    font-family: var(--mono);
    font-size: 0.78rem;
    padding: 0.75rem;
    outline: none;
    transition: border-color 0.15s;
}

.rich-input:focus { border-color: var(--fg); }
.rich-input::placeholder { color: #ccc; }

.rich-textarea {
    resize: vertical;
    min-height: 80px;
    font-family: var(--sans);
}

.btn-rich-submit {
    width: 100%;
    background: var(--fg);
    color: var(--bg);
    border: 1px solid var(--fg);
    font-family: var(--sans);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.85rem;
    cursor: pointer;
    transition: all 0.15s;
    margin-top: 0.5rem;
}

.btn-rich-submit:hover { background: transparent; color: var(--fg); }
.btn-rich-submit:disabled { background: #999; cursor: default; }

.rich-status {
    font-family: var(--mono);
    font-size: 0.65rem;
    margin-top: 0.4rem;
    min-height: 1em;
    text-align: center;
}

.rich-status.success { color: #000; font-weight: 500; }
.rich-status.error { color: #c00; }

/* ===== LIVE VALUE ===== */
.live-value {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 2px;
    margin-bottom: 1.25rem;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.4s ease, margin 0.4s ease;
}

.live-value.visible {
    max-height: 80px;
    opacity: 1;
}

.live-dollar {
    font-family: var(--serif);
    font-size: 1rem;
    font-style: italic;
    color: var(--muted);
}

.live-amount {
    font-family: var(--serif);
    font-size: clamp(2rem, 7vw, 3rem);
    font-style: italic;
    font-weight: 400;
    line-height: 1;
}

/* ===== TRAITS ===== */
.traits-form { text-align: left; }

.trait-group {
    margin-bottom: 1.25rem;
}

.trait-label {
    display: block;
    font-family: var(--mono);
    font-size: 0.6rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.4rem;
}

.trait-options {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.trait-btn {
    font-family: var(--sans);
    font-size: 0.78rem;
    font-weight: 400;
    padding: 0.45rem 0.85rem;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--fg);
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.trait-btn:hover { border-color: var(--fg); }

.trait-btn.active {
    background: var(--fg);
    color: var(--bg);
    border-color: var(--fg);
}

/* Tooltip */
.trait-tooltip {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--fg);
    color: var(--bg);
    font-family: var(--mono);
    font-size: 0.55rem;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.45rem;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 10;
}

.trait-tooltip.visible { opacity: 1; }

.trait-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: var(--fg);
}

/* Shake */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}
.trait-group.shake { animation: shake 0.4s ease; }

/* ===== PNL SECTION ===== */
.pnl-share-section {
    animation: fadeIn 0.5s ease;
}

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

.pnl-divider {
    border-top: 1px solid var(--border);
    margin: 1.5rem 0;
}

.pnl-preview-wrap {
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    max-width: 380px;
    margin: 0 auto 1.25rem;
    box-shadow: 0 2px 16px rgba(0,0,0,0.06);
}

.pnl-preview-wrap canvas {
    width: 100%;
    height: auto;
    display: block;
}

/* ===== SHARE ===== */
.share-gate { margin-bottom: 1.5rem; }

.gate-sub {
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 300;
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.share-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    margin-bottom: 0.5rem;
}

.share-btn {
    font-family: var(--sans);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    padding: 0.7rem 0.5rem;
    background: var(--fg);
    color: var(--bg);
    border: 1px solid var(--fg);
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.share-btn:hover {
    background: transparent;
    color: var(--fg);
}

.share-btn.shared {
    background: transparent;
    color: var(--muted);
    border-color: var(--border);
    pointer-events: none;
}

.share-btn.shared::after { content: ' ✓'; }

.btn-save {
    width: 100%;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    font-family: var(--sans);
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.6rem;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-save:hover { border-color: var(--fg); color: var(--fg); }

/* ===== CLAIM ===== */
.claim-section {
    border-top: 1px solid var(--border);
    padding-top: 1.25rem;
    margin-bottom: 1rem;
    animation: fadeIn 0.4s ease;
}

.claim-unlocked {
    font-family: var(--serif);
    font-size: 1.1rem;
    font-style: italic;
    margin-bottom: 0.35rem;
}

.claim-sub {
    font-size: 0.75rem;
    color: var(--muted);
    font-weight: 300;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.email-row {
    display: flex;
    border: 1px solid var(--fg);
}

.email-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--fg);
    font-family: var(--mono);
    font-size: 0.78rem;
    padding: 0.8rem;
    outline: none;
}

.email-input::placeholder { color: #ccc; }
.email-row:focus-within { border-color: var(--fg); }

.btn-submit {
    background: var(--fg);
    color: var(--bg);
    border: none;
    padding: 0.8rem 1.5rem;
    font-family: var(--sans);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-submit:hover { background: #333; }
.btn-submit:disabled { background: #999; cursor: default; }

.claim-status {
    font-family: var(--mono);
    font-size: 0.65rem;
    margin-top: 0.4rem;
    min-height: 1em;
}

.claim-status.success { color: #000; font-weight: 500; }
.claim-status.error { color: #c00; }

/* ===== RETRY ===== */
.btn-retry {
    width: 100%;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 0.75rem;
    font-family: var(--sans);
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.15s;
    margin-top: 0.5rem;
}

.btn-retry:hover { border-color: var(--fg); color: var(--fg); }

/* ===== SOUND ===== */
.sound-toggle {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    background: var(--fg);
    color: var(--bg);
    border: none;
    font-family: var(--mono);
    font-size: 0.5rem;
    letter-spacing: 0.12em;
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    z-index: 50;
    transition: background 0.15s;
}

.sound-toggle:hover { background: #333; }

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
    body { padding: 1.5rem 0; }
    .container { padding: 0 1rem; }
    .brand { font-size: clamp(1.6rem, 6vw, 2.2rem); }
    .tagline { font-size: 0.72rem; margin-bottom: 1rem; }
    .live-dollar { font-size: 0.9rem; }
    .live-amount { font-size: clamp(1.8rem, 7vw, 2.5rem); }
    .live-value { margin-bottom: 1rem; }
    .trait-label { font-size: 0.55rem; }
    .trait-btn { font-size: 0.7rem; padding: 0.4rem 0.65rem; }
    .trait-options { gap: 4px; }
    .trait-group { margin-bottom: 1rem; }
    .pnl-preview-wrap { max-width: 100%; }
    .pnl-divider { margin: 1.25rem 0; }
    .share-btn { font-size: 0.68rem; padding: 0.6rem 0.3rem; }
    .gate-sub { font-size: 0.68rem; }
    .claim-section .email-row { flex-direction: column; border: none; gap: 0; }
    .claim-section .email-row .email-input { border: 1px solid var(--fg); border-bottom: none; text-align: center; }
    .claim-section .email-row .btn-submit { width: 100%; border: 1px solid var(--fg); }
    .sound-toggle { bottom: 0.5rem; right: 0.5rem; font-size: 0.45rem; }
}

@media (max-width: 380px) {
    .brand { font-size: 1.5rem; }
    .tagline { font-size: 0.68rem; }
    .trait-btn { font-size: 0.65rem; padding: 0.35rem 0.55rem; }
}
