/* Valley Quests: one stylesheet for the whole app.

   The look is a hand-painted Nordic valley: misty sky, pine trees, moss,
   warm wood and cream paper (see design-reference/design-reference/DESIGN.md).
   The scenery itself is drawn in templates/_scenery.html; this file does
   the rest: colours, letters, cards, buttons, the quest board and the menus.

   Phones first: everything is sized for a phone, and on a bigger screen the
   app stays a phone-wide column in the middle.
   There are no inline styles anywhere (the security policy forbids them),
   so every look lives here.
*/

/* ------------------------------------------------------------------ fonts */

/* Both fonts are stored in quest/static/fonts, so the app works without the
   internet. Each file holds a whole range of weights ("variable font"). */
@font-face {
  font-family: "Fraunces";
  src: url("fonts/fraunces.woff2") format("woff2");
  font-weight: 600 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Nunito";
  src: url("fonts/nunito.woff2") format("woff2");
  font-weight: 500 800;
  font-style: normal;
  font-display: swap;
}

/* ---------------------------------------------------------------- colours */

:root {
  --paper: #f6eedc;          /* the page */
  --card: #fbf6ea;           /* cards */
  --input: #fffdf7;          /* text fields and PIN keys */
  --line: #e2d3b4;           /* card borders */
  --line-strong: #d9c7a3;    /* stronger borders, and the solid "shadow" under cards */
  --line-deep: #cdb88f;      /* the shadow under the big PIN card */
  --text: #2e2b25;
  --text-soft: #4a4436;      /* form labels */
  --muted: #6b6253;          /* small hints */
  --heading: #2f4a3a;        /* titles: dark pine green */
  --moss: #4f6b3a;           /* buttons */
  --moss-edge: #344a26;      /* the darker edge under buttons */
  --moss-dark: #3b5229;      /* links when you point at them */
  --gold: #f2d27a;           /* coin badges */
  --gold-text: #5a4210;
  --berry: #c0533e;          /* pins and labels */
  --berry-dark: #8a4a2e;
  --wood: #8e5e37;           /* the quest board */
  --wood-frame: #6e4527;
  --wood-edge: #5e3a20;
  --note: #fbf4e2;           /* the paper notes on the board */
  --faded: #efe8d8;          /* delivered rewards, switched-off things */
  --faded-line: #e2d9c6;
  --faded-text: #5b5446;
  --sky: #dceae7;
  --pine: #35503d;

  /* The soft tiles behind icons, and the lines of the icons on them. */
  --tile-green: #e4eedc;
  --tile-peach: #f6e3c8;
  --tile-blue: #dde7ec;
  --tile-pink: #f3dde0;
  --tile-cream: #efe6cf;

  --heading-font: "Fraunces", Georgia, serif;
  --body-font: "Nunito", "Segoe UI", system-ui, sans-serif;
  --nav-height: 76px;        /* the menu bar at the bottom of player pages */
}

/* ------------------------------------------------------------------- base */

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  /* Around the app on a wide screen: a slightly darker paper. */
  background: #ebe0c8;
  color: var(--text);
  font-family: var(--body-font);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.45;
}

/* The paper grain over the whole screen, like the mockups: a fine noise
   picture, multiplied over everything at low strength. It can't be clicked. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  background: url("paper.svg");
  mix-blend-mode: multiply;
  opacity: 0.28;
}

/* The app: one phone-wide column of paper. */
.app {
  position: relative;
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--paper);
}

.page {
  padding: 6px 16px 32px;
}

/* Player pages leave room for the menu bar at the bottom. */
.player .page {
  padding-bottom: calc(var(--nav-height) + 28px);
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--heading);
  font-family: var(--heading-font);
  font-weight: 700;
  line-height: 1.15;
}

/* A screen title, like "Quest board". */
h1 {
  margin: 6px 4px 4px;
  font-size: 28px;
}

/* A section label, like "ON ITS WAY": small, bold capitals in berry red. */
h2 {
  margin: 22px 4px 10px;
  color: var(--berry-dark);
  font-family: var(--body-font);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

p {
  margin: 0 0 12px;
}

a {
  color: var(--moss);
  font-weight: 700;
}

a:hover {
  color: var(--moss-dark);
}

code {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--tile-cream);
  font-size: 0.9em;
}

.center {
  text-align: center;
}

/* Text only for screen readers: hidden on screen, but still read out. */
.visually-hidden {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* The line under a screen title, like "Spend your coins on something nice." */
.lead,
.subtitle {
  margin: 0 4px 14px;
  color: var(--muted);
  font-size: 14px;
}

/* A quieter section label, like "Delivered" on the rewards page. */
h2.muted-label {
  color: var(--muted);
}

.hint {
  color: var(--muted);
  font-size: 14px;
}

.empty {
  padding: 18px 16px;
  border: 2px dashed var(--line-strong);
  border-radius: 18px;
  color: var(--muted);
  text-align: center;
}

/* A title with something on its right, like "Quest board ... 3 waiting". */
.title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 4px 12px;
}

.title-row h1 {
  margin: 0;
}

.count {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

/* Short messages after an action: a cream note with a berry edge. */
.flash {
  margin: 8px 0 14px;
  padding: 12px 16px;
  border: 2px solid var(--line-strong);
  border-left: 6px solid var(--berry);
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 3px 0 var(--line-strong);
  font-weight: 700;
}

section {
  margin-top: 8px;
}

/* ------------------------------------------------------------------ coins */

.coin {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  vertical-align: -3px;
}

.coins {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  vertical-align: middle; /* lines up with the text around it */
}

/* The coin badge on a quest, like "+15 coins". */
.xp-badge {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--gold);
  color: var(--gold-text);
  font-size: 14px;
  font-weight: 800;
}

.xp-badge .coin {
  width: 16px;
  height: 16px;
}

/* The coins in the top corner of a page, and the balance badge. */
.coin-pill,
.balance {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 6px 14px 6px 10px;
  border: 2px solid var(--line-strong);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
}

.coin-pill .coin,
.balance .coin {
  width: 20px;
  height: 20px;
}

/* -------------------------------------------------------------- scenery */

/* The watercolour scene. It fills the width; on a wide screen a bit of sky
   is cut off at the top (preserveAspectRatio="... slice"), never the hills. */
.scenery {
  display: block;
  width: 100%;
  height: 150px;
}

.scenery-tall {
  height: 380px;
}

/* A short scene at the top of a player page, with your name and coins on it. */
.scene-header {
  position: relative;
  /* The watercolour wobble can paint a pixel past the bottom of the scene;
     this cuts it off neatly. */
  overflow: hidden;
}

.scene-bar {
  position: absolute;
  top: 22px;
  right: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.who {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.who-name {
  overflow: hidden;
  color: var(--heading);
  font-family: var(--heading-font);
  font-size: 20px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ------------------------------------------------------------- avatars */

.avatar {
  display: block;
  flex-shrink: 0;
  width: 112px;
  height: 112px;
  margin: 0 auto 8px;
  border: 4px solid var(--card);
  border-radius: 50%;
  box-shadow: 0 4px 0 var(--line-strong);
  object-fit: cover;
}

/* No photo: the first letter, in a warm terracotta circle. */
.avatar.letter {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #c97b5a;
  color: #ffffff;
  font-family: var(--heading-font);
  font-size: 48px;
  font-weight: 700;
}

.avatar.small {
  width: 52px;
  height: 52px;
  margin: 0;
  border-width: 3px;
  box-shadow: none;
  font-size: 22px;
}

.avatar.tiny {
  width: 44px;
  height: 44px;
  margin: 0;
  border-width: 3px;
  box-shadow: none;
  font-size: 20px;
}

/* A player's photo, name and coins together (admin player page). */
.profile {
  margin: 8px 0 16px;
  text-align: center;
}

.profile h1 {
  margin: 4px 0 8px;
}

/* ------------------------------------------------------------- buttons */

/* A big pill button: white bold letters on moss green, with a darker edge
   below that it "sinks into" when pressed. */
.button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 52px;
  margin: 10px 0;
  padding: 10px 22px;
  border: none;
  border-radius: 999px;
  background: var(--moss);
  box-shadow: 0 3px 0 var(--moss-edge);
  color: #ffffff;
  font-family: var(--body-font);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  background: #47613a;
  color: #ffffff;
}

.button:active {
  box-shadow: 0 0 0 var(--moss-edge);
  transform: translateY(3px);
}

.button:focus-visible,
.key:focus-visible,
.player-nav a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--berry);
  outline-offset: 2px;
}

/* A quieter button: cream with a green word, like "No, go back". */
.button.secondary {
  border: 2px solid var(--line);
  background: var(--card);
  box-shadow: 0 3px 0 var(--line-strong);
  color: var(--heading);
}

.button.secondary:hover {
  background: var(--input);
}

/* Delete: berry red, so it stands out from the other buttons. */
.button.danger {
  background: var(--berry);
  box-shadow: 0 3px 0 var(--berry-dark);
}

.button.danger:hover {
  background: #ad4a37;
}

.button.secondary.danger {
  background: var(--card);
  box-shadow: 0 3px 0 var(--line-strong);
  color: var(--berry);
}

.button.secondary.danger:hover {
  background: #f6e2da;
}

/* A smaller button inside a card or a row (still easy to tap). */
.button.small {
  width: auto;
  min-height: 44px;
  margin: 0;
  padding: 8px 18px;
  font-size: 15px;
}

/* A button that can't be tapped right now (like Buy without enough coins). */
.button:disabled,
.button:disabled:hover {
  background: #e2d9c6;
  box-shadow: none;
  color: var(--faded-text);
  font-weight: 700;
  cursor: not-allowed;
  transform: none;
}

/* ---------------------------------------------------------------- forms */

.stack {
  display: grid;
  gap: 6px;
}

.stack label,
.field-label {
  margin-top: 10px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 800;
}

input[type="text"],
input[type="password"],
input[type="number"],
textarea,
select {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--input);
  color: var(--text);
  font: inherit;
  font-size: 16px;
}

textarea {
  resize: vertical;
}

input[type="file"] {
  max-width: 100%;
  font: inherit;
}

.stack label.check {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  font-weight: 700;
}

.check input {
  width: 24px;
  height: 24px;
  accent-color: var(--moss);
}

/* A short list of points, like "what happens when you delete this". */
.points {
  padding-left: 1.2em;
  line-height: 1.5;
}

/* --------------------------------------------------------- the PIN card */

/* The sign-in page: the tall valley at the top, the PIN card at the bottom. */
.signin .app {
  display: flex;
  flex-direction: column;
}

.signin-scene {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
}

.signin-title {
  position: absolute;
  top: 52px;
  right: 0;
  left: 0;
  text-align: center;
}

.signin-title h1 {
  margin: 0;
  font-size: 40px;
  line-height: 1.05;
  letter-spacing: -0.5px;
}

.signin-title p {
  margin: 6px 0 0;
  color: #3f5a4a;
  font-weight: 600;
}

/* The card sits low on the screen, but never over the title. */
.signin .page {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: flex-end;
  padding: 250px 16px 26px;
}

.pin-card {
  padding: 24px 20px 22px;
  border: 2px solid var(--line-strong);
  border-radius: 28px;
  background: var(--card);
  box-shadow: 0 6px 0 var(--line-deep);
  text-align: center;
}

.pin-card h2 {
  margin: 0 0 14px;
  color: var(--text);
  font-family: var(--heading-font);
  font-size: 23px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.pin-card .hint {
  margin: 18px 0 0;
}

/* One dot per digit: an empty ring, filled green once typed. */
.pin-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  height: 16px;
  margin-bottom: 18px;
}

.pin-dots span {
  width: 12px;
  height: 12px;
  border: 2px solid #a99b7e;
  border-radius: 50%;
}

.pin-dots span.filled {
  width: 16px;
  height: 16px;
  border: none;
  background: var(--moss);
}

.keys {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

/* A PIN key: cream, with a darker edge below and a Fraunces digit. */
.key {
  height: 62px;
  border: 2px solid var(--line);
  border-radius: 20px;
  background: var(--input);
  box-shadow: 0 3px 0 #d2bd93;
  color: var(--text);
  font-family: var(--heading-font);
  font-size: 26px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

.key:active {
  box-shadow: 0 0 0 #d2bd93;
  transform: translateY(3px);
}

.key-back {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #efe6d2;
  color: #5b5446;
}

/* ---------------------------------------------------------------- cards */

.list {
  display: grid;
  gap: 12px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

/* A card: cream paper with a 2 px border and a solid darker "shadow" below. */
.card {
  padding: 14px 16px;
  border: 2px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  box-shadow: 0 4px 0 var(--line-strong);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* With an icon on the left, the title takes the room in the middle. */
.card-top .icon-tile + strong {
  flex: 1;
}

.card-top strong,
.card-title {
  color: var(--text);
  font-family: var(--heading-font);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.2;
}

.card-text {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.card .button {
  margin-bottom: 0;
}

.card .hint {
  margin: 6px 0 0;
}

/* "Waiting for your answer": someone says they did your quest. Hard to miss. */
.card.notice {
  border-color: #e5c766;
  background: #fbf0cf;
  box-shadow: 0 4px 0 #e0c472;
}

/* A row: a card with things side by side (a list of rewards, players, ...). */
.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 4px 0 var(--line-strong);
}

.row-main {
  display: flex;
  flex: 1 1 150px;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.row-main strong {
  font-family: var(--heading-font);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
}

.row-main .hint {
  font-size: 13px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* A whole row you can tap, with a › on the right. */
.row-link {
  flex-wrap: nowrap;
  color: inherit;
  font-weight: 500;
  text-decoration: none;
}

.row-link:hover {
  border-color: var(--line-strong);
  color: inherit;
}

.row-arrow {
  color: var(--muted);
  font-size: 28px;
  line-height: 1;
}

/* Switched-off, delivered and undone things are greyed out. */
.row.off {
  border-color: var(--faded-line);
  background: var(--faded);
  box-shadow: none;
}

.off .row-main,
.off .avatar,
.off .icon-tile,
.profile.off h1,
.profile.off .balance {
  opacity: 0.6;
}

.off .row-main strong {
  color: var(--faded-text);
}

/* "To deliver", "Waiting", "Paid" ...: small pills. */
.status {
  flex-shrink: 0;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status.waiting {
  background: var(--gold);
  color: var(--gold-text);
}

.status.done {
  background: var(--faded-line);
  color: var(--faded-text);
}

/* The "Delivered" stamp: a small rotated box, like an ink stamp. */
.stamp {
  flex-shrink: 0;
  padding: 3px 7px;
  border: 2px solid #8a8070;
  border-radius: 8px;
  color: var(--faded-text);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  transform: rotate(-6deg);
}

/* Amounts in the history: green for coins earned, red for coins spent. */
.amount {
  flex-shrink: 0;
  font-weight: 800;
}

.amount.plus {
  color: #3d7d45;
}

.amount.minus {
  color: var(--berry);
}

/* -------------------------------------------------------------- icons */

/* An icon on a soft coloured tile. */
.icon-tile {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--tile-cream);
}

.icon-tile img,
.icon-tile svg {
  width: 28px;
  height: 28px;
}

.icon-tile.small {
  width: 36px;
  height: 36px;
  border-radius: 11px;
}

.icon-tile.small img {
  width: 22px;
  height: 22px;
}

/* The big picture on a shop card. */
.icon-tile.big {
  width: 100%;
  height: 88px;
}

.icon-tile.big img {
  width: 46px;
  height: 46px;
}

.tint-green { background: var(--tile-green); }
.tint-peach { background: var(--tile-peach); }
.tint-blue { background: var(--tile-blue); }
.tint-pink { background: var(--tile-pink); }
.tint-cream { background: var(--tile-cream); }

/* "Daily" with a little sun under a quest. */
.repeat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #3f5a33;
  font-size: 13px;
  font-weight: 700;
}

/* ------------------------------------------------------ the quest board */

/* A wooden board with a dark frame... */
.board {
  display: grid;
  gap: 14px;
  margin: 0 -2px 8px;
  padding: 16px 12px;
  border: 3px solid var(--wood-frame);
  border-radius: 18px;
  background: var(--wood);
  box-shadow: 0 5px 0 var(--wood-edge);
  list-style: none;
}

/* ...with each quest on a paper note, a little crooked, held by a pin. */
.note {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 18px 16px 14px;
  border-radius: 8px;
  background: var(--note);
  box-shadow: 0 2px 0 var(--wood-frame);
  transform: rotate(-0.8deg);
}

.note:nth-child(3n + 2) {
  transform: rotate(0.6deg);
}

.note:nth-child(3n) {
  transform: rotate(-0.4deg);
}

/* The pin: berry red, every second one blue. Quests from players get gold pins. */
.note::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 50%;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border-radius: 50%;
  background: var(--berry);
}

.note:nth-child(even)::before {
  background: #4a7a8c;
}

.board.from-players .note::before {
  background: #d9a92e;
}

.note-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.note-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  color: var(--text);
  font-family: var(--heading-font);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: none;
}

.note-text {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.note-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

.note .hint {
  margin: 0;
  font-size: 13px;
}

/* The board when there is nothing on it: one empty note. */
.note.empty-note {
  color: var(--muted);
  text-align: center;
}

/* ------------------------------------------------------- the shop */

.shop-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0 -2px;
  padding: 0;
  list-style: none;
}

.shop-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 10px 12px;
  border: 2px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  box-shadow: 0 4px 0 var(--line-strong);
}

.shop-card h3 {
  margin: 0 4px;
  color: var(--text);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
}

.shop-card .card-text {
  flex: 1;
  margin: 0 4px;
  font-size: 13px;
}

.price {
  margin: 0 4px;
  color: var(--gold-text);
  font-size: 15px;
  font-weight: 800;
}

.shop-card .button {
  min-height: 44px;
  margin: auto 0 0;
  font-size: 15px;
}

/* Not enough coins yet: a dashed, faded card. */
.shop-card.short {
  border-style: dashed;
  border-color: var(--line-strong);
  background: #f3ecdc;
  box-shadow: none;
}

.shop-card.short .icon-tile {
  background: #ece5d5;
}

.shop-card.short .icon-tile img {
  opacity: 0.5;
  filter: grayscale(1);
}

.shop-card.short h3,
.shop-card.short .price {
  color: var(--faded-text);
}

.shop-card.short .button {
  padding: 10px 8px;
  font-size: 14px;
}

/* "60 coins to go" stays on one line. */
.to-go {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

/* ------------------------------------------------- the leaderboard */

.leaderboard .row {
  flex-wrap: nowrap;
}

.leaderboard .row-main {
  flex-basis: 0;
}

/* The place: a round badge with the number. */
.place {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--tile-green);
  color: var(--heading);
  font-family: var(--heading-font);
  font-size: 18px;
  font-weight: 700;
}

/* Your own row has a golden edge. */
.row.me {
  border-color: #e0c472;
}

/* ---------------------------------------------- the player menu bar */

/* Fixed to the bottom of the screen, as wide as the app. */
.player-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  width: 100%;
  max-width: 480px;
  height: var(--nav-height);
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 2px solid var(--line);
  background: var(--card);
  transform: translateX(-50%);
}

.player-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: #7a705e;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.player-nav a.current {
  color: var(--heading);
  font-weight: 800;
}

.player-nav a:hover {
  color: var(--heading);
}

/* --------------------------------------------------------- the admin */

/* The admin pages: a dark green bar at the top with the page's title. */
.admin-header {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  min-height: 96px;
  padding: 16px 16px 14px;
  background: var(--heading);
}

.admin-header a.back {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #3f5e4b;
  color: var(--card);
}

.admin-header a.back:hover {
  background: #4b6c57;
}

.admin-header .label {
  display: block;
  color: #c9d8c4;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.admin-header h1 {
  margin: 0;
  color: var(--card);
  font-size: 24px;
}

/* The admin menu: small pills, three in a row. Log out gets a row of its own. */
.admin-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: 12px 0 8px;
}

.admin-nav a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 4px 6px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--heading);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.admin-nav a.current {
  border-color: var(--moss);
  background: var(--moss);
  color: #ffffff;
}

.admin-nav form {
  grid-column: 1 / -1; /* 9 menu items = 3 full rows, then Log out below */
}

.admin-nav form .button {
  width: 100%;
  min-height: 40px;
  font-size: 13px;
}

/* A title row with a button on its right, like "New quest". */
.page-title {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin: 10px 0;
}

.page-title h1 {
  flex: 1;
  margin: 0;
}

/* The repeat choice: five buttons in one strip ("segments"). They are radio
   buttons underneath, so the form works without JavaScript. */
.segments {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  margin: 0;
  padding: 4px;
  border: none;
  border-radius: 14px;
  background: #efe6d2;
}

.segments label {
  position: relative;
  margin: 0;
}

.segments input,
.icon-picker input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segments span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  border-radius: 12px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.segments input:checked + span {
  background: var(--moss);
  color: #ffffff;
}

.segments input:focus-visible + span,
.icon-picker input:focus-visible + span {
  outline: 3px solid var(--berry);
  outline-offset: 1px;
}

/* The icon picker: 5 tiles in a row, the chosen one with a green frame. */
.icon-picker {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  border: none;
}

.icon-picker label {
  position: relative;
  margin: 0;
}

.icon-picker span {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 60px;
  border: 2px solid var(--line);
  border-radius: 16px;
  color: var(--text-soft);
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
}

.icon-picker img {
  width: 26px;
  height: 26px;
}

.icon-picker input:checked + span {
  border: 3px solid var(--moss);
}

.field-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 12px;
}

.field-row > div {
  display: grid;
  gap: 6px;
}

.field-row .field-label {
  margin-top: 10px;
}

/* The preview of a quest's icon and title in the admin form. */
.preview {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 12px;
  border: 2px dashed var(--line-strong);
  border-radius: 14px;
  background: var(--note);
  font-family: var(--heading-font);
  font-size: 15px;
  font-weight: 600;
}

.preview span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview .icon-tile {
  width: 30px;
  height: 30px;
  border-radius: 9px;
}

.preview .icon-tile img {
  width: 20px;
  height: 20px;
}

/* A group of choices in a form (repeats, icons): no frame, a label on top. */
fieldset {
  min-width: 0;
  margin: 10px 0 0;
  padding: 0;
  border: none;
}

legend {
  margin-bottom: 6px;
  padding: 0;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 800;
}

/* "Icon ........ 20 icons" */
.legend-row {
  display: flex;
  justify-content: space-between;
  width: 100%;
}

.legend-row .count {
  font-weight: 700;
}

fieldset .hint {
  margin: 6px 4px 0;
  font-size: 13px;
}

/* --------------------------------------------------- the style page */

.swatches {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.swatches li {
  font-size: 12px;
  font-weight: 700;
}

.swatches code {
  display: block;
  padding: 0;
  background: none;
  color: var(--muted);
  font-size: 11px;
}

.swatch {
  display: block;
  height: 46px;
  margin-bottom: 4px;
  border: 2px solid var(--line);
  border-radius: 12px;
}

.swatch-paper { background: #f6eedc; }
.swatch-card { background: #fbf6ea; }
.swatch-input { background: #fffdf7; }
.swatch-border { background: #e2d3b4; }
.swatch-text { background: #2e2b25; }
.swatch-muted { background: #6b6253; }
.swatch-heading { background: #2f4a3a; }
.swatch-moss { background: #4f6b3a; }
.swatch-gold { background: #f2d27a; }
.swatch-berry { background: #c0533e; }
.swatch-wood { background: #8e5e37; }
.swatch-sky { background: #dceae7; }
.swatch-mountain { background: #afc3bf; }
.swatch-hill { background: #86a271; }
.swatch-meadow { background: #6f8e4e; }
.swatch-pine { background: #35503d; }
.swatch-sun { background: #f3da8b; }

.font-sample {
  margin: 0 0 6px;
}

.font-sample.heading {
  color: var(--heading);
  font-family: var(--heading-font);
  font-size: 28px;
  font-weight: 700;
}

.font-sample.heading-light {
  font-family: var(--heading-font);
  font-size: 19px;
  font-weight: 600;
}

.font-sample.w500 { font-weight: 500; }
.font-sample.w800 { font-weight: 800; }

.icon-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: center;
}

.icon-grid li {
  display: grid;
  justify-items: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 700;
}

.scene-sample {
  overflow: hidden;
  margin-bottom: 12px;
  border: 2px solid var(--line);
  border-radius: 18px;
}

/* A short scene behind the sign-in sample, so the tall one fits the page. */
.scene-sample .scenery-tall {
  height: 260px;
}

/* -------------------------------------------- numbered steps (backup page) */

ol {
  padding-left: 1.4em;
}

ol li {
  margin-bottom: 6px;
}

/* ------------------------------------------------------ wide screens */

/* On a laptop the app is a phone-wide sheet of paper with a soft edge. */
@media (min-width: 520px) {
  .app {
    border-right: 2px solid var(--line);
    border-left: 2px solid var(--line);
  }
}

/* People who prefer less movement don't get the pressed-button wiggle. */
@media (prefers-reduced-motion: reduce) {
  .button:active,
  .key:active {
    transform: none;
  }
}
