/* Drabinka słów in the AleGry look: paper background, ink outlines, hard shadows; the ladder is rows of letter tiles. */
:root {
  --paper: #FFF7EA;
  --ink: #1D1533;
  --muted: #574D6E;
  --primary: #D93D22;
  --lemon: #FFD23F;
  --lemon-light: #FFF3C4;
  --mint: #20B69A;
  --mint-light: #D3F4EC;
  --tomato-light: #FFE1D9;
  --line: 3px solid var(--ink);
  --radius: 18px;
  --radius-sm: 10px;
  --tile: 3.1rem;
  --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:disabled { opacity: .4; cursor: default; transform: none; }
.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: .6rem; align-items: center; justify-content: space-between; padding: .75rem 1rem; background: var(--mint-light); border-bottom: var(--line); }
.board__bar p { margin: 0; }
.board__options { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.board__label { font-weight: 700; font-size: .9rem; }
.board__options select { padding: .35rem .7rem; border: var(--line); border-radius: 999px; background: #fff; color: var(--ink); font: 700 .9rem var(--font-body); }
.board__counters { display: flex; gap: 1rem; font-size: .9rem; font-weight: 700; }
.board__counters strong { font: 700 1.2rem var(--font-heading); }
.board__actions { display: flex; flex-wrap: wrap; gap: .5rem; }

.label { margin: 1rem 1.25rem .25rem; text-align: center; font: 700 1rem var(--font-heading); color: var(--muted); }
.label.is-error { color: var(--primary); }
.ladder { display: grid; gap: .35rem; justify-content: center; margin: 0; padding: .5rem 1rem 1rem; list-style: none; }
.rung { display: grid; grid-template-columns: repeat(5, var(--tile)); gap: .35rem; position: relative; }
.rung.is-shaking { animation: shake .4s ease; }
.tile { height: var(--tile); display: grid; place-items: center; border: 3px solid var(--ink); border-radius: var(--radius-sm); background: #fff; font: 700 1.7rem var(--font-heading); text-transform: uppercase; user-select: none; }
.tile.is-match { background: var(--mint-light); }
.tile.is-changed { background: var(--lemon); animation: pop .15s ease; }
.rung--start .tile { background: var(--ink); color: #fff; }
.rung--start .tile.is-match { background: var(--mint); }
.rung--goal .tile { background: var(--mint); color: #fff; }
.rung--entry .tile { border-style: dashed; border-color: #b9afcb; }
.rung--entry .tile.is-filled { border-style: solid; border-color: var(--ink); animation: pop .12s ease; }
.rung--entry .tile.is-cursor { border-color: var(--primary); border-style: solid; }
.gap { margin: .1rem 0; text-align: center; font-weight: 700; font-size: .9rem; color: var(--muted); }
.gap::before { content: '⋮'; display: block; font-size: 1.3rem; line-height: 1; color: #b9afcb; }

.keyboard { display: grid; gap: .35rem; padding: 0 1rem 1rem; }
.keyboard__row { display: flex; justify-content: center; gap: .3rem; }
.keyboard button { flex: 1 1 0; max-width: 2.9rem; min-height: 3rem; padding: 0; font: 700 1.2rem var(--font-heading); text-transform: uppercase; border: var(--line); border-radius: var(--radius-sm); background: var(--paper); color: var(--ink); box-shadow: 0 3px 0 var(--ink); cursor: pointer; }
.keyboard__row:last-child button { background: var(--lemon-light); }
.keyboard button.is-wide { max-width: 5rem; flex-grow: 1.6; font-size: .95rem; text-transform: none; }
.keyboard button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }

.result { display: none; margin: 0 1.25rem 1rem; padding: 1rem 1.25rem; border: var(--line); border-radius: var(--radius); background: var(--mint-light); }
.result.is-visible { display: block; }
.result h2 { margin: 0 0 .25rem; font-size: 1.4rem; }
.result p { margin: 0; }
.result__actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem !important; }

.credit { margin: 0; padding: 0 1rem .75rem; text-align: center; font-size: .75rem; color: var(--muted); }
.credit a { color: inherit; }

.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; }

@keyframes pop { from { transform: scale(.9); } to { transform: none; } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@media (max-width: 480px) {
  :root { --tile: 2.7rem; }
  .board__bar { padding: .6rem .75rem; }
  .board__counters { gap: .7rem; }
  .tile { font-size: 1.45rem; }
  .keyboard { padding: 0 .4rem .8rem; gap: .3rem; }
  .keyboard__row { gap: .2rem; }
  .keyboard button { min-height: 2.8rem; font-size: 1.05rem; border-width: 2px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
