/* Lato i Zima in the AleGry look: paper background, ink outlines, hard shadows; the board is a canvas. */
:root {
  --paper: #FFF7EA;
  --ink: #1D1533;
  --muted: #574D6E;
  --primary: #D93D22;
  --lemon: #FFD23F;
  --lemon-light: #FFF3C4;
  --summer: #FF8A3D;
  --winter: #5BB6F0;
  --sky-light: #E3F4FF;
  --line: 3px solid var(--ink);
  --radius: 18px;
  --radius-sm: 10px;
  --font-heading: 'Fredoka', 'Trebuchet MS', 'Segoe UI', sans-serif;
  --font-body: 'Nunito', 'Segoe UI', Verdana, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { background: var(--paper); color: var(--ink); }
body { margin: 0; padding: 4px 8px 12px 4px; font: 16px/1.5 var(--font-body); }
h2 { font-family: var(--font-heading); line-height: 1.15; }
:focus-visible { outline: 3px solid #7A5CFA; outline-offset: 2px; }
.notice { margin: 1rem; padding: .75rem 1rem; border: 2px solid var(--ink); border-radius: var(--radius-sm); background: var(--lemon-light); }

.button { font: 700 1rem var(--font-heading); padding: .6rem 1.1rem; border: var(--line); border-radius: 999px; background: var(--primary); color: #fff; box-shadow: 3px 3px 0 var(--ink); cursor: pointer; }
.button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.button--ghost { background: #fff; color: var(--ink); }
.button--small { font-size: .9rem; padding: .4rem .85rem; box-shadow: 2px 2px 0 var(--ink); }

.board { background: #fff; border: var(--line); border-radius: var(--radius); box-shadow: 5px 5px 0 var(--ink); overflow: hidden; }
.board__bar { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between; padding: .7rem 1rem; background: linear-gradient(90deg, #FFE3CC, var(--sky-light)); border-bottom: var(--line); }
.board__bar p { margin: 0; }
.board__level { font: 700 1.1rem var(--font-heading); }
.board__counters { display: flex; gap: 1rem; font-weight: 700; font-size: .9rem; }
.board__counters strong { font: 700 1.1rem var(--font-heading); }
.board__actions { display: flex; gap: .5rem; }
.hint { margin: .6rem 1rem; font-size: .9rem; color: var(--muted); min-height: 1.35em; }

.screen { position: relative; margin: 0 .75rem; border: var(--line); border-radius: var(--radius-sm); overflow: hidden; background: #FFF7EA; }
.screen canvas { display: block; width: 100%; height: auto; aspect-ratio: 768 / 480; }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: .75rem; background: rgba(29, 21, 51, .45); overflow: auto; }
.overlay__box { width: min(100%, 34rem); padding: 1.1rem 1.25rem; border: var(--line); border-radius: var(--radius); background: #fff; box-shadow: 5px 5px 0 var(--ink); text-align: center; }
.overlay__box h2 { margin: 0 0 .4rem; font-size: 1.6rem; }
.overlay__box p { margin: 0 0 .8rem; }
.overlay__actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin: 0 !important; }
.overlay__actions:empty { display: none; }
.levels { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: .5rem; margin-bottom: .8rem; }
.level { display: grid; gap: .1rem; padding: .5rem .6rem; border: 2px solid var(--ink); border-radius: var(--radius-sm); background: var(--lemon-light); color: var(--ink); box-shadow: 2px 2px 0 var(--ink); font: 600 .9rem var(--font-body); text-align: left; cursor: pointer; }
.level strong { font: 700 1.2rem var(--font-heading); }
.level small { color: var(--muted); font-weight: 700; min-height: 1.2em; }
.level.is-current { background: var(--lemon); }
.level:disabled { background: #F3F0F7; color: #9C93AE; box-shadow: none; cursor: default; }

.pads { display: none; justify-content: space-between; gap: 1rem; padding: .75rem; }
.pad { display: flex; gap: .4rem; }
.pad button { width: 3.6rem; height: 3.6rem; border: var(--line); border-radius: 50%; color: var(--ink); box-shadow: 3px 3px 0 var(--ink); font-size: 1.3rem; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.pad--lato button { background: #FFE3CC; }
.pad--zima button { background: var(--sky-light); }
.pad button.is-down { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); filter: brightness(.92); }
.keys { margin: .6rem 1rem .9rem; font-size: .85rem; color: var(--muted); text-align: center; }

.mg-toast { position: fixed; left: 50%; top: 1rem; z-index: 50; max-width: calc(100% - 2rem); transform: translate(-50%, -6rem); visibility: hidden; padding: .6rem 1.1rem; border-radius: 999px; background: var(--ink); color: #fff; font-weight: 800; text-align: center; transition: transform .25s ease, visibility .25s; }
.mg-toast.is-visible { transform: translate(-50%, 0); visibility: visible; }

/* Touch screens get the buttons; the keyboard line stays for those with a keyboard too. */
@media (pointer: coarse) { .pads { display: flex; } }
.has-touch .pads { display: flex; }
@media (max-width: 640px) {
  .screen { margin: 0 .4rem; }
  .overlay { position: static; background: none; padding: .75rem 0 0; }
  .screen { overflow: visible; border: 0; }
  .screen canvas { border: var(--line); border-radius: var(--radius-sm); }
  .overlay__box { width: 100%; }
  .pad button { width: 3.2rem; height: 3.2rem; }
}
@media (max-width: 420px) {
  .pads { gap: .5rem; padding: .75rem .4rem; }
  .pad { gap: .3rem; }
  .pad button { width: 2.9rem; height: 2.9rem; font-size: 1.1rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
