/* ===================================================================
   CoupleBot UI v3 — Standalone stylesheet (Figma Make design system)
   Themes: Gentle (:root) · Passionate (html.passionate)
   Mobile-first · max-width 480px · Plus Jakarta Sans
   =================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --background: #ffffff;
    --foreground: #18181b;
    --card: #ffffff;
    --muted: #f4f4f5;
    --muted-foreground: #71717a;
    --primary: #e94560;
    --primary-foreground: #ffffff;
    --border: #e4e4e7;
    --input-background: #f4f4f5;
    --destructive: #dc2626;
    --radius: 10px;
    --accent-soft: color-mix(in srgb, var(--primary) 12%, transparent);
    --accent-muted: color-mix(in srgb, var(--primary) 8%, var(--muted));
    --card-elevated: var(--muted);
    --overlay: color-mix(in srgb, var(--foreground) 45%, transparent);
    --shadow-sm: 0 1px 3px color-mix(in srgb, var(--foreground) 8%, transparent);
    --shadow-md: 0 8px 24px color-mix(in srgb, var(--foreground) 10%, transparent);
    --shadow-lg: 0 16px 40px color-mix(in srgb, var(--foreground) 14%, transparent);
    --header-border: var(--border);
    --success: #16a34a;
    --success-soft: color-mix(in srgb, var(--success) 12%, transparent);
    --warning: #f59e0b;
    --warning-soft: color-mix(in srgb, var(--warning) 14%, transparent);
    --cute-color: #f472b6;
    --playful-color: #fb923c;
    --hot-color: var(--primary);
    --extreme-color: #a855f7;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --nav-height: 64px;
    --content-padding: 16px;
    --app-max-width: 480px;
    --sidebar-width: 280px;
    --header-height: 52px;
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 24px;
    --radius-sm: 8px;
    --radius-md: var(--radius);
    --radius-lg: 14px;
    --radius-xl: 18px;
    --radius-full: 9999px;
    --ease-out: cubic-bezier(0.25, 0.8, 0.25, 1);
    --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --tg-theme-bg-color: var(--background);
    --tg-theme-secondary-bg-color: var(--muted);
    --tg-theme-tertiary-bg-color: var(--card-elevated);
    --tg-theme-text-color: var(--foreground);
    --tg-theme-hint-color: var(--muted-foreground);
    --tg-theme-button-color: var(--primary);
    --tg-theme-button-text-color: var(--primary-foreground);
    --tg-theme-accent-color: var(--primary);
    --bg-sidebar: var(--card);
}

html.passionate {
    --background: #0a0a0a;
    --foreground: #fafafa;
    --card: #141414;
    --muted: #1c1c1c;
    --muted-foreground: #a1a1aa;
    --primary: #ef4444;
    --primary-foreground: #ffffff;
    --border: #27272a;
    --input-background: #171717;
    --destructive: #ef4444;
    --accent-soft: color-mix(in srgb, var(--primary) 18%, transparent);
    --accent-muted: color-mix(in srgb, var(--primary) 10%, var(--muted));
    --card-elevated: #1f1f1f;
    --overlay: rgba(0, 0, 0, 0.65);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.55);
    --cute-color: #fb7185;
    --playful-color: #fdba74;
    --hot-color: var(--primary);
    --extreme-color: #c084fc;
    --tg-theme-bg-color: var(--background);
    --tg-theme-secondary-bg-color: var(--muted);
    --tg-theme-tertiary-bg-color: var(--card-elevated);
    --tg-theme-text-color: var(--foreground);
    --tg-theme-hint-color: var(--muted-foreground);
    --tg-theme-button-color: var(--primary);
    --tg-theme-button-text-color: var(--primary-foreground);
    --bg-sidebar: var(--card);
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; color-scheme: light; }

html.passionate { color-scheme: dark; }

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI',
    Roboto, Helvetica, Arial, sans-serif;
    background: var(--background);
    color: var(--foreground);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.45;
    font-size: 15px;
}

img,
svg { display: block; max-width: 100%; }

button,
input,
select,
textarea { font: inherit; color: inherit; }

a { color: var(--primary); text-decoration: none; }

.app {
    max-width: var(--app-max-width);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    background: var(--background);
}

.content-area { flex: 1; padding: 0 var(--content-padding); padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + var(--space-lg)); overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }

.page { display: none; animation: v3PageIn 0.22s var(--ease-out); }

.page.active { display: block; }

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

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--content-padding);
    height: var(--header-height);
    flex-shrink: 0;
    background: var(--background);
    border-bottom: 1px solid var(--header-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left { display: flex; align-items: center; gap: var(--space-sm); min-width: 0; }

.header-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.hamburger-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--foreground);
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s var(--ease-out);
    -webkit-tap-highlight-color: transparent;
    padding: 0;
    line-height: 1;
}

.hamburger-btn:active { background: var(--muted); }

.header-title { font-size: 18px; font-weight: 800; letter-spacing: -0.3px; color: var(--primary); }

.header-streak {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 4px 10px;
    background: var(--warning-soft);
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 700;
    color: var(--warning);
}

.header-partner-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px 4px 6px;
    background: var(--accent-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    max-width: 140px;
}

.header-partner-mood { font-size: 18px; line-height: 1; }

.header-partner-name { font-size: 12px; font-weight: 600; color: var(--foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.header-bell {
    font-size: 18px;
    line-height: 1;
    position: relative;
    cursor: pointer;
    background: none;
    border: none;
    padding: 6px;
    border-radius: var(--radius-sm);
    color: var(--foreground);
    -webkit-tap-highlight-color: transparent;
}

.header-bell:active { background: var(--muted); }

.header-bell .bell-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    display: none;
    box-shadow: 0 0 0 2px var(--background);
}

.header-bell.has-notif .bell-dot { display: block; }

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s var(--ease-out), visibility 0.3s;
}

.sidebar-backdrop.open { opacity: 1; visibility: visible; }

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    max-width: 85vw;
    height: 100%;
    height: 100dvh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.32s var(--ease-out);
    box-shadow: var(--shadow-lg);
}

.sidebar.open { transform: translateX(0); }

.sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: calc(var(--safe-top) + 14px) var(--space-lg) 14px; border-bottom: 1px solid var(--border); flex-shrink: 0; }

.sidebar-header-title { font-size: 17px; font-weight: 800; color: var(--primary); }

.sidebar-close-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--muted);
    color: var(--muted-foreground);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.sidebar-close-btn:active { background: var(--card-elevated); color: var(--foreground); }

.sidebar-body { flex: 1; overflow-y: auto; padding: var(--space-md) 0 var(--space-xl); -webkit-overflow-scrolling: touch; }

.sidebar-profile { display: flex; align-items: center; gap: var(--space-md); padding: var(--space-md) var(--space-lg); }

.sidebar-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: var(--accent-soft);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.sidebar-username { font-size: 15px; font-weight: 700; color: var(--foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    width: 100%;
    padding: 14px var(--space-lg);
    border: none;
    background: transparent;
    color: var(--foreground);
    font-size: 15px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s var(--ease-out);
    -webkit-tap-highlight-color: transparent;
}

.sidebar-item:active { background: var(--muted); }

.sidebar-item-icon { font-size: 20px; width: 28px; text-align: center; flex-shrink: 0; }

.sidebar-item-label { flex: 1; }

.sidebar-divider { height: 1px; background: var(--border); margin: var(--space-sm) var(--space-lg); }

.sidebar-item.logout-item { color: var(--destructive); margin-top: var(--space-sm); }

.sidebar-lang-row { display: flex; align-items: center; gap: var(--space-md); padding: 12px var(--space-lg); }

.sidebar-lang-row .sidebar-item-icon { flex-shrink: 0; }

.sidebar-lang-btns { display: flex; gap: 2px; background: var(--muted); border-radius: var(--radius-sm); padding: 3px; border: 1px solid var(--border); }

.lang-btn {
    padding: 5px 12px;
    border: none;
    border-radius: calc(var(--radius-sm) - 2px);
    background: transparent;
    color: var(--muted-foreground);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
    line-height: 1.4;
}

.lang-btn.active { background: var(--primary); color: var(--primary-foreground); }

.lang-btn:active { transform: scale(0.95); }

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--app-max-width);
    height: var(--nav-height);
    background: var(--card);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 var(--space-sm);
    padding-bottom: var(--safe-bottom);
    z-index: 150;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 -4px 24px color-mix(in srgb, var(--foreground) 6%, transparent);
}

.main-tab {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 12px 6px;
    min-width: 64px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--muted-foreground);
    font-size: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s var(--ease-out), transform 0.15s var(--ease-out);
    -webkit-tap-highlight-color: transparent;
}

.main-tab .nav-icon { font-size: 22px; line-height: 1; transition: transform 0.2s var(--ease-out); }

.main-tab .nav-label { font-size: 10px; font-weight: 600; line-height: 1; }

.main-tab.active { color: var(--primary); }

.main-tab.active .nav-icon { transform: scale(1.08); }

.main-tab.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 3px;
    background: var(--primary);
    border-radius: 0 0 3px 3px;
}

.main-tab:active { transform: scale(0.92); }

.home-greeting { margin-bottom: var(--space-lg); padding-top: var(--space-sm); }

.home-greeting-label { font-size: 13px; font-weight: 500; color: var(--muted-foreground); margin-bottom: 2px; }

.home-greeting-name { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; line-height: 1.15; color: var(--foreground); }

.ritual-stack { display: flex; flex-direction: column; gap: var(--space-md); margin-bottom: var(--space-lg); }

.ritual-card { position: relative; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: var(--space-lg); box-shadow: var(--shadow-md); }

.ritual-card--mood { text-align: center; }

.ritual-card-label { font-size: 11px; font-weight: 700; color: var(--muted-foreground); text-transform: uppercase; letter-spacing: 0.55px; margin-bottom: var(--space-md); }

.dashboard-mood-row { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }

.dashboard-section { margin-bottom: var(--space-md); }

.dashboard-section--secondary { opacity: 0.95; }

.dashboard-section--secondary .dashboard-section-title { font-size: 12px; font-weight: 600; text-transform: none; letter-spacing: 0; }

.dashboard-section-title { font-size: 13px; font-weight: 700; color: var(--muted-foreground); text-transform: uppercase; letter-spacing: 0.45px; margin-bottom: var(--space-sm); }

/* Menu grids — legacy alias + v3 home menu */
.menu-grid,
.v3-menu-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-sm); margin-bottom: var(--space-lg); }

@media (min-width: 380px) {
    .menu-grid,
    .v3-menu-grid { gap: var(--space-md); }
}

.v3-menu-card,
.menu-grid .game-mini-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-lg);
    min-height: 108px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--card);
    color: var(--foreground);
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: transform 0.15s var(--ease-out), border-color 0.15s, box-shadow 0.15s;
    box-shadow: var(--shadow-sm);
    -webkit-tap-highlight-color: transparent;
}

.v3-menu-card:active,
.menu-grid button:active { transform: scale(0.97); border-color: var(--primary); box-shadow: var(--shadow-md); }

.v3-menu-card-icon,
.v3-menu-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    line-height: 1;
    border-radius: var(--radius-md);
    background: var(--accent-soft);
    flex-shrink: 0;
}

.v3-menu-card strong { font-size: 14px; font-weight: 700; display: block; margin-bottom: 2px; }

.game-cards-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-sm); }

.game-mini-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: var(--space-lg) var(--space-sm);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--card);
    color: var(--foreground);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s var(--ease-out), border-color 0.15s, background 0.15s;
    box-shadow: var(--shadow-sm);
    -webkit-tap-highlight-color: transparent;
    text-align: center;
}

.game-mini-card .gm-emoji { font-size: 28px; line-height: 1; }

.game-mini-card:active { transform: scale(0.95); border-color: var(--primary); background: var(--accent-muted); }

.compliment-card,
.challenge-card { background: transparent; border: none; border-radius: 0; padding: 0; box-shadow: none; text-align: center; }

.compliment-label,
.challenge-header { font-size: 12px; font-weight: 600; color: var(--muted-foreground); text-transform: uppercase; letter-spacing: 0.45px; margin-bottom: var(--space-sm); }

.compliment-text,
.challenge-task { font-size: 17px; font-weight: 600; color: var(--foreground); line-height: 1.5; margin: 0 0 var(--space-md); }

.compliment-send-btn,
.wish-cta-btn {
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--primary);
    color: var(--primary-foreground);
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 20px color-mix(in srgb, var(--primary) 35%, transparent);
    transition: transform 0.15s var(--ease-out), box-shadow 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.compliment-send-btn:active,
.wish-cta-btn:active { transform: scale(0.98); }

.compliment-sent-msg,
.challenge-bonus { font-size: 14px; font-weight: 600; color: var(--success); margin-top: var(--space-sm); }

.challenge-progress { display: flex; gap: var(--space-md); justify-content: center; margin-bottom: var(--space-md); flex-wrap: wrap; }

.challenge-check {
    font-size: 13px;
    font-weight: 500;
    color: var(--muted-foreground);
    padding: 6px 12px;
    border-radius: var(--radius-full);
    background: var(--input-background);
    border: 1px solid var(--border);
}

.challenge-check.done { color: var(--success); background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 35%, transparent); }

.challenge-complete-btn {
    background: linear-gradient(135deg, var(--warning), #fbbf24);
    color: #1a1a1a;
    border: none;
    border-radius: var(--radius-md);
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s var(--ease-out);
}

.challenge-complete-btn:active { transform: scale(0.96); }

.challenge-complete-btn:disabled { opacity: 0.5; cursor: default; }

.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: var(--space-lg);
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
    flex: 1 0 auto;
    padding: 9px 10px;
    border: none;
    border-radius: calc(var(--radius) - 2px);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    color: var(--muted-foreground);
    background: transparent;
    transition: all 0.2s var(--ease-out);
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.tab:active { transform: scale(0.96); }

.tab.active[data-tab="cute"],
.tab.active[data-game-level="cute"] { background: var(--cute-color); color: #fff; }

.tab.active[data-tab="playful"],
.tab.active[data-game-level="playful"] { background: var(--playful-color); color: #1a1a1a; }

.tab.active[data-tab="hot"],
.tab.active[data-game-level="hot"] { background: var(--hot-color); color: var(--primary-foreground); }

.tab.active[data-tab="extreme"],
.tab.active[data-game-level="extreme"] { background: var(--extreme-color); color: #fff; }

.tab.active[data-game-level="all"] { background: var(--primary); color: var(--primary-foreground); }

.buttons-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-sm); padding-bottom: var(--space-md); }

.request-btn {
    position: relative;
    padding: var(--space-lg) 14px;
    border-radius: var(--radius-lg);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    min-height: 72px;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    overflow: hidden;
    transition: transform 0.15s var(--ease-out), box-shadow 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.request-btn .btn-emoji { font-size: 22px; flex-shrink: 0; }

.request-btn.cute { background: color-mix(in srgb, var(--cute-color) 12%, var(--card)); border: 1px solid color-mix(in srgb, var(--cute-color) 35%, transparent); color: var(--foreground); }

.request-btn.playful { background: color-mix(in srgb, var(--playful-color) 12%, var(--card)); border: 1px solid color-mix(in srgb, var(--playful-color) 35%, transparent); color: var(--foreground); }

.request-btn.hot { background: color-mix(in srgb, var(--hot-color) 12%, var(--card)); border: 1px solid color-mix(in srgb, var(--hot-color) 35%, transparent); color: var(--foreground); }

.request-btn:active { transform: scale(0.95); }

.request-btn.sent { animation: v3SendPulse 0.55s var(--ease-out); }

@keyframes v3SendPulse {
    0% { transform: scale(1); }
    35% { transform: scale(0.92); }
    55% { transform: scale(1.04); }
    100% { transform: scale(1); }
}

.mood-section { margin-bottom: var(--space-md); }

.mood-row {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-sm) 10px;
}

.mood-me,
.mood-partner { display: flex; flex-direction: column; align-items: center; gap: 0; min-width: 40px; flex-shrink: 0; }

.mood-label { font-size: 9px; color: var(--muted-foreground); font-weight: 600; line-height: 1; }

.mood-emoji { font-size: 24px; line-height: 1; transition: transform 0.25s var(--ease-spring); }

.mood-buttons { display: flex; gap: 4px; flex: 1; justify-content: center; flex-wrap: wrap; }

.mood-btn {
    width: 38px;
    height: 38px;
    border: 2px solid transparent;
    border-radius: var(--radius-full);
    background: var(--input-background);
    font-size: 19px;
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
}

.mood-btn:active { transform: scale(0.88); }

.mood-btn.active { border-color: var(--primary); background: var(--accent-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); transform: scale(1.06); }

.mood-heatmap-toggle {
    display: block;
    width: 100%;
    background: none;
    border: none;
    color: var(--muted-foreground);
    font-size: 12px;
    cursor: pointer;
    padding: 6px 4px;
    margin-top: 4px;
    font-weight: 500;
}

.mood-heatmap-section { background: var(--muted); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px 12px; margin-bottom: var(--space-md); }

.mood-heatmap-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; }

.heatmap-cell { aspect-ratio: 1; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 11px; }

.heatmap-cell.empty { background: var(--input-background); opacity: 0.5; }

.heatmap-cell.has-mood { background: var(--card); border: 1px solid var(--border); }

.notes-canvas {
    position: relative;
    min-height: 340px;
    background: var(--muted);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-md);
    overflow: hidden;
    border: 2px dashed var(--border);
}

.notes-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted-foreground);
    font-size: 14px;
    text-align: center;
    line-height: 1.6;
    opacity: 0.75;
    pointer-events: none;
    padding: var(--space-lg);
}

.notes-composer { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-md); box-shadow: var(--shadow-sm); }

.notes-composer input {
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--input-background);
    color: var(--foreground);
    font-size: 14px;
    margin-bottom: var(--space-sm);
}

.notes-composer input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--accent-soft); }

.notes-colors { display: flex; gap: var(--space-sm); margin-bottom: var(--space-md); justify-content: center; }

.sticker-color {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    border: 3px solid transparent;
    cursor: pointer;
    padding: 0;
    transition: transform 0.15s, border-color 0.15s;
}

.sticker-color.active { border-color: var(--foreground); transform: scale(1.12); }

.notes-send-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--primary);
    color: var(--primary-foreground);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, opacity 0.15s;
}

.notes-send-btn:active { transform: scale(0.97); opacity: 0.92; }

.calendar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-md); }

.cal-nav {
    width: 40px;
    height: 40px;
    background: var(--muted);
    border: 1px solid var(--border);
    color: var(--foreground);
    border-radius: var(--radius-sm);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.15s;
}

.cal-nav:active { background: var(--card-elevated); transform: scale(0.92); }

.cal-month-label { font-size: 17px; font-weight: 700; text-transform: capitalize; }

.calendar-legend {
    display: flex;
    gap: 14px;
    font-size: 12px;
    color: var(--muted-foreground);
    margin-bottom: var(--space-sm);
    justify-content: center;
    flex-wrap: wrap;
}

.calendar-hint { text-align: center; font-size: 12px; color: var(--muted-foreground); margin-bottom: var(--space-md); opacity: 0.85; }

.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }

.cal-day-header { text-align: center; font-size: 11px; color: var(--muted-foreground); padding: 8px 0 6px; font-weight: 600; }

.cal-day {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    background: var(--muted);
    border: 1px solid transparent;
    cursor: pointer;
    position: relative;
    transition: transform 0.15s var(--ease-out), border-color 0.15s;
    min-width: 0;
}

.cal-day.empty { background: transparent; cursor: default; pointer-events: none; }

.cal-day.today { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); font-weight: 700; box-shadow: 0 0 12px color-mix(in srgb, var(--primary) 40%, transparent); }

.cal-day.period { background: color-mix(in srgb, var(--primary) 18%, var(--muted)); border-color: color-mix(in srgb, var(--primary) 40%, transparent); }

.cal-day.fertile,
.cal-day.ovulation { background: color-mix(in srgb, var(--success) 16%, var(--muted)); border-color: color-mix(in srgb, var(--success) 35%, transparent); }

.cal-day.pms { background: color-mix(in srgb, var(--muted-foreground) 14%, var(--muted)); }

.cal-day.selected { border: 2px solid var(--primary) !important; transform: scale(1.05); z-index: 2; }

.cal-day:active:not(.empty) { transform: scale(0.92); }

.game-card-container { display: flex; justify-content: center; align-items: center; min-height: 260px; perspective: 1200px; margin: var(--space-lg) 0; }

.game-card {
    width: 100%;
    max-width: 340px;
    min-height: 220px;
    border-radius: var(--radius-xl);
    background: var(--card);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 24px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: transform 0.4s var(--ease-out), box-shadow 0.3s;
}

.game-card.draw-anim { animation: v3CardDraw 0.5s var(--ease-out); }

@keyframes v3CardDraw {
    0% { transform: translateY(48px) scale(0.9); opacity: 0; }
    60% { transform: translateY(-8px) scale(1.02); opacity: 1; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

.game-card.cute { border-color: var(--cute-color); }
.game-card.playful { border-color: var(--playful-color); }
.game-card.hot { border-color: var(--hot-color); }
.game-card.extreme { border-color: var(--extreme-color); }

.game-card-inner { text-align: center; width: 100%; }

.game-card-level {
    display: inline-block;
    padding: 4px 14px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: var(--space-lg);
    background: var(--muted);
    color: var(--muted-foreground);
}

.game-card-text { font-size: 20px; font-weight: 600; line-height: 1.4; color: var(--foreground); }

.game-draw-btn {
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    padding: var(--space-lg);
    border: none;
    border-radius: var(--radius-lg);
    background: var(--primary);
    color: var(--primary-foreground);
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s var(--ease-out);
    box-shadow: 0 6px 20px color-mix(in srgb, var(--primary) 30%, transparent);
}

.game-draw-btn:active { transform: scale(0.96); }

.game-actions { display: flex; gap: var(--space-md); justify-content: center; margin-bottom: var(--space-lg); }

.game-btn {
    flex: 1;
    max-width: 160px;
    padding: 14px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s var(--ease-out);
}

.game-btn-do { background: var(--success); color: #fff; }
.game-btn-drink { background: var(--destructive); color: #fff; }
.game-btn:active { transform: scale(0.95); }

.game-player-turn { text-align: center; padding: 10px; margin-bottom: var(--space-sm); font-size: 15px; font-weight: 600; color: var(--primary); }

.game-stats { margin-top: var(--space-lg); padding: 14px var(--space-lg); background: var(--muted); border: 1px solid var(--border); border-radius: var(--radius-md); font-size: 13px; }

.game-stats-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; flex-wrap: wrap; }

.game-stats-row:first-child { border-bottom: 1px solid var(--border); padding-bottom: 12px; }

.game-stats-label { font-weight: 700; min-width: 65px; }
.game-stats-val { color: var(--muted-foreground); font-size: 12px; }
.game-stats-val b { color: var(--foreground); font-weight: 700; }

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 200;
    justify-content: center;
    align-items: flex-end;
}

.modal.show { display: flex; animation: v3ModalBg 0.2s var(--ease-out); }

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

.modal-content {
    background: var(--card);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: var(--space-xl) 20px calc(var(--space-xl) + var(--safe-bottom));
    width: 100%;
    max-width: var(--app-max-width);
    max-height: 85vh;
    overflow-y: auto;
    border-top: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    animation: v3ModalUp 0.3s var(--ease-out);
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

@keyframes v3ModalUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-content h3 { margin-bottom: var(--space-lg); font-size: 18px; font-weight: 700; color: var(--foreground); }

.modal-content select,
.modal-content input[type="date"],
.modal-content input[type="text"],
.modal-content input[type="email"],
.modal-content input[type="password"],
.modal-content textarea {
    width: 100%;
    padding: 12px 14px;
    margin-bottom: var(--space-md);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--input-background);
    color: var(--foreground);
    font-size: 15px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.modal-content select:focus,
.modal-content input:focus,
.modal-content textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--accent-soft); }

.modal-buttons { display: flex; gap: var(--space-sm); margin-top: var(--space-lg); }

.btn-save {
    flex: 1;
    padding: 14px;
    background: var(--primary);
    color: var(--primary-foreground);
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s;
}

.btn-save:active { transform: scale(0.97); }

.btn-cancel {
    flex: 1;
    padding: 14px;
    background: var(--muted);
    color: var(--foreground);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, background 0.15s;
}

.btn-cancel:active { transform: scale(0.97); background: var(--card-elevated); }

.toast {
    position: fixed;
    bottom: calc(var(--nav-height) + var(--safe-bottom) + 12px);
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    background: var(--success);
    color: #fff;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 14px;
    opacity: 0;
    transition: all 0.3s var(--ease-out);
    pointer-events: none;
    z-index: 300;
    max-width: calc(100vw - 32px);
    white-space: nowrap;
    box-shadow: var(--shadow-md);
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.toast.error { background: var(--destructive); }

.day-detail-header { text-align: center; margin-bottom: var(--space-lg); padding-bottom: var(--space-lg); border-bottom: 1px solid var(--border); }

.day-detail-close {
    position: absolute;
    top: 4px;
    right: 12px;
    background: none;
    border: none;
    color: var(--muted-foreground);
    font-size: 28px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}

.day-detail-date { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.day-detail-cycle-info { font-size: 13px; color: var(--muted-foreground); }

.day-detail-quick-actions { display: flex; gap: 10px; justify-content: center; margin: var(--space-lg) 0; }

.quick-add-btn {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--muted);
    font-size: 24px;
    cursor: pointer;
    transition: transform 0.15s, background 0.15s;
}

.quick-add-btn:active { transform: scale(0.9); background: var(--primary); border-color: var(--primary); }

.wish-cta-section { margin-bottom: var(--space-lg); }

.wishes-expand-btn {
    display: block;
    width: 100%;
    margin-bottom: var(--space-sm);
    padding: 8px;
    border: none;
    background: transparent;
    color: var(--primary);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
}

.quick-wishes-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-sm); }

.quick-wishes-grid.collapsed .quick-wish-btn:nth-child(n+4) { display: none; }

.quick-wish-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--card);
    color: var(--foreground);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
}

.quick-wish-btn:active { transform: scale(0.93); border-color: var(--primary); background: var(--accent-muted); }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-lg); box-shadow: var(--shadow-sm); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.15s var(--ease-out), background 0.15s, border-color 0.15s;
    -webkit-tap-highlight-color: transparent;
    text-align: center;
    min-height: 44px;
}

.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); box-shadow: 0 4px 16px color-mix(in srgb, var(--primary) 28%, transparent); }

.btn-primary:active { box-shadow: 0 2px 10px color-mix(in srgb, var(--primary) 22%, transparent); }

.btn-outline { background: transparent; color: var(--foreground); border-color: var(--border); }

.btn-outline:active { background: var(--muted); border-color: var(--primary); color: var(--primary); }

.v3-page-header { display: flex; align-items: center; gap: var(--space-md); margin-bottom: var(--space-lg); padding-top: var(--space-xs); }

.v3-page-header h1,
.v3-page-header h2 { flex: 1; font-size: 22px; font-weight: 800; letter-spacing: -0.4px; color: var(--foreground); line-height: 1.2; }

.v3-back-btn {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--muted);
    color: var(--foreground);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.v3-back-btn:active { background: var(--accent-soft); border-color: var(--primary); transform: scale(0.94); }

.v3-muted { font-size: 13px; color: var(--muted-foreground); line-height: 1.45; margin: 0; }

.v3-widgets-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-sm); margin-bottom: var(--space-lg); }

@media (min-width: 400px) {
    .v3-widgets-row { grid-template-columns: repeat(3, 1fr); }
}

.v3-widget-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: var(--space-md);
    min-height: 88px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    text-align: left;
    color: var(--foreground);
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.v3-widget-card:active { transform: scale(0.97); border-color: var(--primary); }

.v3-widget-card .v3-widget-emoji { font-size: 24px; line-height: 1; }

.v3-widget-card strong { font-size: 13px; font-weight: 700; }

.v3-widget-card span.v3-muted { font-size: 11px; }

.v3-progress {
    width: 100%;
    height: 8px;
    background: var(--muted);
    border-radius: var(--radius-full);
    overflow: hidden;
    border: 1px solid var(--border);
    margin: var(--space-sm) 0;
}

.v3-progress-fill {
    height: 100%;
    min-width: 0;
    width: 0;
    background: linear-gradient(
    90deg,
    var(--primary),
    color-mix(in srgb, var(--primary) 70%, var(--cute-color))
    );
    border-radius: var(--radius-full);
    transition: width 0.45s var(--ease-out);
}

.stats-progress-bar { height: 6px; background: var(--muted); border-radius: var(--radius-full); overflow: hidden; margin: 10px 0 6px; border: 1px solid var(--border); }

.stats-progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--cute-color)); border-radius: var(--radius-full); transition: width 0.5s var(--ease-out); }

.v3-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    border-radius: var(--radius-full);
    background: var(--accent-soft);
    color: var(--primary);
    border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent);
    flex-shrink: 0;
}

.v3-settings-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-lg); margin-bottom: var(--space-md); box-shadow: var(--shadow-sm); }

.v3-settings-card h3 { font-size: 13px; font-weight: 700; color: var(--muted-foreground); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: var(--space-md); }

.v3-settings-card input[type="text"],
.v3-settings-card input[type="email"] {
    width: 100%;
    padding: 12px 14px;
    margin: var(--space-sm) 0 var(--space-md);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--input-background);
    color: var(--foreground);
}

.v3-settings-card input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--accent-soft); }

[data-theme-pick] {
    padding: var(--space-md);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--muted);
    color: var(--foreground);
    font-weight: 600;
    cursor: pointer;
}

[data-theme-pick].v3-theme-active { border-color: var(--primary); background: var(--accent-soft); color: var(--primary); }

.v3-ach-card {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
}

.v3-ach-card.v3-ach-locked { opacity: 0.5; filter: grayscale(0.85); }
.v3-ach-emoji { font-size: 28px; flex-shrink: 0; }

.celebration-banner,
.pwa-banner { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); }

.celebration-banner {
    position: fixed;
    top: calc(var(--header-height) + var(--safe-top) + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(-120%);
    width: calc(100% - 32px);
    max-width: calc(var(--app-max-width) - 32px);
    z-index: 400;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 14px var(--space-lg);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.4s var(--ease-out), opacity 0.4s;
}

.celebration-banner.show { transform: translateX(-50%) translateY(0); opacity: 1; pointer-events: auto; }

.pwa-banner { margin: 0 var(--content-padding) var(--space-md); }
.pwa-banner--fixed {
    position: fixed;
    top: calc(var(--header-height) + var(--safe-top));
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 24px);
    max-width: calc(var(--app-max-width) - 24px);
    z-index: 350;
    margin: 0;
}

.pwa-banner-inner { display: flex; align-items: flex-start; gap: var(--space-md); padding: var(--space-md); }

.pwa-banner-title { font-size: 14px; font-weight: 700; }
.pwa-banner-hint { font-size: 12px; color: var(--muted-foreground); }
.celebration-dismiss,
.pwa-banner-dismiss {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--muted);
    color: var(--muted-foreground);
    font-size: 20px;
    cursor: pointer;
}

.add-event-btn,
.privacy-btn {
    width: 100%;
    margin-top: var(--space-md);
    padding: 14px;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.add-event-btn { background: var(--primary); color: var(--primary-foreground); border: none; }

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

#invitePanel { margin-bottom: var(--space-lg); padding: var(--space-lg); background: var(--muted); border: 1px solid var(--border); border-radius: var(--radius-md); }

.logout-confirm-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 1100;
    display: none;
    justify-content: center;
    align-items: center;
    padding: var(--space-lg);
}

.logout-confirm-overlay.show { display: flex; }

.logout-confirm-dialog {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl) 20px;
    max-width: 340px;
    width: 100%;
    text-align: center;
}

.logout-confirm-yes { background: var(--destructive); color: #fff; }
.logout-confirm-no { background: var(--muted); border: 1px solid var(--border); }

.stats-box,
.predictions,
.stats-card { background: var(--muted); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-md) var(--space-lg); font-size: 13px; line-height: 1.7; }

.stats-loading { color: var(--muted-foreground); padding: 30px 0; text-align: center; }

.celebration-text { flex: 1; font-size: 14px; font-weight: 600; }
.compliment-section,
.challenge-section { margin-bottom: var(--space-md); }
.game-card-front { text-align: center; width: 100%; }
.game-counter { display: block; font-size: 11px; opacity: 0.75; margin-top: 3px; }
.turn-arrow { font-size: 18px; animation: v3Bounce 1s ease-in-out infinite; }
@keyframes v3Bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(6px); }
}
.logout-confirm-actions { display: flex; gap: var(--space-sm); margin-top: var(--space-md); }
.logout-confirm-actions button { flex: 1; padding: 12px; border: none; border-radius: var(--radius-md); font-weight: 600; cursor: pointer; }
.privacy-hint { font-size: 13px; color: var(--muted-foreground); margin-bottom: var(--space-md); }
.privacy-check,
.symptoms-check label { display: flex; align-items: center; gap: var(--space-md); padding: 10px 4px; font-size: 15px; cursor: pointer; }
.symptoms-check { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-sm); margin-bottom: var(--space-md); }
.push-banner { text-align: center; margin-bottom: var(--space-md); }
.pwa-banner-icon { font-size: 24px; flex-shrink: 0; }
.pwa-banner-body { flex: 1; min-width: 0; }
.theme-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-sm); margin-bottom: var(--space-lg); }
.theme-option { display: flex; flex-direction: column; align-items: center; gap: var(--space-sm); padding: var(--space-md); border: 2px solid var(--border); border-radius: var(--radius-md); background: var(--muted); cursor: pointer; font-size: 12px; }
.theme-option.active { border-color: var(--primary); background: var(--accent-soft); }
.theme-swatch { width: 36px; height: 36px; border-radius: var(--radius-full); }
.v3-welcome-card,
.v3-stats-card,
.v3-progress-card,
.v3-dice-panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-lg); margin-bottom: var(--space-md); box-shadow: var(--shadow-sm); }
.v3-theme-pick,
.v3-theme-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-sm); }
.v3-pos-grid,
.v3-ach-grid,
.v3-dice-grid { display: flex; flex-direction: column; gap: var(--space-sm); }
.v3-input { width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--input-background); color: var(--foreground); margin-bottom: var(--space-sm); }
.v3-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--accent-soft); }
.v3-label { font-size: 13px; font-weight: 600; color: var(--muted-foreground); margin-bottom: var(--space-xs); display: block; }
.v3-stat-num { font-size: 28px; font-weight: 800; color: var(--foreground); }
.v3-widget-title { font-size: 13px; font-weight: 700; }
.v3-widget-link { font-size: 12px; color: var(--primary); font-weight: 600; }
.v3-gender-row { display: flex; gap: var(--space-md); flex-wrap: wrap; }
.v3-icon-pink { color: #e94560; }
.v3-icon-red { color: #ef4444; }
.v3-icon-orange { color: #f59e0b; }
.v3-icon-yellow { color: #eab308; }
.v3-icon-green { color: #22c55e; }
.v3-icon-blue { color: #3b82f6; }
.v3-icon-purple { color: #a855f7; }

::-webkit-scrollbar { width: 4px; height: 4px; }

::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted-foreground) 35%, transparent); border-radius: 2px; }

@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .bottom-nav { padding-bottom: calc(6px + env(safe-area-inset-bottom)); }
    .modal-content { padding-bottom: calc(var(--space-xl) + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── Auth (login.html) ───────────────────────────────────────────── */
.auth-page-wrap {
    min-height: 100vh;
    min-height: -webkit-fill-available;
    background:
        radial-gradient(ellipse 80% 50% at 50% -10%, var(--accent-muted), transparent),
        radial-gradient(ellipse 60% 40% at 100% 100%, var(--accent-soft), transparent),
        var(--background);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl) var(--content-padding);
    padding-top: calc(var(--safe-top) + var(--space-xl));
    padding-bottom: calc(var(--safe-bottom) + var(--space-xl));
}

.auth-page { width: 100%; max-width: 400px; }

.auth-brand { text-align: center; margin-bottom: var(--space-xl); }

.auth-brand-mark {
    font-size: 48px;
    line-height: 1;
    margin-bottom: var(--space-sm);
    filter: drop-shadow(0 4px 12px color-mix(in srgb, var(--primary) 35%, transparent));
}

.auth-brand h1 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--foreground);
}

.auth-brand .subtitle {
    font-size: 14px;
    color: var(--muted-foreground);
    margin-top: 4px;
    font-weight: 500;
}

.auth-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: var(--space-xl);
    background: var(--muted);
    border-radius: var(--radius-md);
    padding: 4px;
    border: 1px solid var(--border);
}

.auth-tab {
    flex: 1;
    padding: 11px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
    background: transparent;
    color: var(--muted-foreground);
    font-size: 14px;
    transition: all 0.2s var(--ease-out);
}

.auth-tab.active {
    background: var(--primary);
    color: var(--primary-foreground);
}

.auth-form input,
.join-box input {
    width: 100%;
    padding: 14px;
    margin-bottom: var(--space-md);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--input-background);
    color: var(--foreground);
    font-size: 15px;
    font-family: inherit;
}

.auth-form input:focus,
.join-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.auth-form button[type="submit"] {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--primary);
    color: var(--primary-foreground);
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 8px 24px color-mix(in srgb, var(--primary) 30%, transparent);
}

.auth-form button[type="submit"]:active { transform: scale(0.97); opacity: 0.92; }

.auth-hint {
    font-size: 12px;
    color: var(--muted-foreground);
    margin-top: var(--space-md);
    line-height: 1.5;
}

.auth-error {
    color: var(--destructive);
    font-size: 14px;
    margin-bottom: var(--space-md);
    min-height: 20px;
    font-weight: 500;
}

.join-box {
    margin-top: var(--space-xl);
    padding-top: var(--space-xl);
    border-top: 1px solid var(--border);
}

.join-box button {
    width: 100%;
    margin-top: 10px;
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--foreground);
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
}

.auth-onboarding {
    display: none;
}

.auth-onboarding.active { display: block; }

.auth-onboarding .v3-gender-row label {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
}

.auth-onboarding .v3-gender-row input:checked + span,
.auth-onboarding .v3-gender-row label:has(input:checked) {
    border-color: var(--primary);
    background: var(--accent-soft);
}

#v3OnboardingModal.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

#v3OnboardingModal .modal-content {
    max-width: 360px;
    width: calc(100% - 32px);
}