#app { max-width: 760px; margin: 0 auto; padding: 12px 14px calc(20px + env(safe-area-inset-bottom)); min-height: 100%; }
.screen { display: flex; flex-direction: column; gap: 12px; min-height: calc(100dvh - 24px); }

.top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.top > :first-child { justify-self: start; }
.top > :last-child { justify-self: end; }
.top h2 { font-size: 1.15rem; }

/* menu */
#screen-menu { justify-content: center; }
.menu-card { text-align: center; padding: 24px 8px; }
.logo-mark { width: 150px; height: 75px; }
.lm-wire { fill: none; stroke: var(--cyan); stroke-width: 5; stroke-linejoin: round; filter: drop-shadow(0 0 6px var(--cyan)); }
.lm-src { fill: var(--yellow); }
.lm-tgt { fill: var(--green); }
.logo { font-size: clamp(2rem, 8vw, 3rem); letter-spacing: .12em; margin-top: 4px; }
.logo span { color: var(--cyan); }
.tagline { color: var(--muted); margin: 6px 0 24px; }
.menu-list { display: grid; gap: 10px; max-width: 320px; margin: 0 auto; }
.menu-foot { margin-top: 22px; color: var(--muted); font-size: .9rem; }

/* modes */
.mode-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.card {
  text-align: left; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 6px;
  transition: transform .12s, border-color .15s;
}
.card:hover:not([disabled]) { border-color: var(--cyan); transform: translateY(-2px); }
.card[disabled] { opacity: .5; cursor: not-allowed; }
.card .ico { font-size: 1.6rem; color: var(--purple); }
.card h3 { font-size: 1rem; }
.card p { margin: 0; font-size: .85rem; color: var(--muted); }
.card .meta { display: flex; justify-content: space-between; font-size: .8rem; color: var(--yellow); margin-top: auto; }
.card .soon { color: var(--muted); }

/* levels */
.level-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.lvl {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 6px; text-align: center; display: flex; flex-direction: column; gap: 2px;
}
.lvl b { font-size: 1.2rem; }
.lvl small { color: var(--muted); }
.lvl .st { color: var(--yellow); font-size: .85rem; letter-spacing: 2px; min-height: 1.2em; }
.lvl[disabled] { opacity: .4; cursor: not-allowed; }
.lvl:hover:not([disabled]) { border-color: var(--cyan); }

/* game */
#screen-game { align-items: center; }
#screen-game .top { width: 100%; }
.game-title { display: flex; flex-direction: column; align-items: center; line-height: 1.2; }
.hud { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: 100%; max-width: 560px; }
.chip { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 6px 8px; text-align: center; }
.chip small { display: block; color: var(--muted); font-size: .7rem; }
.chip b { font-family: var(--mono); font-size: 1.1rem; }
.chip b.warn { color: var(--danger); }
.status { min-height: 1.5em; margin: 0; text-align: center; color: var(--muted); }
.status.ok { color: var(--green); }
.status.bad { color: var(--danger); }
.controls { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.test { width: 100%; max-width: 560px; letter-spacing: .08em; }

/* result */
#screen-result { justify-content: center; }
.result-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 18px; text-align: center; }
.result-card h2 { color: var(--green); margin-bottom: 8px; }
.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin: 16px 0; }
.result-grid div { background: var(--bg2); border-radius: 10px; padding: 8px; }
.result-grid dt { color: var(--muted); font-size: .75rem; }
.result-grid dd { margin: 0; font-family: var(--mono); font-size: 1.2rem; }
.r-ach { display: grid; gap: 6px; margin-bottom: 14px; }
.r-ach .new { background: #2a2250; border: 1px solid var(--purple); border-radius: 10px; padding: 8px; }
.result-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* achievements / stats / settings */
.ach-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.ach-list li { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; display: flex; gap: 12px; align-items: center; }
.ach-list li.locked { opacity: .5; }
.ach-list .ai { font-size: 1.5rem; }
.ach-list small { color: var(--muted); display: block; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; }
.stat small { color: var(--muted); display: block; }
.stat b { font-family: var(--mono); font-size: 1.25rem; }
.records { display: grid; gap: 6px; }
.records div { display: flex; justify-content: space-between; background: var(--panel); border-radius: 10px; padding: 8px 12px; }
.settings { display: grid; gap: 14px; justify-items: center; text-align: center; padding-top: 12px; }
.legend { margin: 0; color: var(--muted); font-size: .85rem; text-align: center; }
.legend b { color: var(--text); font-family: var(--mono); }
.hud { grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); }
