:root {
    --bg: #1a0f07;
    --surface: #2c1810;
    --surface-light: #3d1f0e;
    --gold: #c9a84c;
    --gold-light: #e8c96a;
    --cream: #f5e6d3;
    --red: #8b1a1a;
    --text: #f5e6d3;
    --text-muted: #a08060;
    --radius: 8px;
    --shadow: 0 4px 20px rgba(0,0,0,0.5);
}

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

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: Georgia, serif;
    font-size: 16px;
    line-height: 1.5;
}

#app {
    max-width: 480px;
    margin: 0 auto;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.view {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.view.active {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#view-loading {
    background: var(--bg);
    justify-content: center;
    align-items: center;
}

.logo-text {
    font-size: 2rem;
    color: var(--gold);
    letter-spacing: 4px;
    animation: flicker 2s infinite;
}

@keyframes flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
    75% { opacity: 0.9; }
    90% { opacity: 0.6; }
}

.card {
    background: var(--surface);
    border: 1px solid var(--gold);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
}

.btn {
    background: linear-gradient(135deg, var(--gold), #a07830);
    color: #1a0f07;
    font-weight: 700;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1rem;
    width: 100%;
    font-family: Georgia, serif;
    transition: filter 0.2s;
}

.btn:hover, .btn:focus {
    filter: brightness(1.15);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.btn-danger {
    background: var(--red);
    color: var(--cream);
    border: none;
}

.btn-sm {
    padding: 8px 14px;
    font-size: 0.875rem;
    width: auto;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

label {
    color: var(--gold);
    font-size: 0.875rem;
}

input[type=text], input[type=email], input[type=password] {
    background: var(--surface-light);
    border: 1px solid #5a3010;
    border-radius: var(--radius);
    color: var(--cream);
    padding: 12px;
    font-size: 1rem;
    width: 100%;
    font-family: Georgia, serif;
    outline: none;
}

input[type=text]:focus, input[type=email]:focus, input[type=password]:focus {
    border-color: var(--gold);
}

.error-msg {
    color: #ff6b6b;
    font-size: 0.85rem;
    display: none;
}

.error-msg.visible {
    display: block;
}

.success-msg {
    color: #6bff8a;
    font-size: 0.85rem;
    display: none;
}

.success-msg.visible {
    display: block;
}

.progress-bar {
    background: var(--surface-light);
    border-radius: 4px;
    height: 8px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold), var(--gold-light));
    transition: width 0.4s ease-in-out;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-easy { background: #1a4a1a; color: #6bff8a; }
.badge-medium { background: #4a3a00; color: var(--gold-light); }
.badge-hard { background: #4a1a00; color: #ff8b6b; }
.badge-deadly { background: #3a003a; color: #ff6bff; }

.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 480px;
    margin: 0 auto;
    background: var(--surface);
    border-top: 1px solid var(--gold);
    display: flex;
    padding: 8px 0;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
}

.tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.7rem;
    border: none;
    background: transparent;
}

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

.tab-icon {
    font-size: 1.3rem;
}

.popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 16px;
}

.popup-overlay.visible {
    display: flex;
}

.popup-box {
    background: var(--surface);
    border: 1px solid var(--gold);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    max-width: 360px;
    width: 100%;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--gold);
    border-radius: 2px;
}
