/* Shared look for the playground and its games: Ahmed's Paint colours and wobbly outlines. */
:root {
  --ink: #000000;
  --paper: #ffffff;
  --brown: #b97a57;
  --sky: #99d9ea;
  --yellow: #fff200;
  --gold: #ffc90e;
  --red: #ed1c24;
  --wobble-a: 255px 18px 225px 18px / 18px 225px 18px 255px;
  --wobble-b: 18px 255px 18px 225px / 225px 18px 255px 18px;
  --wobble-button: 120px 14px 100px 14px / 14px 100px 14px 120px;
  --display: 'Balsamiq Sans', 'Comic Sans MS', cursive; /* clear letters for new readers, and has č, ć, š, ž, đ */
  --body: 'Balsamiq Sans', 'Comic Sans MS', sans-serif;
  /* Exactly what the device reports for its notch, rounded corners and home bar. */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --screen-height: 100vh;
}

/* The visible height, which leaves out a phone browser's address bar. */
@supports (height: 100dvh) {
  :root { --screen-height: 100dvh; }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: var(--screen-height);
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 22px;
}

h1, h2 { margin: 0; font-family: var(--display); font-weight: 700; line-height: 1.05; }
p { margin: 0; }
a { color: var(--ink); }

.page {
  max-width: 1160px;
  margin: 0 auto;
  padding: 32px 24px 56px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.title { font-size: clamp(48px, 8vw, 92px); }
.subtitle { font-size: 24px; }
.section-title { font-size: 38px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 22px;
  background: var(--paper);
  color: var(--ink);
  border: 5px solid var(--ink);
  border-radius: var(--wobble-button);
  font: inherit;
  font-size: 23px;
  text-decoration: none;
  cursor: pointer;
}
.button-primary { background: var(--yellow); }
.button:hover, a.card:hover .button, button.card:hover .button { background: var(--gold); }
.button:focus-visible, .card:focus-visible { outline: 4px solid var(--red); outline-offset: 3px; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 32px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  padding: 18px 20px;
  background: var(--paper);
  color: var(--ink);
  border: 6px solid var(--ink);
  border-radius: var(--wobble-a);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.card:nth-child(even) { border-radius: var(--wobble-b); }
.card img { display: block; width: 100%; height: auto; }
.card-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.card-name { display: block; font-family: var(--display); font-weight: 700; font-size: 40px; line-height: 1.1; }

.card-empty {
  align-items: center;
  justify-content: center;
  min-height: 280px;
  border-style: dashed;
  text-align: center;
  cursor: default;
}

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.step { display: flex; align-items: center; gap: 16px; font-size: 26px; }
.step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 64px;
  height: 64px;
  border: 5px solid var(--ink);
  border-radius: 55% 45% 60% 40% / 45% 60% 40% 55%;
  font-size: 34px;
}

.top-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.top-spacer { flex-grow: 1; }
.kid-button { min-width: 56px; padding: 0 6px; }
.lang-button { min-width: 56px; padding: 0 8px; }
.kid-button svg { display: block; }
.fullscreen-toggle { min-width: 56px; padding: 0 10px; }
.fullscreen-toggle .fs-exit { display: none; }
.fullscreen-toggle.is-fullscreen .fs-enter { display: none; }
.fullscreen-toggle.is-fullscreen .fs-exit { display: inline; }

.browser-tip { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 10px 14px; background: var(--yellow); border: 4px solid var(--ink); border-radius: var(--wobble-b); font-size: 20px; }
.browser-tip p { flex: 1 1 220px; }

.kid-picker {
  position: fixed; inset: 0; z-index: 20; overflow-y: auto; display: flex; background: var(--paper);
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
}
.kid-picker-box { display: flex; flex-direction: column; align-items: center; gap: 16px; margin: auto; padding: 12px; text-align: center; }
.kid-picker h2 { font-size: clamp(36px, 7vw, 64px); }
.kid-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.kid-tile {
  display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 112px; padding: 10px;
  background: var(--paper); color: var(--ink); border: 5px solid var(--ink); border-radius: var(--wobble-a);
  font: inherit; font-size: 22px; cursor: pointer;
}
.kid-tile:hover { background: var(--yellow); }
.kid-tile:focus-visible { outline: 4px solid var(--red); outline-offset: 3px; }
.sound-toggle { min-width: 56px; padding: 0 10px; }
.sound-toggle .sound-cross { display: none; }
.sound-toggle.sound-off .sound-cross { display: inline; }
.sound-toggle.sound-off .sound-waves { display: none; }

/* Phones, held either way: less heading, more game. */
@media (max-width: 640px), (max-height: 500px) {
  .page { padding: 8px 12px 24px; gap: 14px; }
  .title { font-size: 40px; }
  .subtitle { font-size: 18px; }
  .section-title { font-size: 26px; }
  .top-row { gap: 6px; flex-wrap: nowrap; }
  .top-row .button { min-height: 44px; padding: 0 8px; font-size: 17px; }
  .top-row .lang-button, .top-row .kid-button, .top-row .sound-toggle, .top-row .fullscreen-toggle { min-width: 44px; padding: 0 4px; }
  .kid-button svg { width: 32px; height: 32px; }
  .card { padding: 10px 12px; gap: 8px; }
  .card-name { font-size: 28px; }
  .card-grid { gap: 12px; }
  .card-empty { min-height: 120px; }
  .step { font-size: 19px; gap: 10px; }
  .step-number { flex-basis: 44px; height: 44px; font-size: 24px; }
  .steps { gap: 8px; }
  .kid-tile { min-width: 96px; font-size: 18px; padding: 6px; }
}
