@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=DM+Sans:wght@400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  color-scheme: dark;
  --bg: #10131b;
  --panel: #191d28;
  --panel-light: #202532;
  --line: #2b3040;
  --muted: #9298aa;
  --text: #f4f4f6;
  --lime: #c7f36b;
  --purple: #a78bfa;
  --pink: #ff8fba;
  --blue: #83baff;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  background-image: radial-gradient(ellipse at 76% 8%, rgba(91, 80, 150, .15), transparent 32%), radial-gradient(rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: auto, 24px 24px;
}
button, input { font: inherit; }
button { color: inherit; }
.app-shell { width: min(1120px, calc(100% - 48px)); margin: 0 auto; }
.topbar { height: 82px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand { display: flex; gap: 10px; align-items: center; color: var(--text); text-decoration: none; font: 700 20px 'Space Grotesk', sans-serif; letter-spacing: -.8px; }
.brand-light { color: #aeb4c4; font-weight: 400; }
.brand-logo { width: 36px; height: 36px; object-fit: contain; border-radius: 9px; }
.topbar-note, .eyebrow, .game-count { font: 500 10px 'DM Mono', monospace; letter-spacing: 1.4px; }
.topbar-note { color: #9da3b5; display: flex; align-items: center; gap: 9px; }
.online-dot { width: 7px; height: 7px; background: var(--lime); border-radius: 50%; box-shadow: 0 0 12px #c7f36b99; }
.hero { min-height: 342px; display: flex; align-items: center; justify-content: space-between; position: relative; overflow: hidden; }
.hero-copy { max-width: 610px; position: relative; z-index: 1; padding: 38px 0 44px; }
.eyebrow { color: var(--lime); margin: 0 0 16px; }
h1, h2, p { margin-top: 0; }
h1 { font: 600 clamp(36px, 5.2vw, 58px)/1.09 'Space Grotesk', sans-serif; letter-spacing: -2.8px; margin: 0; }
h1 span { color: var(--lime); }
.hero-description { color: #9da3b5; font-size: 15px; line-height: 1.65; max-width: 460px; margin: 20px 0 0; }
.hero-art { width: 300px; height: 260px; position: relative; margin-right: 34px; }
.art-card { width: 144px; height: 190px; border: 1px solid #ffffff22; border-radius: 20px; position: absolute; top: 34px; left: 78px; display: grid; place-items: center; font: 600 74px 'Space Grotesk', sans-serif; box-shadow: 0 25px 65px #0006; }
.art-card-back { transform: rotate(-15deg) translate(-24px, 10px); background: #26223d; color: var(--purple); }
.art-card-front { transform: rotate(11deg) translate(19px, -3px); background: linear-gradient(145deg, #283246, #202331); color: var(--lime); }
.art-spark { position: absolute; z-index: 2; color: var(--lime); }
.spark-one { font-size: 32px; top: 18px; left: 40px; }
.spark-two { font-size: 20px; right: 20px; bottom: 37px; color: var(--purple); }
.art-orbit { width: 240px; height: 240px; border: 1px dashed #ffffff1a; border-radius: 50%; position: absolute; top: 0; left: 25px; }
.game-section { padding: 27px 0 55px; border-top: 1px solid rgba(255,255,255,.08); }
.section-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 21px; }
.section-heading .eyebrow { margin-bottom: 8px; }
h2 { font: 600 24px 'Space Grotesk', sans-serif; letter-spacing: -.7px; margin-bottom: 0; }
.game-count { color: #73798b; padding-bottom: 4px; }
.game-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 13px; }
.game-card { min-height: 142px; padding: 22px; display: flex; align-items: center; gap: 17px; background: rgba(25,29,40,.86); border: 1px solid var(--line); border-radius: 15px; cursor: pointer; transition: transform .18s, border-color .18s, background .18s; }
.game-card:hover { transform: translateY(-3px); background: #1d2230; border-color: #51586c; }
.game-card:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }
.game-icon { flex: 0 0 58px; height: 58px; display: grid; place-items: center; border-radius: 15px; font: 500 27px 'Space Grotesk', sans-serif; }
.game-info { flex: 1; min-width: 0; }
.game-info h3 { font: 600 18px 'Space Grotesk', sans-serif; margin: 0 0 5px; }
.game-info p { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 0; }
.game-tag { display: inline-block; margin-top: 10px; font: 10px 'DM Mono', monospace; letter-spacing: .3px; color: #aab0c0; }
.play-button { flex: 0 0 38px; width: 38px; height: 38px; border-radius: 50%; border: 1px solid #ffffff24; background: transparent; color: var(--lime); cursor: pointer; font-size: 17px; transition: background .18s, color .18s; }
.play-button:hover { color: var(--bg); background: var(--lime); }
footer { padding: 19px 0 24px; text-align: center; color: #6f7585; font-size: 11px; border-top: 1px solid rgba(255,255,255,.08); }
footer span { color: var(--lime); padding-left: 4px; }
footer a { color: #aab0c0; text-decoration-color: #555d70; text-underline-offset: 3px; }
footer a:hover { color: var(--lime); }
.modal { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 20px; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(5,7,12,.78); backdrop-filter: blur(7px); }
.game-dialog { z-index: 1; position: relative; width: min(620px, 100%); max-height: min(90vh, 850px); overflow-y: auto; background: #171b25; border: 1px solid #343a4b; border-radius: 19px; box-shadow: 0 30px 100px #0009; padding: 25px; }
.dialog-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); padding-bottom: 17px; margin-bottom: 20px; }
.dialog-header .eyebrow { margin-bottom: 5px; font-size: 9px; }
.dialog-header h2 { font-size: 22px; }
.icon-button { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: #aab0c0; cursor: pointer; }
.icon-button:hover { color: white; border-color: #7b8297; }
.game-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 15px; color: #b9bfd0; font-size: 13px; }
.primary-button, .secondary-button { border: 0; border-radius: 9px; padding: 10px 15px; cursor: pointer; font-weight: 700; font-size: 12px; }
.primary-button { background: var(--lime); color: #151a10; }
.primary-button:hover { background: #d7ff88; }
.secondary-button { background: #292f3e; color: #d5d9e3; border: 1px solid #383f50; }
.secondary-button:hover { background: #343b4b; }
.status-text { color: var(--muted); font-size: 12px; min-height: 18px; }
.mine-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; width: min(100%, 390px); margin: 0 auto; }
.mine-cell { aspect-ratio: 1; padding: 0; background: #292f3e; border: 1px solid #353c4d; border-radius: 5px; cursor: pointer; font: 700 14px 'DM Mono', monospace; color: var(--blue); }
.mine-cell:hover:not(.revealed) { background: #384153; }
.mine-cell.revealed { background: #1d222e; border-color: #292f3b; cursor: default; }
.mine-cell.mine { color: var(--pink); }
.mine-cell.flag { color: var(--lime); }
.sudoku-grid { display: grid; grid-template-columns: repeat(9, 1fr); width: min(100%, 405px); margin: 0 auto 16px; border: 2px solid #737b90; }
.sudoku-cell { width: 100%; aspect-ratio: 1; text-align: center; padding: 0; min-width: 0; color: var(--lime); background: #202532; border: 1px solid #3b4150; font: 500 17px 'DM Mono', monospace; outline: none; }
.sudoku-cell:focus { background: #343c4d; box-shadow: inset 0 0 0 1px var(--lime); }
.sudoku-cell.given { color: #dfe2eb; background: #292f3d; }
.sudoku-cell:nth-child(3n) { border-right: 2px solid #737b90; }
.sudoku-cell:nth-child(n+19):nth-child(-n+27), .sudoku-cell:nth-child(n+46):nth-child(-n+54) { border-bottom: 2px solid #737b90; }
.word-board { display: grid; grid-template-rows: repeat(6, 1fr); gap: 6px; width: min(100%, 300px); margin: 3px auto 18px; }
.word-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.word-cell { aspect-ratio: 1; display: grid; place-items: center; border: 1px solid #3a4152; border-radius: 6px; font: 700 22px 'DM Mono', monospace; text-transform: uppercase; }
.word-cell.correct { background: #32854b; border-color: #32854b; }
.word-cell.present { background: #bd8a1e; border-color: #bd8a1e; }
.word-cell.absent { background: #343a49; border-color: #343a49; }
.word-legend { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 17px; margin: -7px 0 16px; color: #b9bfd0; font-size: 11px; }
.word-legend span { display: inline-flex; align-items: center; gap: 6px; }
.word-legend i { width: 12px; height: 12px; display: inline-block; border-radius: 3px; }
.word-legend i.correct { background: #32854b; }
.word-legend i.present { background: #bd8a1e; }
.word-form { display: flex; gap: 9px; width: min(100%, 360px); margin: auto; }
.word-form input { min-width: 0; flex: 1; border: 1px solid #414859; border-radius: 9px; background: #202532; color: white; padding: 10px 12px; text-transform: uppercase; letter-spacing: 3px; outline: none; }
.word-form input:focus { border-color: var(--lime); }
.arrow-game { text-align: center; }
.arrow-hud { display: flex; justify-content: center; gap: 28px; margin: 8px 0 15px; font: 12px 'DM Mono', monospace; color: #aeb4c4; }
.arrow-hud strong { color: var(--lime); font-size: 16px; margin-left: 5px; }
.arrow-board { width: min(100%, 310px); aspect-ratio: 1; margin: auto; display: grid; grid-template-columns: repeat(5, 1fr); grid-template-rows: repeat(5, 1fr); gap: 5px; padding: 8px; border-radius: 14px; background: #202532; border: 1px solid #353c4d; }
.arrow-tile { display: grid; place-items: center; border-radius: 8px; color: #555d70; background: #282e3b; font-size: 23px; }
.arrow-tile.player { background: #45402b; color: var(--lime); box-shadow: inset 0 0 0 1px #c7f36b55; }
.arrow-tile.target { background: #293e3b; color: #76e0b0; }
.arrow-help { font-size: 12px; color: var(--muted); margin: 13px 0 0; }
.arrow-controls { display: grid; grid-template-columns: repeat(3, 42px); gap: 5px; justify-content: center; margin: 14px auto 0; }
.arrow-controls button { width: 42px; height: 36px; border: 1px solid #414859; border-radius: 7px; background: #252b38; cursor: pointer; color: #dce0e9; }
.arrow-controls button:hover { border-color: var(--lime); color: var(--lime); }
.arrow-controls button:nth-child(1) { grid-column: 2; }
.arrow-controls button:nth-child(2) { grid-column: 1; grid-row: 2; }
.arrow-controls button:nth-child(3) { grid-column: 2; grid-row: 2; }
.arrow-controls button:nth-child(4) { grid-column: 3; grid-row: 2; }
.matching-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; width: min(100%, 380px); margin: 0 auto 18px; }
.matching-card { aspect-ratio: 1; border: 1px solid #414859; border-radius: 12px; background: linear-gradient(145deg, #303748, #232936); color: #aab2c4; cursor: pointer; font-size: clamp(21px, 5vw, 31px); transition: transform .2s, background .2s; }
.matching-card:hover:not(.matched) { transform: translateY(-2px); border-color: #78839a; }
.matching-card.revealed { background: #343044; color: #d5c4ff; border-color: #7862a9; }
.matching-card.matched { background: #293c32; color: var(--lime); border-color: #557e61; cursor: default; }
.math-panel { width: min(100%, 420px); margin: auto; text-align: center; }
.math-score { display: flex; justify-content: center; gap: 24px; color: #aab0c0; font: 12px 'DM Mono', monospace; margin: 4px 0 23px; }
.math-score strong { color: var(--lime); margin-left: 5px; }
.math-question { font: 600 clamp(36px, 9vw, 54px) 'Space Grotesk', sans-serif; margin: 18px 0 22px; }
.math-answer { width: min(100%, 270px); padding: 12px; text-align: center; background: #202532; border: 1px solid #414859; border-radius: 9px; color: white; outline: none; font: 20px 'DM Mono', monospace; }
.math-answer:focus { border-color: var(--lime); }
.math-ops { display: flex; justify-content: center; flex-wrap: wrap; gap: 7px; margin: 0 0 16px; }
.math-op { padding: 7px 11px; border-radius: 20px; background: #292f3e; color: #b9bfd0; font-size: 11px; }
.math-op.active { color: var(--lime); border: 1px solid #879e52; background: #303a28; }
.cards-game { overflow-x: auto; padding-bottom: 8px; }
.cards-row { min-width: 540px; display: grid; grid-template-columns: repeat(7, minmax(54px, 1fr)); gap: 7px; }
.cards-piles { display: grid; grid-template-columns: repeat(7, minmax(54px, 1fr)); gap: 7px; min-height: 116px; margin-bottom: 15px; }
.card-pile { position: relative; min-height: 90px; border: 1px dashed #414859; border-radius: 8px; }
.card-slot-label { font: 9px 'DM Mono', monospace; color: #81889b; text-align: center; padding-top: 9px; }
.playing-card { width: 100%; height: 76px; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; padding: 5px 4px; border: 1px solid #c6cbd4; border-radius: 7px; background: #f5f4ee; color: #252b36; cursor: pointer; text-align: left; line-height: 1.05; font: 700 15px 'DM Mono', monospace; box-shadow: 0 3px 6px #0003; }
.card-rank, .card-suit { display: block; }
.playing-card.red { color: #d44a55; }
.playing-card.back { color: #e6eaff; background: repeating-linear-gradient(45deg, #485b83, #485b83 4px, #394766 4px, #394766 8px); border-color: #8796bd; }
.playing-card.selected { outline: 3px solid var(--lime); transform: translateY(-3px); }
.playing-card.face-down { background: repeating-linear-gradient(45deg, #485b83, #485b83 4px, #394766 4px, #394766 8px); color: transparent; border-color: #8796bd; }
.tableau-column { position: relative; min-height: 100px; border: 1px dashed #414859; border-radius: 8px; }
.tableau-column .playing-card { display: block; margin-bottom: -43px; position: relative; }
.tableau-column.spider-column .playing-card { margin-bottom: -45px; }
.tableau-column .playing-card:last-child { margin-bottom: 0; }
.card-pile .playing-card { position: absolute; inset: 0; height: 76px; }
.card-pile .playing-card + .playing-card { transform: translate(10px, 3px); }
.card-pile .playing-card.selected { transform: translateY(-3px); }
.spider-board { display: grid; grid-template-columns: repeat(10, minmax(48px, 1fr)); gap: 5px; min-width: 590px; align-items: start; }
.spider-board .playing-card { height: 66px; padding: 4px; font-size: 13px; }
.spider-board .tableau-column { min-height: 82px; }
.spider-board .tableau-column .playing-card { margin-bottom: -40px; }
.spider-board .tableau-column .playing-card:last-child { margin-bottom: 0; }
.completed-suits { color: var(--lime); font: 12px 'DM Mono', monospace; }

@media (max-width: 700px) {
  .app-shell { width: min(100% - 32px, 540px); }
  .topbar { height: 68px; }
  .topbar-note { font-size: 8px; letter-spacing: .7px; }
  .hero { min-height: 300px; }
  .hero-art { position: absolute; opacity: .22; right: -105px; margin: 0; transform: scale(.85); }
  .hero-copy { max-width: 100%; }
  .hero-description { max-width: 390px; }
  .game-list { grid-template-columns: 1fr; }
  .game-section { padding-top: 23px; }
  .section-heading { align-items: start; gap: 10px; }
  .section-heading h2 { font-size: 21px; }
  .game-count { text-align: right; font-size: 8px; white-space: nowrap; padding-top: 4px; }
  .game-dialog { padding: 19px; }
}

@media (max-width: 380px) {
  .app-shell { width: calc(100% - 24px); }
  .topbar-note { max-width: 125px; line-height: 1.4; }
  .game-card { padding: 17px 14px; gap: 12px; }
  .game-icon { flex-basis: 50px; height: 50px; }
}
