/* ============ RESET & BASE ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0f1119; --bg2: #1a1d2e; --bg3: #252940;
  --text: #e8e6f0; --text2: #9b99af; --gold: #f0c040;
  --accent1: #e67e22; --accent2: #3498db; --accent3: #9b59b6;
  --radius: 12px; --shadow: 0 8px 32px rgba(0,0,0,.4);
}
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; overflow-x: hidden; }
button { cursor: pointer; font-family: inherit; }
.screen { display: none; padding: 20px; max-width: 1200px; margin: 0 auto; }
.screen.active { display: block; }

/* ============ HEADER ============ */
.main-header { background: var(--bg2); border-bottom: 1px solid rgba(240,192,64,.15); padding: 12px 24px; position: sticky; top: 0; z-index: 100; backdrop-filter: blur(10px); }
.header-inner { max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.logo { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.logo-icon { font-size: 28px; filter: drop-shadow(0 0 8px rgba(240,192,64,.5)); }
.logo h1 { font-family: 'Cinzel', serif; font-size: 1.3rem; color: var(--gold); letter-spacing: 1px; }
.stats-bar { display: flex; gap: 16px; }
.stat { display: flex; align-items: center; gap: 6px; background: var(--bg3); padding: 6px 14px; border-radius: 20px; font-size: .85rem; font-weight: 600; }
.stat-icon { font-size: 1rem; }

/* ============ HOME ============ */
.hero { text-align: center; padding: 40px 20px 30px; }
.hero h2 { font-family: 'Cinzel', serif; font-size: 2rem; color: var(--gold); margin-bottom: 10px; }
.hero p { color: var(--text2); font-size: 1.05rem; }
.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; padding: 20px 0; }
.category-card { background: var(--bg2); border: 1px solid rgba(255,255,255,.06); border-radius: var(--radius); padding: 28px; cursor: pointer; transition: all .25s; position: relative; overflow: hidden; }
.category-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--accent, var(--gold)); }
.category-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--accent, var(--gold)); }
.card-icon { font-size: 2.5rem; margin-bottom: 12px; }
.category-card h3 { font-family: 'Cinzel', serif; font-size: 1.15rem; margin-bottom: 6px; color: var(--gold); }
.category-card p { color: var(--text2); font-size: .9rem; margin-bottom: 14px; }
.card-progress { height: 4px; background: var(--bg3); border-radius: 2px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--accent, var(--gold)); border-radius: 2px; width: 0%; transition: width .5s; }

.daily-verse { text-align: center; padding: 30px; margin-top: 20px; }
.daily-verse blockquote { font-style: italic; color: var(--text2); font-size: 1rem; max-width: 600px; margin: 0 auto; line-height: 1.6; border-left: 3px solid var(--gold); padding-left: 16px; text-align: left; }

/* ============ CATEGORY LIST ============ */
.screen-header { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.back-btn { background: var(--bg3); border: none; color: var(--text); padding: 8px 16px; border-radius: 8px; font-size: .9rem; transition: background .2s; }
.back-btn:hover { background: var(--bg2); }
.screen-header h2 { font-family: 'Cinzel', serif; color: var(--gold); font-size: 1.4rem; }
.puzzle-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.puzzle-item { background: var(--bg2); border: 1px solid rgba(255,255,255,.06); border-radius: var(--radius); padding: 20px; cursor: pointer; transition: all .2s; display: flex; flex-direction: column; gap: 8px; }
.puzzle-item:hover { border-color: var(--gold); transform: translateY(-2px); }
.puzzle-item.completed { border-color: rgba(46,204,113,.3); }
.puzzle-item .difficulty { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; padding: 3px 10px; border-radius: 10px; display: inline-block; width: fit-content; }
.difficulty.easy { background: rgba(46,204,113,.15); color: #2ecc71; }
.difficulty.medium { background: rgba(241,196,15,.15); color: #f1c40f; }
.difficulty.hard { background: rgba(231,76,60,.15); color: #e74c3c; }
.puzzle-item h4 { font-size: 1.05rem; }
.puzzle-item .desc { color: var(--text2); font-size: .85rem; line-height: 1.4; }
.puzzle-item .meta { display: flex; gap: 12px; font-size: .8rem; color: var(--text2); margin-top: auto; }
.completed-badge { color: #2ecc71; font-weight: 600; font-size: .8rem; }

/* ============ PUZZLE AREA ============ */
.puzzle-area { min-height: 400px; background: var(--bg2); border-radius: var(--radius); padding: 24px; position: relative; }
.puzzle-info { display: flex; gap: 12px; margin-left: auto; }
.timer, .score { background: var(--bg3); padding: 6px 14px; border-radius: 8px; font-weight: 600; font-size: .9rem; }
.puzzle-controls { display: flex; gap: 12px; margin-top: 16px; justify-content: center; flex-wrap: wrap; }

/* ============ BUTTONS ============ */
.btn { padding: 10px 24px; border-radius: 8px; font-weight: 600; font-size: .95rem; border: none; transition: all .2s; }
.btn-primary { background: linear-gradient(135deg, var(--gold), #e6a800); color: #1a1a2e; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(240,192,64,.3); }
.btn-secondary { background: var(--bg3); color: var(--text); }
.btn-secondary:hover { background: #333750; }
.btn-hint { background: rgba(155,89,182,.2); color: #bb8fce; }
.btn-check { background: rgba(46,204,113,.2); color: #2ecc71; }

/* ============ JIGSAW ============ */
.jigsaw-board { display: grid; gap: 2px; margin: 0 auto; max-width: 500px; aspect-ratio: 1; }
.jigsaw-piece { border-radius: 4px; cursor: grab; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; font-weight: 700; transition: all .2s; user-select: none; }
.jigsaw-piece.placed { opacity: .6; cursor: default; }
.jigsaw-piece.selected { outline: 3px solid var(--gold); transform: scale(1.05); z-index: 2; }
.jigsaw-piece.correct { background: rgba(46,204,113,.3) !important; }
.jigsaw-tray { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 16px; background: var(--bg3); border-radius: var(--radius); margin-top: 16px; min-height: 80px; }

/* ============ WORD SEARCH ============ */
.word-search-container { display: flex; gap: 24px; flex-wrap: wrap; justify-content: center; }
.ws-grid { display: grid; gap: 1px; background: var(--bg3); padding: 2px; border-radius: 8px; user-select: none; }
.ws-cell { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .95rem; background: var(--bg2); cursor: pointer; transition: all .15s; text-transform: uppercase; }
.ws-cell:hover { background: rgba(240,192,64,.15); }
.ws-cell.selected { background: rgba(52,152,219,.4); color: #fff; }
.ws-cell.found { background: rgba(46,204,113,.25); color: #2ecc71; }
.ws-word-list { display: flex; flex-direction: column; gap: 6px; min-width: 140px; }
.ws-word { padding: 6px 12px; background: var(--bg3); border-radius: 6px; font-weight: 500; font-size: .9rem; text-transform: uppercase; letter-spacing: 1px; }
.ws-word.found { text-decoration: line-through; color: #2ecc71; opacity: .6; }

/* ============ CROSSWORD ============ */
.crossword-container { display: flex; gap: 24px; flex-wrap: wrap; justify-content: center; }
.cw-grid { display: grid; gap: 1px; }
.cw-cell { width: 38px; height: 38px; position: relative; }
.cw-cell input { width: 100%; height: 100%; border: 1px solid rgba(255,255,255,.1); background: var(--bg3); color: var(--text); text-align: center; font-weight: 700; font-size: 1rem; text-transform: uppercase; border-radius: 0; }
.cw-cell input:focus { outline: 2px solid var(--gold); z-index: 1; background: rgba(240,192,64,.1); }
.cw-cell .cw-num { position: absolute; top: 1px; left: 3px; font-size: .55rem; color: var(--text2); pointer-events: none; z-index: 2; }
.cw-cell.black { background: var(--bg); }
.cw-cell.black input { display: none; }
.cw-clues { max-width: 300px; }
.cw-clues h4 { color: var(--gold); margin: 12px 0 6px; font-size: .95rem; }
.cw-clue { font-size: .85rem; color: var(--text2); padding: 4px 0; cursor: pointer; }
.cw-clue:hover { color: var(--text); }

/* ============ LOGIC ============ */
.logic-container { max-width: 700px; margin: 0 auto; }
.logic-scenario { background: var(--bg3); padding: 20px; border-radius: var(--radius); margin-bottom: 20px; line-height: 1.7; }
.logic-scenario h3 { color: var(--gold); margin-bottom: 10px; }
.logic-clues { list-style: none; padding: 0; }
.logic-clues li { padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.05); font-size: .95rem; }
.logic-clues li::before { content: '🔑 '; }
.logic-grid { display: grid; gap: 1px; margin: 20px auto; width: fit-content; }
.logic-grid-cell { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all .15s; font-size: 1.2rem; }
.logic-grid-cell.header { font-size: .7rem; font-weight: 600; color: var(--gold); cursor: default; background: var(--bg3); width: 80px; }
.logic-grid-cell.row-header { background: var(--bg3); width: 80px; font-size: .7rem; font-weight: 600; color: var(--text2); cursor: default; }
.logic-grid-cell.interactive { background: var(--bg2); border: 1px solid rgba(255,255,255,.08); }
.logic-grid-cell.interactive:hover { background: rgba(240,192,64,.1); }

/* ============ PATTERN ============ */
.pattern-container { max-width: 600px; margin: 0 auto; text-align: center; }
.pattern-sequence { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 24px 0; }
.pattern-item { width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; background: var(--bg3); border-radius: var(--radius); font-size: 1.5rem; font-weight: 700; }
.pattern-item.mystery { background: rgba(240,192,64,.15); border: 2px dashed var(--gold); color: var(--gold); font-size: 1.8rem; }
.pattern-options { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 20px 0; }
.pattern-option { width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; background: var(--bg3); border: 2px solid transparent; border-radius: var(--radius); font-size: 1.5rem; font-weight: 700; cursor: pointer; transition: all .2s; }
.pattern-option:hover { border-color: var(--gold); transform: scale(1.08); }
.pattern-option.selected { border-color: var(--gold); background: rgba(240,192,64,.15); }
.pattern-prompt { font-size: 1.1rem; color: var(--text2); margin-bottom: 16px; }

/* ============ PROBLEM SOLVING ============ */
.problem-container { max-width: 700px; margin: 0 auto; }
.problem-story { background: var(--bg3); padding: 24px; border-radius: var(--radius); line-height: 1.7; margin-bottom: 20px; }
.problem-story h3 { color: var(--gold); margin-bottom: 10px; font-family: 'Cinzel', serif; }
.problem-choices { display: flex; flex-direction: column; gap: 10px; }
.problem-choice { background: var(--bg3); padding: 14px 20px; border-radius: 8px; cursor: pointer; border: 2px solid transparent; transition: all .2s; text-align: left; color: var(--text); font-size: .95rem; }
.problem-choice:hover { border-color: var(--gold); background: rgba(240,192,64,.05); }
.problem-choice.correct { border-color: #2ecc71; background: rgba(46,204,113,.1); }
.problem-choice.wrong { border-color: #e74c3c; background: rgba(231,76,60,.1); }
.problem-explanation { background: rgba(240,192,64,.08); padding: 16px; border-radius: 8px; margin-top: 16px; border-left: 3px solid var(--gold); display: none; }

/* ============ BRAIN TRAINING ============ */
.memory-grid { display: grid; gap: 8px; max-width: 400px; margin: 0 auto; }
.memory-card { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; background: var(--bg3); border-radius: 8px; cursor: pointer; font-size: 2rem; transition: all .3s; border: 2px solid transparent; }
.memory-card.flipped { background: rgba(240,192,64,.1); border-color: var(--gold); }
.memory-card.matched { background: rgba(46,204,113,.15); border-color: #2ecc71; cursor: default; }
.memory-card .card-back { font-size: 1.5rem; }

.speed-verse { font-size: 1.2rem; line-height: 1.8; max-width: 600px; margin: 0 auto; }
.speed-verse .word { display: inline-block; padding: 2px 4px; margin: 2px; border-radius: 4px; cursor: pointer; transition: all .15s; }
.speed-verse .word:hover { background: rgba(240,192,64,.15); }
.speed-verse .word.selected { background: rgba(52,152,219,.3); }
.speed-verse .word.correct { background: rgba(46,204,113,.3); }
.speed-verse .word.wrong { background: rgba(231,76,60,.3); }

/* ============ MODAL ============ */
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 200; align-items: center; justify-content: center; padding: 20px; }
.modal.active { display: flex; }
.modal-content { background: var(--bg2); border: 1px solid rgba(240,192,64,.2); border-radius: 16px; padding: 40px; text-align: center; max-width: 480px; width: 100%; }
.modal-icon { font-size: 3rem; margin-bottom: 12px; }
.modal-content h2 { font-family: 'Cinzel', serif; color: var(--gold); margin-bottom: 20px; }
.modal-stats { display: flex; justify-content: center; gap: 24px; margin-bottom: 20px; }
.modal-stat { display: flex; flex-direction: column; gap: 4px; }
.modal-stat .label { font-size: .75rem; color: var(--text2); text-transform: uppercase; letter-spacing: 1px; }
.modal-stat .value { font-size: 1.4rem; font-weight: 700; color: var(--gold); }
.scripture-reveal { background: rgba(240,192,64,.08); padding: 16px; border-radius: 8px; margin-bottom: 20px; font-style: italic; color: var(--text2); line-height: 1.6; border-left: 3px solid var(--gold); text-align: left; }
.modal-actions { display: flex; gap: 12px; justify-content: center; }

/* ============ ANIMATIONS ============ */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.puzzle-item, .category-card { animation: fadeIn .4s ease both; }
.category-card:nth-child(2) { animation-delay: .05s; }
.category-card:nth-child(3) { animation-delay: .1s; }
.category-card:nth-child(4) { animation-delay: .15s; }
.category-card:nth-child(5) { animation-delay: .2s; }
.category-card:nth-child(6) { animation-delay: .25s; }

@keyframes popIn { from { transform: scale(.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal.active .modal-content { animation: popIn .3s ease; }

/* ============ RESPONSIVE ============ */
@media (max-width: 600px) {
  .hero h2 { font-size: 1.4rem; }
  .category-grid { grid-template-columns: 1fr; }
  .ws-cell { width: 28px; height: 28px; font-size: .8rem; }
  .cw-cell { width: 30px; height: 30px; }
  .stats-bar { gap: 8px; }
  .stat { padding: 4px 10px; font-size: .75rem; }
}
