/* ============================================================
   MORNING CIRCUIT - GAME STYLES
   ============================================================ */

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

:root {
    --cream: #FAF7F2;
    --warm-black: #1A1A18;
    --ink: #2C2C28;
    --sage: #7A8B6F;
    --sage-light: #E8EDE4;
    --gold: #C4A04D;
    --gold-light: #F5EDD8;
    --muted: #8A8A82;
    --border: #E5E2DC;
    --card-bg: #FFFFFF;
    --copper: #B07842;
    --copper-light: #F5E4D0;
    --rose: #8B5E5E;
    --rose-light: #EDE0E0;
    --error: #C45C5C;
    --error-light: #F5E0E0;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--cream);
    color: var(--ink);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* ---- NAV ---- */
.game-nav {
    padding: 20px 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 680px;
    margin: 0 auto;
}

.logo {
    font-family: 'DM Serif Display', serif;
    font-size: 20px;
    color: var(--warm-black);
    letter-spacing: -0.5px;
    text-decoration: none;
}

.logo-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    background: var(--gold);
    border-radius: 50%;
    margin-left: 2px;
    vertical-align: middle;
    position: relative;
    top: -2px;
}

.nav-actions {
    display: flex;
    gap: 8px;
}

.nav-btn {
    background: none;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.nav-btn:hover {
    border-color: var(--ink);
    background: var(--card-bg);
}

/* ---- GAME CONTAINER ---- */
.game-container {
    max-width: 580px;
    margin: 0 auto;
    padding: 16px 24px 48px;
}

/* ---- HEADER ---- */
.game-header {
    text-align: center;
    margin-bottom: 28px;
}

.puzzle-info {
    font-size: 14px;
    color: var(--muted);
    font-weight: 500;
    margin-bottom: 4px;
}

.puzzle-title {
    font-family: 'DM Serif Display', serif;
    font-size: 28px;
    color: var(--warm-black);
    letter-spacing: -0.5px;
}

.puzzle-instructions {
    font-size: 15px;
    color: var(--muted);
    margin-top: 8px;
}

/* ---- SOLVED GROUPS ---- */
.solved-groups {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
}

.solved-group {
    padding: 20px 24px;
    border-radius: 12px;
    text-align: center;
    animation: groupReveal 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.solved-group.difficulty-1 { background: var(--sage-light); }
.solved-group.difficulty-2 { background: var(--gold-light); }
.solved-group.difficulty-3 { background: var(--copper-light); }
.solved-group.difficulty-4 { background: var(--rose-light); }

.solved-category {
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.difficulty-1 .solved-category { color: var(--sage); }
.difficulty-2 .solved-category { color: var(--gold); }
.difficulty-3 .solved-category { color: var(--copper); }
.difficulty-4 .solved-category { color: var(--rose); }

.solved-words {
    font-size: 14px;
    font-weight: 500;
    color: var(--ink);
    opacity: 0.7;
}

/* ---- GRID ---- */
.word-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 24px;
}

.word-tile {
    aspect-ratio: 1.5;
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: 0.3px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
    -webkit-user-select: none;
    padding: 4px;
    text-align: center;
    line-height: 1.2;
}

.word-tile:hover {
    border-color: var(--ink);
    transform: scale(1.02);
}

.word-tile.selected {
    background: var(--warm-black);
    color: var(--cream);
    border-color: var(--warm-black);
    transform: scale(1.03);
}

.word-tile.selected:hover {
    background: var(--ink);
}

.word-tile.disabled {
    pointer-events: none;
    opacity: 0;
    transform: scale(0.8);
}

/* ---- MISTAKE TRACKER ---- */
.mistake-tracker {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 24px;
}

.mistake-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--muted);
}

.mistake-dots {
    display: flex;
    gap: 6px;
}

.mistake-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border);
    transition: all 0.3s;
}

.mistake-dot.used {
    background: var(--error);
    animation: dotPulse 0.3s;
}

/* ---- ACTION BUTTONS ---- */
.game-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.action-btn {
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    border: 2px solid var(--border);
    background: var(--card-bg);
    color: var(--ink);
    font-family: inherit;
}

.action-btn:hover {
    border-color: var(--ink);
}

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

.action-btn:disabled:hover {
    border-color: var(--border);
}

.action-btn.primary {
    background: var(--warm-black);
    color: var(--cream);
    border-color: var(--warm-black);
}

.action-btn.primary:hover {
    background: var(--ink);
}

.action-btn.primary:disabled {
    background: var(--border);
    border-color: var(--border);
    color: var(--muted);
}

/* ---- GAME OVER OVERLAY ---- */
.game-over-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(26, 26, 24, 0.5);
    backdrop-filter: blur(4px);
    z-index: 100;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s;
}

.game-over-overlay.visible {
    display: flex;
}

.game-over-card {
    background: var(--cream);
    border-radius: 20px;
    padding: 48px 40px;
    max-width: 420px;
    width: 90%;
    text-align: center;
    animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.game-over-emoji {
    font-size: 48px;
    margin-bottom: 16px;
}

.game-over-title {
    font-family: 'DM Serif Display', serif;
    font-size: 32px;
    color: var(--warm-black);
    margin-bottom: 8px;
}

.game-over-subtitle {
    font-size: 16px;
    color: var(--muted);
    margin-bottom: 32px;
}

/* ---- STATS GRID ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 28px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-family: 'DM Serif Display', serif;
    font-size: 28px;
    color: var(--warm-black);
}

.stat-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--muted);
}

/* ---- SHARE PREVIEW ---- */
.share-preview {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    font-family: monospace;
    font-size: 18px;
    line-height: 1.6;
    letter-spacing: 2px;
    text-align: center;
}

.share-preview-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0;
    color: var(--muted);
    margin-bottom: 8px;
}

/* ---- SHARE BUTTONS ---- */
.share-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.share-btn {
    width: 100%;
    padding: 16px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    border: none;
    font-family: inherit;
}

.share-btn.primary {
    background: var(--warm-black);
    color: var(--cream);
}

.share-btn.primary:hover {
    background: var(--ink);
}

.share-btn.secondary {
    background: var(--card-bg);
    color: var(--ink);
    border: 2px solid var(--border);
}

.share-btn.secondary:hover {
    border-color: var(--ink);
}

/* ---- TOAST ---- */
.toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--warm-black);
    color: var(--cream);
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    z-index: 200;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}

.toast.visible {
    transform: translateX(-50%) translateY(0);
}

/* ---- SHAKE ANIMATION ---- */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

.shake {
    animation: shake 0.5s;
}

/* ---- REVEAL ANIMATION ---- */
@keyframes groupReveal {
    0% { transform: scaleY(0); opacity: 0; }
    100% { transform: scaleY(1); opacity: 1; }
}

@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes slideUp {
    0% { transform: translateY(40px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

@keyframes dotPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

/* ---- CONFETTI ---- */
@keyframes confettiFall {
    0% { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

.confetti-piece {
    position: fixed;
    width: 10px;
    height: 10px;
    top: -10px;
    z-index: 300;
    border-radius: 2px;
    animation: confettiFall linear forwards;
    pointer-events: none;
}

/* ---- LOADING ---- */
.loading-state {
    text-align: center;
    padding: 80px 24px;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

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

.loading-text {
    font-size: 15px;
    color: var(--muted);
}

/* ---- RESPONSIVE ---- */
@media (max-width: 600px) {
    .game-nav { padding: 16px 16px; }
    .game-container { padding: 8px 12px 32px; }
    .word-tile { font-size: 12px; border-radius: 10px; }
    .word-grid { gap: 6px; }
    .solved-group { padding: 14px 16px; }
    .puzzle-title { font-size: 24px; }
    .game-actions { gap: 8px; }
    .action-btn { padding: 12px 20px; font-size: 14px; }
    .game-over-card { padding: 36px 28px; }
    .stats-grid { gap: 8px; }
    .stat-value { font-size: 24px; }
}

@media (max-width: 400px) {
    .word-tile { font-size: 11px; aspect-ratio: 1.3; }
}
