:root {
    /* ===== Dark Theme (по умолчанию) ===== */
    --bg: #121212;
    --bg-secondary: #1a1a1a;
    --card: rgba(28, 28, 28, 0.88);
    --card-solid: #1e1e1e;
    --primary: #eab308;
    --primary-soft: rgba(234, 179, 8, 0.14);
    --primary-hover: #fbbf24;
    --accent: #eab308;
    --text: #f4f4f5;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --border: rgba(255, 255, 255, 0.07);
    --border-hover: rgba(255, 255, 255, 0.13);
    --radius: 18px;
    --radius-sm: 12px;
    
    --button-text: #121212;
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
    --message-sent-bg: #eab308;
    --message-sent-text: #121212;
}

[data-theme="light"] {
    /* ===== Light Theme ===== */
    --bg: #f8f7f4;
    --bg-secondary: #f0eeea;
    --card: rgba(255, 255, 255, 0.9);
    --card-solid: #ffffff;
    --primary: #ca8a04;
    --primary-soft: rgba(202, 138, 4, 0.12);
    --primary-hover: #eab308;
    --accent: #ca8a04;
    --text: #1c1917;
    --text-secondary: #57534e;
    --text-muted: #78716c;
    --border: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(0, 0, 0, 0.14);
    
    --button-text: #ffffff;
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.08);
    --message-sent-bg: #ca8a04;
    --message-sent-text: #ffffff;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(234, 179, 8, 0.07), transparent),
        radial-gradient(ellipse 60% 40% at 100% 100%, rgba(234, 179, 8, 0.04), transparent);
    padding: 16px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

[data-theme="light"] body {
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(202, 138, 4, 0.06), transparent),
        radial-gradient(ellipse 60% 40% at 100% 100%, rgba(202, 138, 4, 0.03), transparent);
}

.container {
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 28px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 14px;
}

.logo-icon {
    font-size: 1.8rem;
    filter: drop-shadow(0 0 12px rgba(234, 179, 8, 0.3));
}

header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--text) 30%, var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stats {
    display: inline-flex;
    gap: 18px;
    background: rgba(128, 128, 128, 0.08);
    border: 1px solid var(--border);
    padding: 7px 18px;
    border-radius: 100px;
    font-size: 0.82rem;
    color: var(--text-muted);
    backdrop-filter: blur(8px);
}

#stats-demo-label {
    color: var(--primary);
    font-size: 0.58rem;
    letter-spacing: 0.04em;
}

.stats span {
    color: var(--primary);
    font-weight: 600;
}

.lobby {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.site-footer {
    text-align: center;
    margin-top: 14px;
    font-size: 0.72rem;
}

.suggest-entry-link {
    display: block;
    margin: 0 auto 12px;
    color: var(--text-muted);
    font-size: 0.78rem;
    text-align: center;
    text-decoration: none;
    transition: color 0.2s ease;
}

.suggest-entry-link:hover {
    color: var(--primary);
}

.chat-background {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.26;
    background-image: url('/static/backgrounds/conversation-tile.svg?v=3');
    background-repeat: repeat;
    background-size: 360px 288px;
    transform: rotate(3deg) scale(1.12);
}

[data-theme="light"] .chat-background {
    opacity: 0.4;
}

[data-theme="light"] .chat-container {
    background: rgba(255, 255, 255, 0.66);
}

html:not([data-theme="light"]) .chat-container {
    background: rgba(28, 28, 28, 0.72);
}

.welcome-page {
    --bg: #f8f7f4;
    --bg-secondary: #f0eeea;
    --card: rgba(255, 255, 255, 0.9);
    --card-solid: #ffffff;
    --primary: #ca8a04;
    --primary-soft: rgba(202, 138, 4, 0.12);
    --primary-hover: #eab308;
    --accent: #ca8a04;
    --text: #1c1917;
    --text-secondary: #57534e;
    --text-muted: #78716c;
    --border: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(0, 0, 0, 0.14);
    --button-text: #ffffff;
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.08);
    --message-sent-bg: #ca8a04;
    --message-sent-text: #ffffff;
    background-color: var(--bg);
    color: var(--text);
    background-image: radial-gradient(ellipse 70% 60% at 15% 0%, rgba(202, 138, 4, 0.09), transparent), radial-gradient(ellipse 65% 55% at 100% 100%, rgba(202, 138, 4, 0.045), transparent);
}

.welcome-shell {
    width: min(100%, 720px);
}

.welcome-brand {
    margin: 0 0 26px 4px;
    color: var(--text);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.2px;
}

.welcome-mark {
    display: inline-grid;
    width: 28px;
    height: 28px;
    margin-right: 7px;
    place-items: center;
    color: var(--button-text);
    background: var(--primary);
    border-radius: 9px;
    font-size: 0.9rem;
}

.welcome-card {
    padding: clamp(28px, 7vw, 62px);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 26px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(20px);
}

.welcome-eyebrow {
    margin-bottom: 18px;
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 1.4px;
    text-transform: uppercase;
}

.welcome-card h1 {
    max-width: 600px;
    margin-bottom: 18px;
    font-size: clamp(2rem, 5vw, 3.7rem);
    line-height: 1.05;
    letter-spacing: -1.5px;
}

.welcome-lead {
    max-width: 580px;
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.65;
}

.welcome-points {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 34px 0;
}

.welcome-points div {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px;
    background: rgba(128, 128, 128, 0.07);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.welcome-points strong {
    color: var(--primary);
    font-size: 0.72rem;
}

.welcome-points span {
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.35;
}

.welcome-button {
    text-decoration: none;
}

.welcome-button span {
    font-size: 1.3rem;
    line-height: 1;
}

.welcome-footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin: 16px 4px 0;
    color: var(--text-muted);
    font-size: 0.72rem;
}

.welcome-footer a {
    color: inherit;
}

.site-footer a {
    color: var(--text-muted);
    opacity: 0.62;
    text-decoration: none;
    transition: opacity 0.2s ease, color 0.2s ease;
}

.site-footer a:hover {
    color: var(--primary);
    opacity: 1;
}

.container:has(.chat-container.active) .site-footer {
    display: none;
}

.settings-panel {
    background: var(--card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.setting-group {
    margin-bottom: 22px;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-label {
    display: block;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

.gender-toggle {
    display: flex;
    background: rgba(128, 128, 128, 0.12);
    border-radius: 12px;
    padding: 4px;
    border: 1px solid var(--border);
}

.toggle-option {
    flex: 1;
    padding: 11px 4px;
    text-align: center;
    cursor: pointer;
    border-radius: 9px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    font-size: 0.88rem;
    color: var(--text-secondary);
    user-select: none;
}

.toggle-option:hover:not(.active) {
    color: var(--text);
    background: rgba(128, 128, 128, 0.1);
}

.toggle-option.active {
    background: var(--primary);
    color: var(--button-text);
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(234, 179, 8, 0.25);
}

.theme-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.theme-option {
    padding: 14px 16px;
    background: rgba(128, 128, 128, 0.06);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 14px;
}

.theme-option:hover {
    background: rgba(128, 128, 128, 0.1);
    border-color: var(--border-hover);
}

.theme-option.active {
    border-color: rgba(234, 179, 8, 0.45);
    background: var(--primary-soft);
}

.theme-emoji {
    font-size: 1.4rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(128, 128, 128, 0.1);
    border-radius: 10px;
}

.theme-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
}

.theme-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 1px;
}

.start-button {
    width: 100%;
    padding: 17px 24px;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--button-text);
    background: var(--primary);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 8px 24px rgba(234, 179, 8, 0.22);
}

.start-button:hover {
    transform: translateY(-2px);
    background: var(--primary-hover);
    box-shadow: 0 12px 28px rgba(234, 179, 8, 0.3);
}

.start-button:active {
    transform: translateY(0);
}

/* ===== Chat ===== */

.chat-container {
    display: none;
    flex-direction: column;
    height: min(80vh, 720px);
    background: var(--card);
    backdrop-filter: blur(20px);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    position: relative;
}

.chat-container.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.chat-container.loading .loading-overlay {
    display: flex;
}

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

.chat-header {
    padding: 14px 18px;
    background: rgba(128, 128, 128, 0.08);
    display: flex;
    justify-content: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.chat-status {
    font-weight: 600;
    font-size: 0.9rem;
}

.chat-status.connected {
    color: var(--primary);
}

.chat-status.searching {
    color: #d97706;
}

.next-button,
.back-button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: transparent;
    border: 1px solid rgba(234, 179, 8, 0.4);
    color: var(--primary);
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.report-button {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    color: #fecaca;
    background: #991b1b;
    border: 1px solid #dc2626;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.report-button span {
    font-size: 1rem;
    line-height: 1;
}

.report-button:hover {
    background: #b91c1c;
    border-color: #ef4444;
}

.report-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.report-button:disabled:hover {
    background: #991b1b;
    border-color: #dc2626;
}

.back-button {
    margin-right: 8px;
}

.next-button:hover,
.back-button:hover {
    background: var(--primary-soft);
    border-color: var(--primary);
}

.loading-overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 0;
}

[data-theme="light"] .loading-overlay {
    background: rgba(255, 255, 255, 0.7);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--primary);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(128, 128, 128, 0.2) transparent;
}

.messages-container::-webkit-scrollbar {
    width: 5px;
}

.messages-container::-webkit-scrollbar-thumb {
    background: rgba(128, 128, 128, 0.25);
    border-radius: 10px;
}

.message {
    max-width: 78%;
    padding: 11px 15px;
    border-radius: 18px;
    line-height: 1.45;
    font-size: 0.94rem;
    word-wrap: break-word;
    animation: messageIn 0.25s ease;
}

@keyframes messageIn {
    from { opacity: 0; transform: translateY(6px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.message.received {
    align-self: flex-start;
    background: rgba(128, 128, 128, 0.12);
    border-bottom-left-radius: 5px;
    color: var(--text);
}

.message.sent {
    align-self: flex-end;
    background: var(--message-sent-bg);
    color: var(--message-sent-text);
    border-bottom-right-radius: 5px;
    box-shadow: 0 4px 12px rgba(234, 179, 8, 0.2);
    font-weight: 500;
}

.message.system {
    align-self: center;
    background: rgba(128, 128, 128, 0.08);
    color: var(--text-muted);
    font-size: 0.78rem;
    padding: 6px 12px;
    border-radius: 100px;
}

.typing-wrapper {
    flex-shrink: 0;
    padding: 6px 18px 4px;
    min-height: 28px;
    display: flex;
    align-items: center;
}

.typing-indicator {
    display: none;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-style: italic;
}

.typing-indicator.visible {
    display: flex;
}

.input-container {
    flex-shrink: 0;
    padding: 14px 16px;
    background: rgba(128, 128, 128, 0.06);
    display: flex;
    gap: 10px;
    border-top: 1px solid var(--border);
}

.message-input {
    flex: 1;
    padding: 13px 18px;
    background: rgba(128, 128, 128, 0.08);
    border: 1px solid var(--border);
    border-radius: 100px;
    color: var(--text);
    outline: none;
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
}

.message-input::placeholder {
    color: var(--text-muted);
}

.message-input:focus {
    border-color: rgba(234, 179, 8, 0.45);
}

.chat-container.loading .messages-container,
.chat-container.loading .input-container,
.chat-container.loading .typing-wrapper {
    display: none;
}

.send-button {
    width: 48px;
    height: 48px;
    background: var(--primary);
    border: none;
    border-radius: 50%;
    color: var(--button-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(234, 179, 8, 0.25);
}

.send-button:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.send-button:disabled,
.message-input:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ===== Room rules disclaimer ===== */
.disclaimer-overlay {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(5px);
}

.disclaimer-content {
    position: relative;
    width: min(100%, 560px);
    max-height: min(88dvh, 720px);
    overflow-y: auto;
    padding: 28px;
    color: var(--text);
    background: var(--card-solid);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.disclaimer-content h2 {
    padding-right: 28px;
    margin-bottom: 18px;
    font-size: 1.25rem;
}

.disclaimer-text {
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.55;
}

.disclaimer-text p {
    margin-bottom: 12px;
}

.disclaimer-text ul {
    padding-left: 20px;
    margin-bottom: 0;
}

.disclaimer-text li {
    margin-bottom: 7px;
}

.disclaimer-close {
    position: absolute;
    top: 12px;
    right: 15px;
    padding: 2px 7px;
    color: var(--text-muted);
    background: transparent;
    border: 0;
    font-size: 1.7rem;
    line-height: 1;
    cursor: pointer;
}

.disclaimer-close:hover {
    color: var(--text);
}

.rules-link {
    margin: 18px 0;
    font-size: 0.82rem;
}

.rules-link a {
    color: var(--primary);
}

.disclaimer-actions {
    display: flex;
    gap: 10px;
}

.disclaimer-actions .start-button {
    padding: 13px 16px;
    font-size: 0.9rem;
}

.disclaimer-reject {
    flex: 0 0 auto;
    padding: 12px 16px;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.disclaimer-error {
    min-height: 1.2em;
    margin-top: 10px;
    color: #ef4444;
    font-size: 0.8rem;
}

.report-dialog h2 {
    margin-bottom: 14px;
}

.report-question {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.report-confirm-button {
    flex: 1;
    padding: 12px 16px;
    color: #fff;
    background: #b91c1c;
    border: 1px solid #dc2626;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
}

.report-confirm-button:hover {
    background: #dc2626;
}

.report-reasons {
    display: grid;
    gap: 8px;
}

.report-reasons button {
    width: 100%;
    padding: 12px 14px;
    color: var(--text);
    background: rgba(128, 128, 128, 0.1);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    text-align: left;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.report-reasons button:hover {
    background: var(--primary-soft);
    border-color: var(--primary);
}

.custom-report-form {
    margin-top: 14px;
}

.custom-report-form label {
    display: block;
    margin-bottom: 7px;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.custom-report-form textarea {
    display: block;
    width: 100%;
    min-height: 90px;
    margin-bottom: 9px;
    padding: 10px 12px;
    color: var(--text);
    background: rgba(128, 128, 128, 0.1);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 0.85rem;
    outline: none;
    resize: vertical;
}

.custom-report-form textarea:focus {
    border-color: var(--primary);
}

@media (max-width: 480px) {
    body {
        padding: 0;
        align-items: flex-start;
        overflow-x: hidden;
    }

    .container {
        max-width: 100%;
        min-height: 100dvh;
        padding: max(8px, env(safe-area-inset-top)) 10px max(8px, env(safe-area-inset-bottom));
    }

    body:has(.chat-container.active) {
        height: 100dvh;
        min-height: 100dvh;
        overflow: hidden;
        align-items: stretch;
    }

    .container:has(.chat-container.active) {
        height: 100dvh;
        min-height: 100dvh;
        padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
    }

    .container:has(.chat-container.active) header {
        display: none;
    }

    header {
        margin-bottom: 12px;
    }

    header h1 {
        font-size: 1.4rem;
    }

    .stats {
        gap: 12px;
        padding: 6px 13px;
        font-size: 0.74rem;
    }

    .settings-panel {
        padding: 16px;
        border-radius: 14px;
    }

    .setting-group {
        margin-bottom: 14px;
    }

    .setting-label {
        margin-bottom: 6px;
        font-size: 0.65rem;
    }

    .toggle-option {
        padding: 8px 3px;
        font-size: 0.78rem;
    }

    .theme-selector {
        gap: 5px;
    }

    .theme-option {
        padding: 10px 12px;
        gap: 10px;
        font-size: 0.88rem;
    }

    .start-button {
        padding: 13px 18px;
        font-size: 0.95rem;
    }

    .lobby {
        gap: 10px;
        margin-top: 12px;
    }

    .site-footer {
        margin-top: 8px;
    }

    .chat-container {
        margin-top: 12px;
        height: calc(100dvh - 104px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        max-height: calc(100dvh - 104px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        min-height: 0;
        border-radius: 18px;
    }

    .container:has(.chat-container.active) .chat-container {
        margin-top: 0;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .chat-header {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto auto;
        padding: 8px;
        gap: 5px;
        align-items: center;
    }

    .chat-status {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 0.76rem;
        text-align: left;
    }

    .next-button,
    .back-button,
    .report-button {
        justify-content: center;
        padding: 7px 8px;
        font-size: 0.68rem;
        white-space: nowrap;
    }

    .report-button {
        gap: 3px;
    }

    .back-button {
        margin-right: 2px;
    }

    .loading-note {
        color: var(--primary);
        margin-top: 12px;
        font-size: 1rem;
        text-align: center;
    }

    .messages-container {
        min-height: 0;
        padding: 14px 10px;
    }

    .message {
        max-width: 88%;
        padding: 9px 12px;
        font-size: 0.88rem;
    }

    .input-container {
        padding: 9px 10px max(9px, env(safe-area-inset-bottom));
        gap: 7px;
    }

    .message-input {
        min-width: 0;
        padding: 11px 14px;
        font-size: 0.88rem;
    }

    .send-button {
        width: 42px;
        height: 42px;
    }

    .disclaimer-content {
        width: 100%;
        max-height: calc(100dvh - max(24px, env(safe-area-inset-top)) - max(24px, env(safe-area-inset-bottom)));
        padding: 17px 14px 14px;
        border-radius: 14px;
    }

    .disclaimer-content h2 {
        margin-bottom: 10px;
        font-size: 1.05rem;
    }

    .disclaimer-text {
        font-size: 0.78rem;
        line-height: 1.4;
    }

    .disclaimer-text p {
        margin-bottom: 8px;
    }

    .disclaimer-text ul {
        padding-left: 17px;
    }

    .disclaimer-text li {
        margin-bottom: 4px;
    }

    .disclaimer-close {
        top: 8px;
        right: 9px;
        font-size: 1.45rem;
    }

    .rules-link {
        margin: 11px 0;
        font-size: 0.75rem;
    }

    .disclaimer-actions {
        flex-direction: column-reverse;
        gap: 7px;
    }

    .disclaimer-reject,
    .disclaimer-actions .start-button {
        width: 100%;
        min-height: 40px;
        padding: 9px 12px;
        font-size: 0.82rem;
    }

    .disclaimer-error {
        margin-top: 7px;
        font-size: 0.72rem;
    }

    .report-dialog {
        max-width: 100%;
    }

    .report-question {
        font-size: 0.8rem;
    }

    .report-confirm-button,
    .report-reasons button {
        font-size: 0.82rem;
    }
}

@media (max-width: 560px) {
    .welcome-page {
        align-items: flex-start;
        padding: 28px 14px;
    }

    .welcome-brand {
        margin-bottom: 20px;
    }

    .welcome-card {
        border-radius: 20px;
        padding: 28px 22px;
    }

    .welcome-card h1 {
        font-size: 2.15rem;
    }

    .welcome-points {
        grid-template-columns: 1fr;
        gap: 8px;
        margin: 26px 0;
    }

    .welcome-points div {
        flex-direction: row;
        align-items: center;
        gap: 12px;
        padding: 11px 13px;
    }

    .welcome-footer {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}

/* ===== Full rules page ===== */
.rules-page {
    display: block;
    min-height: 100vh;
    padding: 32px 18px;
    background: var(--bg);
}

.rules-shell {
    width: min(100%, 900px);
    margin: 0 auto;
}

.rules-back {
    display: inline-flex;
    margin-bottom: 14px;
    color: var(--text-muted);
    font-size: 0.84rem;
    text-decoration: none;
    transition: color 0.2s ease;
}

.rules-back:hover {
    color: var(--primary);
}

.rules-card {
    overflow: hidden;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(20px);
}

.rules-hero {
    padding: 42px 52px 36px;
    background:
        radial-gradient(circle at 90% 10%, rgba(234, 179, 8, 0.2), transparent 32%),
        linear-gradient(135deg, rgba(234, 179, 8, 0.12), transparent 55%);
    border-bottom: 1px solid var(--border);
}

.rules-eyebrow {
    margin-bottom: 10px;
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 1.8px;
    text-transform: uppercase;
}

.rules-hero h1 {
    margin-bottom: 10px;
    color: var(--text);
    font-size: clamp(2rem, 5vw, 3.1rem);
    line-height: 1.05;
    letter-spacing: -1px;
}

.rules-hero p:last-child {
    max-width: 560px;
    color: var(--text-secondary);
    font-size: 0.94rem;
}

.rules-body {
    padding: 16px 52px 48px;
}

.rules-section {
    padding: 30px 0;
    border-bottom: 1px solid var(--border);
}

.rules-section h2,
.rules-confirmation h2 {
    margin-bottom: 16px;
    color: var(--text);
    font-size: 1.22rem;
    line-height: 1.3;
}

.rules-section h3 {
    margin: 20px 0 9px;
    color: var(--primary);
    font-size: 0.94rem;
    line-height: 1.4;
}

.rules-section p,
.rules-section li,
.rules-confirmation li,
.rules-confirmation p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.65;
}

.rules-section p {
    margin-bottom: 11px;
}

.rules-section p:last-child {
    margin-bottom: 0;
}

.rules-section strong,
.rules-confirmation strong {
    color: var(--text);
}

.rules-section ul,
.rules-confirmation ul {
    padding-left: 22px;
    margin: 8px 0 0;
}

.rules-section li,
.rules-confirmation li {
    margin-bottom: 7px;
}

.rules-confirmation {
    margin-top: 30px;
    padding: 24px 26px;
    background: var(--primary-soft);
    border: 1px solid rgba(234, 179, 8, 0.3);
    border-radius: var(--radius-sm);
}

.rules-confirmation h2 {
    font-size: 1.05rem;
}

.rules-confirmation p {
    margin-top: 18px;
}

.rules-back-bottom {
    margin: 16px 0 0 4px;
}

[data-theme="light"] .rules-page {
    background: var(--bg);
}

@media (max-width: 600px) {
    .rules-page {
        padding: 16px 10px 24px;
    }

    .rules-card {
        border-radius: 16px;
    }

    .rules-hero {
        padding: 28px 20px 24px;
    }

    .rules-body {
        padding: 4px 20px 28px;
    }

    .rules-section {
        padding: 22px 0;
    }

    .rules-section h2,
    .rules-confirmation h2 {
        font-size: 1.06rem;
    }

    .rules-section p,
    .rules-section li,
    .rules-confirmation li,
    .rules-confirmation p {
        font-size: 0.84rem;
        line-height: 1.55;
    }

    .rules-confirmation {
        padding: 18px;
    }
}
