:root {
    color-scheme: light;
    --bg: #f6f8fc;
    --card: #ffffff;
    --ink: #172033;
    --muted: #627084;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --danger: #dc2626;
    --danger-dark: #b91c1c;
    --accent: #f59e0b;
    --soft-blue: #dbeafe;
    --soft-green: #dcfce7;
    --border: #e2e8f0;
    --shadow: 0 24px 70px rgba(15, 23, 42, 0.12);
    --brand-pink: #c0266d;
    --brand-pink-hover: #a61e5c;
    --brand-pink-soft: #fce7f3;
    --brand-yellow: #f4c95d;
    --header-border: #f4c95d;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    min-height: 100vh;
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(192, 38, 109, 0.20), transparent 34rem),
        radial-gradient(circle at bottom right, rgba(192, 38, 109, 0.20), transparent 30rem),
        var(--bg);
}

button,
select {
    font: inherit;
}

button {
    border: 0;
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.site-header {
    display: flex;
    width: min(1120px, calc(100% - 32px));
    min-height: 72px;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin: 0 auto;
    padding: 0 20px;
    border-top: 3px solid var(--brand-yellow);
    border-bottom: 2px solid var(--header-border);
    border-radius: 0 0 18px 18px;
    background: var(--brand-pink);
    box-shadow: 0 8px 24px rgba(192, 38, 109, 0.18);
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--brand-yellow);
    font-size: 0.88rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-decoration: none;
}

.ai-badge {
    display: inline-grid;
    width: 1.5em;
    height: 1.5em;
    place-items: center;
    border-radius: 6px;
    color: var(--brand-pink);
    background: var(--brand-yellow);
    font-size: inherit;
    letter-spacing: 0;
    line-height: 1;
}

.top-nav {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-button {
    min-height: 44px;
    padding: 10px 18px;
    border: 1px solid var(--brand-yellow);
    border-radius: 999px;
    color: var(--brand-pink);
    background: var(--brand-yellow);
    font-weight: 750;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.nav-button:hover {
    border-color: var(--brand-pink-soft);
    background: var(--brand-pink-soft);
}

.nav-button-primary {
    color: var(--brand-pink);
    background: var(--brand-yellow);
    box-shadow: 0 6px 16px rgba(244, 201, 93, 0.28);
}

.nav-button-primary:hover {
    border-color: var(--brand-yellow);
    background: #ffe08a;
}

.nav-button:focus-visible {
    outline: 3px solid var(--brand-yellow);
    outline-offset: 3px;
}

.app-shell {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 40px;
}

.hero-card {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
    gap: 28px;
    align-items: stretch;
    padding: 32px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 32px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.hero-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.user-greeting {
    margin: 0;
    color: var(--brand-yellow);
    font-size: 0.95rem;
    font-weight: 700;
    text-align: right;
}

.eyebrow {
    margin: 0 0 12px;
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.brand-eyebrow {
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.4;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    max-width: 720px;
    margin-bottom: 16px;
    font-size: clamp(2.5rem, 6vw, 4.25rem);
    line-height: 1.05;
    letter-spacing: -0.04em;
}

h2 {
    margin-bottom: 12px;
    font-size: 1.25rem;
    letter-spacing: -0.03em;
}

.hero-copy {
    max-width: 580px;
    margin-bottom: 24px;
    color: var(--muted);
    font-size: 1.08rem;
    line-height: 1.6;
}

.change-language {
    width: fit-content;
    padding: 0;
    color: var(--primary-dark);
    background: transparent;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.change-language:hover {
    color: var(--primary);
}

.session-card {
    display: flex;
    min-height: 380px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 28px;
    border-radius: 28px;
    color: #0f172a;
    background:
        linear-gradient(160deg, rgba(245, 158, 11, 0.20), rgba(245, 158, 11, 0.12)),
        var(--card);
    text-align: center;
}

.avatar {
    display: grid;
    width: 92px;
    height: 92px;
    margin-bottom: 18px;
    place-items: center;
    border-radius: 50%;
    background: var(--brand-pink);
    box-shadow: 0 12px 34px rgba(192, 38, 109, 0.2);
}

.avatar-icon {
    display: block;
    width: 56px;
    height: 56px;
}

.session-label {
    margin-bottom: 6px;
    color: var(--primary-dark);
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

#sessionState {
    margin-bottom: 4px;
    font-size: 1.6rem;
}

#status {
    min-height: 24px;
    margin-bottom: 22px;
    color: var(--muted);
    font-weight: 700;
}

#status.connected {
    color: #15803d;
}

#status.connecting {
    color: var(--primary-dark);
}

#status.error {
    color: var(--danger);
}

#actionBtn {
    width: 100%;
    max-width: 280px;
    min-height: 50px;
    padding: 15px 24px;
    border-radius: 999px;
    color: white;
    font-size: 1rem;
    font-weight: 800;
    transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.28);
}

#actionBtn:active {
    transform: translateY(1px) scale(0.99);
}

.start {
    background: var(--primary);
}

.start:hover:not(:disabled) {
    background: var(--primary-dark);
}

.stop {
    background: var(--danger);
    box-shadow: 0 12px 28px rgba(220, 38, 38, 0.26);
}

.stop:hover:not(:disabled) {
    background: var(--danger-dark);
}

.mic-hint {
    max-width: 320px;
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.5;
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-top: 22px;
}

.info-card {
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.08);
}

.info-card p,
.info-card li {
    color: var(--muted);
    line-height: 1.6;
}

.check-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.check-list li {
    position: relative;
    padding-left: 28px;
}

.check-list li::before {
    position: absolute;
    left: 0;
    content: "✓";
    color: #16a34a;
    font-weight: 900;
}

.safety-card {
    background: linear-gradient(180deg, rgba(220, 252, 231, 0.88), rgba(255, 255, 255, 0.9));
}

.auth-dialog {
    width: min(560px, calc(100% - 32px));
    max-width: none;
    max-height: calc(100% - 32px);
    margin: auto;
    padding: 0;
    overflow: auto;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 28px;
    color: var(--ink);
    background: transparent;
    box-shadow: var(--shadow);
}

.auth-dialog::backdrop {
    background: rgba(15, 23, 42, 0.56);
    backdrop-filter: blur(6px);
}

.auth-dialog-card {
    position: relative;
    padding: clamp(24px, 6vw, 40px);
    border-radius: inherit;
    background: rgba(255, 255, 255, 0.98);
}

.dialog-close {
    position: absolute;
    top: 16px;
    right: 16px;
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border-radius: 50%;
    color: var(--muted);
    background: #f1f5f9;
    font-size: 1.7rem;
    line-height: 1;
}

.dialog-close:hover {
    color: var(--ink);
    background: #e2e8f0;
}

.auth-dialog-card h2 {
    max-width: 440px;
    padding-right: 24px;
    font-size: clamp(1.7rem, 6vw, 2.25rem);
    line-height: 1.15;
}

.auth-copy {
    margin-bottom: 20px;
    color: var(--muted);
    line-height: 1.55;
}

.language-tile-group {
    margin: 0;
    padding: 0;
    border: 0;
}

.language-tile-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.language-tile {
    display: flex;
    min-height: 104px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 12px 8px;
    border: 1px solid var(--border);
    border-radius: 16px;
    color: var(--ink);
    background: white;
    font-weight: 800;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.language-tile:hover {
    border-color: rgba(37, 99, 235, 0.45);
    background: #f8fafc;
}

.language-tile.is-selected {
    border-color: var(--primary);
    background: var(--soft-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.language-tile:focus-visible,
.nav-button:focus-visible,
.auth-button:focus-visible,
.logout-button:focus-visible,
.dialog-close:focus-visible,
.change-language:focus-visible,
#actionBtn:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.48);
    outline-offset: 3px;
}

.language-flag {
    width: 48px;
    height: 32px;
    border-radius: 4px;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.12);
}

.language-tile span {
    font-size: 0.84rem;
    letter-spacing: 0.08em;
}

.auth-button {
    display: flex;
    width: 100%;
    min-height: 52px;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
    padding: 14px 20px;
    border-radius: 999px;
    color: white;
    background: var(--primary);
    font-weight: 800;
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.24);
}

.auth-button:hover:not(:disabled) {
    background: var(--primary-dark);
}

.google-button {
    color: var(--ink);
    border: 1px solid var(--border);
    background: white;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.google-button:hover:not(:disabled) {
    background: #f8fafc;
}

.google-g {
    display: grid;
    width: 24px;
    height: 24px;
    place-items: center;
    border-radius: 50%;
    color: #4285f4;
    background: white;
    font-size: 1.1rem;
    font-weight: 900;
}

.logout-button {
    display: block;
    margin: 14px auto 0;
    padding: 8px 16px;
    border-radius: 999px;
    color: var(--muted);
    background: transparent;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.logout-button:hover:not(:disabled) {
    color: var(--danger-dark);
}

.auth-status {
    min-height: 22px;
    margin: 14px 0 0;
    color: #166534;
    font-size: 0.93rem;
    font-weight: 700;
    line-height: 1.45;
}

.auth-status.has-error {
    color: var(--danger-dark);
}

.auth-note {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.5;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 900px) {
    .hero-card,
    .content-grid {
        grid-template-columns: 1fr;
    }

    .session-card {
        min-height: auto;
    }
}

@media (max-width: 560px) {
    .site-header {
        width: calc(100% - 24px);
        min-height: 68px;
        gap: 8px;
    }

    .brand-mark {
        gap: 6px;
        font-size: 0.76rem;
        letter-spacing: 0.08em;
    }

    .top-nav {
        gap: 4px;
    }

    .nav-button {
        min-height: 40px;
        padding: 9px 12px;
        font-size: 0.9rem;
    }

    .app-shell {
        width: min(100% - 20px, 1120px);
        padding: 14px 0 24px;
    }

    .hero-card {
        gap: 20px;
        padding: 20px;
        border-radius: 24px;
    }

    .auth-dialog {
        width: calc(100% - 20px);
        max-height: calc(100% - 20px);
        border-radius: 22px;
    }

    .auth-dialog-card {
        padding: 28px 20px 24px;
    }

    .dialog-close {
        top: 12px;
        right: 12px;
    }

    .auth-dialog-card h2 {
        padding-right: 20px;
    }
}
