* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; overscroll-behavior: none; }
:root { --ink: #26221e; --paper: #fffdf8; --muted: #7d7368; --sun: #ffd84d; --soft: #f3ecdd; --spring: cubic-bezier(0.3, 1.6, 0.5, 1); --out: cubic-bezier(0.2, 0.9, 0.3, 1); }
body {
  font: 600 13px/1.35 ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", system-ui, -apple-system, sans-serif;
  color: var(--ink); background: #e6dfd3;
  overflow: hidden; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%;
}
#floor { position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; overscroll-behavior: none; }
button { touch-action: manipulation; font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:focus-visible { outline: 3px solid var(--sun); outline-offset: 1px; border-radius: 10px; }
svg { display: block; width: 22px; height: 22px; fill: none; flex: none; } /* the interface icons, js/icons.js. They bring their own stroke: change the size, never the stroke */
.gf, :is(.on, [aria-pressed="true"], [aria-selected="true"], [aria-checked="true"]) > .go { display: none; } /* outline, and filled for what is on */
:is(.on, [aria-pressed="true"], [aria-selected="true"], [aria-checked="true"]) > .gf { display: block; }

/* Sticker look: ink outline, hard shadow. */
.sticker { background: var(--paper); border: 2px solid var(--ink); box-shadow: 0 4px 0 var(--ink); border-radius: 14px; }

/* who is shaping the product: one thin line, nothing to read */
#line { position: fixed; top: 0; left: 0; right: 0; height: 5px; display: flex; pointer-events: none; }
#line span { transition: flex-grow 0.4s; }

/* ---------- icon buttons ---------- */
#brand { position: fixed; top: calc(18px + env(safe-area-inset-top, 0px)); left: calc(16px + env(safe-area-inset-left, 0px)); padding: 5px 13px 6px; font-size: 19px; font-weight: 900; letter-spacing: -0.3px; white-space: nowrap; background: var(--sun); border: 2px solid var(--ink); border-radius: 12px; box-shadow: 0 4px 0 var(--ink); transition: transform 0.16s var(--spring), box-shadow 0.12s var(--out); }
#brand svg { display: inline-block; width: 18px; height: 18px; margin-left: 3px; vertical-align: -3px; transition: transform 0.16s; }
#brand[aria-expanded="true"] svg { transform: rotate(180deg); }
@media (hover: hover) { #brand:hover { transform: rotate(-2deg) scale(1.04); } } /* straight like the rest of the screen, a little tilt only under the mouse */
#brand:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
#top { position: fixed; top: calc(16px + env(safe-area-inset-top, 0px)); right: calc(14px + env(safe-area-inset-right, 0px)); display: flex; gap: 12px; pointer-events: none; }
#controls, #zoom { display: flex; padding: 2px; pointer-events: auto; }
#controls button, #zoom button { min-width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; transition: background-color 0.12s, transform 0.14s var(--out); }
#controls svg, #zoom svg { width: 24px; height: 24px; }
#zfit { min-width: 50px !important; font-size: 12px !important; }
@media (hover: hover) { #controls button:hover, #zoom button:hover, #menu button:hover { background: var(--soft); } }
#controls button:active, #zoom button:active { transform: scale(0.9); }
#controls #speed { min-width: 50px; } /* wide enough for 0.75×, so the buttons next to it do not move */
#pause.on { background: var(--sun); }
#pause.on.go { animation: paused 0.7s ease-in-out infinite alternate; } /* paused with two teams waiting is easy to miss, so the play button asks for a tap */
@keyframes paused { to { transform: scale(1.1); } }
:root.calm #pause.on.go { animation: none; } /* calm mode (js/settings.js): on by itself when the system asks for less motion */
#sound.off { color: #b0a698; }

/* ---------- the dock: three separate trays. People, office, tools ---------- */
#dock { position: fixed; left: 0; right: 0; bottom: 0; pointer-events: none; }
/* the row reaches above and below the trays, so figures can stand up and labels can hang without being cut */
#row { display: flex; gap: 14px; width: max-content; max-width: 100%; margin: 0 auto; padding: 62px 10px calc(26px + env(safe-area-inset-bottom, 0px)); overflow-x: auto; scrollbar-width: none; }
#row.drag, #row.drag * { cursor: grabbing !important; }
#row, .tools { flex-wrap: nowrap; } /* never two rows, at any size */
#row::-webkit-scrollbar { display: none; }
#row.moreR { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); }
#row.moreL { -webkit-mask-image: linear-gradient(270deg, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(270deg, #000 calc(100% - 40px), transparent); }
#row.moreL.moreR { -webkit-mask-image: linear-gradient(90deg, transparent, #000 40px calc(100% - 40px), transparent); mask-image: linear-gradient(90deg, transparent, #000 40px calc(100% - 40px), transparent); }
.group { position: relative; flex: none; padding: 5px 6px 11px; background: var(--paper); border: 2px solid var(--ink); box-shadow: 0 4px 0 var(--ink); border-radius: 18px; pointer-events: auto; }
.tools { display: flex; align-items: center; }
.tools button, .small { flex: none; }
.cap { position: absolute; left: 50%; bottom: -10px; transform: translateX(-50%) rotate(-1.5deg); font-size: 10px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; background: var(--ink); color: var(--paper); padding: 1px 9px; border-radius: 8px; pointer-events: none; }
.tool { position: relative; width: var(--tw, 52px); height: 56px; margin-top: -18px; display: grid; place-items: end center; }
.tool::before { content: ""; position: absolute; left: 7px; right: 7px; bottom: 2px; height: 14px; border-radius: 50%; background: var(--c, #ccc); opacity: 0.4; transition: transform 0.16s var(--spring), opacity 0.12s; }
.tool canvas { position: relative; display: block; pointer-events: none; transform: translateY(-4px); transform-origin: 50% 90%; transition: transform 0.16s var(--spring); margin: 0 -8px; filter: drop-shadow(0 0 0.8px rgba(38, 34, 30, 0.75)); }
@media (hover: hover) { .tool:hover canvas { transform: translateY(-9px) rotate(-4deg); } .tool:hover > svg { transform: translateY(-4px) rotate(-4deg); } }
.tool > svg { position: relative; width: 30px; height: 30px; margin-bottom: 14px; pointer-events: none; transform-origin: 50% 90%; transition: transform 0.16s var(--spring); } /* the hand: an icon, where the others are models */
.tool.on > svg { transform: translateY(-8px) scale(1.14); }
.tool.on::before { opacity: 1; transform: scale(1.12); box-shadow: 0 0 0 2px var(--ink); }
.tool.on canvas { transform: translateY(-13px) scale(1.14); }
.tool .count { position: absolute; top: -9px; right: 0; min-width: 19px; height: 19px; padding: 0 4px; border-radius: 10px; border: 2px solid var(--ink); color: #fff; font-size: 10px; font-weight: 800; line-height: 15px; text-align: center; font-variant-numeric: tabular-nums; z-index: 1; }
.tool .count.dark { color: var(--ink); }
.tool .count:empty { display: none; }
.small { width: 42px; height: 36px; border-radius: 12px; display: grid; place-items: center; }
@media (hover: hover) { .small:hover { background: var(--soft); } }
.small:disabled { opacity: 0.28; cursor: default; background: none; }
#size i { border-radius: 50%; background: var(--c, #26221e); border: 2px solid var(--ink); transition: width 0.2s var(--spring), height 0.2s var(--spring); }

#menu { position: fixed; padding: 4px; display: flex; flex-direction: column; z-index: 6; }
#menu button { text-align: left; padding: 9px 14px; border-radius: 10px; font-weight: 700; white-space: nowrap; }
#tip { position: fixed; transform: translate(-50%, -100%) rotate(-1deg); padding: 6px 11px; border-radius: 11px; box-shadow: 0 3px 0 var(--ink); font-size: 12px; white-space: nowrap; pointer-events: none; z-index: 5; text-align: center; }
#tip b { font-size: 13px; font-weight: 800; }
#tip.tap kbd { display: none; }
#tip kbd { font: 700 10px ui-monospace, monospace; background: var(--sun); border: 1.5px solid var(--ink); border-radius: 5px; padding: 0 4px; margin-left: 6px; }
#tip div { color: var(--muted); font-weight: 600; }

#menu { min-width: 200px; }
@media (max-height: 700px) { #menu { max-height: calc(100dvh - 76px); overflow-y: auto; } } /* a short screen: the last rows are scrolled to, never cut off */
#speeds { position: fixed; padding: 4px; display: flex; flex-direction: column; min-width: 104px; z-index: 6; } /* a drop-down under the speed button, like the menu */
#speeds button { display: flex; align-items: center; gap: 8px; padding: 8px 14px 8px 10px; border-radius: 10px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: left; }
#speeds button svg { width: 18px; height: 18px; visibility: hidden; }
#speeds button[aria-checked="true"] { font-weight: 900; }
#speeds button[aria-checked="true"] svg { visibility: visible; }
@media (hover: hover) { #speeds button:hover { background: var(--soft); } }
#menu button { display: flex; align-items: center; gap: 10px; } /* every row: its icon, its words, and its key at the end */
#menu button svg { order: -1; width: 20px; height: 20px; }
#menu button kbd { margin-left: auto; }
#menu button:disabled { opacity: 0.35; cursor: default; background: none; }
#menu hr { width: calc(100% - 16px); height: 2px; margin: 3px 8px; border: 0; background: #e4dbcc; }
#menu kbd, #about kbd { font: 700 11px ui-monospace, monospace; background: var(--soft); border: 1.5px solid var(--ink); border-radius: 5px; padding: 0 5px; margin-left: 4px; }

/* ---------- about ---------- */
/* ---------- the tour: a light on one part of the screen, the rest dimmed, and a card right next to the lit part ---------- */
#tourLight { position: fixed; z-index: 5; pointer-events: none; border-radius: 24px; border: 3px solid var(--sun); box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px var(--ink), 0 0 0 200vmax rgba(38, 34, 30, 0.5); transition: left 0.42s cubic-bezier(0.3, 1.2, 0.4, 1), top 0.42s cubic-bezier(0.3, 1.2, 0.4, 1), width 0.42s cubic-bezier(0.3, 1.2, 0.4, 1), height 0.42s cubic-bezier(0.3, 1.2, 0.4, 1); }
#tour { position: fixed; left: 0; top: 0; width: min(310px, calc(100vw - 16px)); padding: 12px 14px 8px; z-index: 7; transition: left 0.42s cubic-bezier(0.3, 1.2, 0.4, 1), top 0.42s cubic-bezier(0.3, 1.2, 0.4, 1); }
#tour.now, #tourLight.now { transition: none; }
/* a small tail on the card, pointing at what it talks about */
#tour::after { content: ""; position: absolute; left: var(--tail, 50%); width: 14px; height: 14px; margin-left: -9px; background: var(--paper); border: solid var(--ink); border-width: 0 2px 2px 0; }
#tour[data-side="over"]::after { bottom: -10px; transform: rotate(45deg); box-shadow: 3px 3px 0 var(--ink); }
#tour[data-side="under"]::after { top: -10px; transform: rotate(-135deg); }
#tour[data-side="right"]::after { left: -1px; top: 20px; transform: rotate(135deg); }
#tour[data-side="in"]::after { display: none; }
#tour #tourK { display: block; margin: 0 34px 1px 0; font-size: 12px; font-weight: 800; color: var(--muted); } /* which game: Free Play or Versus the Computer */
#tour h3 { margin: 0 34px 2px 0; font-size: 18px; font-weight: 900; letter-spacing: -0.2px; }
#tour h3 svg { display: none; width: 20px; height: 20px; margin-left: 6px; vertical-align: -3px; color: #17b581; }
#tour.ok h3 svg { display: inline-block; }
#tour p { margin: 0; font-size: 14px; font-weight: 600; line-height: 1.35; color: var(--muted); }
#tour footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
#tour button { min-width: 44px; height: 38px; padding: 0 12px; border-radius: 11px; font-weight: 800; font-size: 14px; }
#tourB:disabled { opacity: 0.3; cursor: default; }
#tour #tourX { position: absolute; top: 4px; right: 4px; min-width: 38px; padding: 0; display: grid; place-items: center; }
#tour .dots { display: flex; gap: 6px; }
#tour .dots i { width: 7px; height: 7px; border-radius: 50%; background: #d9cfbf; transition: transform 0.16s var(--spring); }
#tour .dots i.on { background: var(--ink); transform: scale(1.35); }
@media (hover: hover) { #tourB:not(:disabled):hover, #tourX:hover { background: var(--soft); } }
:root.calm #tour, :root.calm #tourLight { transition: none; }
.touring #start, .touring #toast, .touring #undo { visibility: hidden; } /* one thing at a time: the tour talks, the rest waits */
#about { width: min(560px, calc(100vw - 28px)); max-height: calc(100dvh - 40px); padding: 22px 24px 18px; color: inherit; background: var(--paper); border: 2px solid var(--ink); border-radius: 20px; box-shadow: 0 6px 0 var(--ink); overflow: auto; }
#about::backdrop { background: rgba(38, 34, 30, 0.4); }
#about h2 { margin: 0; }
#about p { margin: 12px 0 14px; font-size: 16px; font-weight: 700; }
#keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 5px 16px; margin: 0; font-size: 12px; }
#keys div { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
#keys.touch { grid-template-columns: 1fr; font-size: 15px; gap: 8px; }
#keys dd { margin: 0; white-space: nowrap; }
#keys dt.h { grid-column: 1 / -1; margin-top: 8px; font-size: 10px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
#about footer { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; }
#about a { color: inherit; font-weight: 800; }
#about footer button { min-height: 40px; padding: 0 18px; }

/* ---------- the first screen, on an empty floor (js/start.js). Only its buttons take the mouse, the rest is floor you can paint ---------- */
/* Two steps. First: a heading, one line, one yellow button, and three quiet ones. Second, behind "More fights": the ready-made fights */
#start { position: fixed; left: calc(12px + env(safe-area-inset-left, 0px)); right: calc(12px + env(safe-area-inset-right, 0px)); top: calc(68px + env(safe-area-inset-top, 0px)); bottom: calc(var(--dock, 150px) - 8px); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; pointer-events: none; }
#start1, #start2 { display: flex; flex-direction: column; align-items: center; width: 100%; }
#start h1 { margin: 0; font-size: 54px; line-height: 1.05; font-weight: 900; letter-spacing: -1.4px; }
#start p { margin: 10px 0 26px; max-width: 40em; font-size: 18px; line-height: 1.35; color: #6b6157; text-wrap: balance; }
#start button { pointer-events: auto; }
.asked #start { background: rgba(253, 248, 238, 0.86); border-radius: 20px; } /* More fights from the menu, over a fight: the floor goes quiet behind the cards */
#startGo { display: flex; align-items: center; gap: 12px; min-height: 68px; padding: 4px 26px 6px 16px; font-size: 20px; font-weight: 900; background: var(--sun); transition: transform 0.16s var(--spring), box-shadow 0.12s var(--out); }
#startGo .pic { display: flex; align-items: center; height: 58px; }
#startQ { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 4px; margin-top: 16px; }
#startQ button, #startBk { min-height: 44px; padding: 0 12px; font-size: 15px; }
#start h2 { margin: 0 0 14px; font-size: 26px; line-height: 1.1; font-weight: 900; letter-spacing: -0.5px; }
#startBk { margin-top: 12px; }
#startL { display: grid; grid-template-columns: repeat(5, minmax(0, 172px)); gap: 12px; }
#startL button { padding: 8px 4px 10px; font-size: 14px; font-weight: 800; transition: transform 0.16s var(--spring), box-shadow 0.12s var(--out); }
#start button:focus-visible { outline: 3px solid var(--ink); outline-offset: 5px; border-radius: 14px; } /* ink, because a yellow ring does not show on a yellow card */
#startL b { display: block; line-height: 1.2; }
#startL .pic { display: flex; align-items: center; justify-content: center; height: 78px; max-width: 164px; margin: 0 auto; }
#start canvas { filter: drop-shadow(0 0 0.8px rgba(38, 34, 30, 0.75)); margin: 0 -2px; transition: transform 0.16s var(--spring); }
#start canvas.pix { image-rendering: pixelated; filter: none; margin: 0; }
#startL .pic.all { display: grid; grid-template-columns: repeat(4, 34px); grid-auto-rows: 37px; justify-items: center; justify-content: center; align-content: center; align-items: center; padding-bottom: 5px; }
#start em { font-style: normal; font-size: 13px; font-weight: 900; margin: 0 5px; }
#startL i { display: grid; place-items: center; width: 34px; height: 34px; margin: 0 3px; border: 2px dashed var(--ink); border-radius: 50%; font-size: 18px; font-weight: 900; font-style: normal; background: var(--soft); }
#startL i:nth-child(2) { transform: translateY(-9px); }
@media (hover: hover) { #startL button:hover, #startGo:hover { transform: translateY(-3px) rotate(-1deg); } #startL button:hover canvas, #startGo:hover canvas { transform: translateY(-3px); } #startQ button:hover, #startBk:hover { background: var(--soft); } }
#startL button:active, #startGo:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
#start.bye { opacity: 0; transition: opacity 0.12s; }
/* a small sticker that points at the people */
#nudge { position: fixed; padding: 6px 14px 7px; font-size: 15px; font-weight: 800; white-space: nowrap; pointer-events: none; background: var(--paper); box-shadow: 0 3px 0 var(--ink); }
#nudge::after { content: ""; position: absolute; left: var(--tail, 50%); bottom: -9px; width: 12px; height: 12px; margin-left: -8px; background: inherit; border: solid var(--ink); border-width: 0 2px 2px 0; transform: rotate(45deg); box-shadow: 2px 2px 0 var(--ink); }
#nudge.far::after { display: none; }
.nudging:has(#nudge.far) #tabs button:first-child:not([aria-selected="true"]) { background: var(--sun); border-color: var(--ink); }
.starting.starting #undo { bottom: auto; top: calc(72px + env(safe-area-inset-top, 0px)); } /* after a clear: over the first screen, away from its buttons */
@media (max-width: 699px), (max-height: 480px) { /* a phone: the undo bar stays just over the trays, where the messages sit, and never covers the heading */
  .starting.starting #undo { top: auto; bottom: calc(var(--dock, 190px) + 2px); white-space: nowrap; padding: 3px 4px 3px 13px; gap: 10px; }
  .starting.starting #undo button { min-height: 36px; margin-bottom: 0; } /* one short line, so it stays clear of the quiet buttons on the smallest phones */
  .starting:has(#undo:not([hidden])) #startBy { visibility: hidden; } /* the one line it could touch, for its few seconds */
}
@media (max-width: 1000px) { #startL { gap: 8px; } #startL button { font-size: 13px; } #startL .pic.all { grid-template-columns: repeat(4, 30px); } }
@media (max-width: 699px) { /* a phone: the fights are two in a row */
  #start { top: calc(60px + env(safe-area-inset-top, 0px)); }
  #start h1 { font-size: 34px; letter-spacing: -0.8px; }
  #start p { margin: 6px 0 18px; font-size: 15px; }
  #startGo { min-height: 60px; font-size: 18px; padding: 4px 20px 6px 12px; } #startGo .pic { height: 50px; }
  #startQ { margin-top: 12px; } #startQ button, #startBk { padding: 0 9px; font-size: 14px; }
  #start h2 { margin-bottom: 10px; font-size: 22px; }
  #startL { grid-template-columns: 1fr 1fr; gap: 10px 8px; width: 100%; max-width: 380px; }
  #startL button:last-child:nth-child(odd) { grid-column: 1 / -1; justify-self: center; width: calc(50% - 4px); }
  #startL .pic { height: 48px; }
  #startL .pic.all { grid-template-columns: repeat(4, 26px); grid-auto-rows: 24px; }
  #startL button { padding: 4px 4px 8px; }
  #startBk { margin-top: 6px; }
}
@media (max-height: 640px) and (max-width: 699px) { #startL { gap: 6px 8px; } #startL i { width: 28px; height: 28px; font-size: 15px; } #start h1 { font-size: 28px; } #start p { font-size: 14px; line-height: 1.25; margin-bottom: 12px; } #start h2 { font-size: 18px; margin-bottom: 6px; } #startL .pic { height: 42px; } #startL .pic.all { grid-auto-rows: 21px; } #startBk { margin-top: 2px; } }
@media (max-height: 640px) and (min-width: 700px) { #start h1 { font-size: 36px; } #start p { margin: 4px 0 14px; font-size: 16px; } #startL .pic { height: 64px; } #startQ { margin-top: 8px; } }
@media (max-height: 480px) { /* a phone on its side: the same, smaller, under the top row */
  #start { top: calc(56px + env(safe-area-inset-top, 0px)); bottom: calc(var(--dock, 100px) - 14px); padding-bottom: 66px; } /* a little high, so the first sticker over the people fits under it */
  #start h1 { font-size: 30px; line-height: 1; }
  #start p { margin: 4px 0 10px; font-size: 14px; line-height: 18px; }
  #startGo { min-height: 52px; font-size: 16px; } #startGo .pic { height: 44px; }
  #startQ { margin-top: 4px; }
  #start h2 { margin: 0 0 6px; font-size: 18px; }
  #startL { grid-template-columns: repeat(5, minmax(0, 138px)); gap: 8px; width: 100%; max-width: none; justify-content: center; }
  #startL button:last-child:nth-child(odd) { grid-column: auto; justify-self: stretch; width: auto; }
  #startL button { padding: 4px 2px 7px; font-size: 12px; }
  #startL .pic { height: 56px; max-width: 118px; }
  #startL .pic.all { grid-template-columns: repeat(4, 27px); grid-auto-rows: 25px; padding-bottom: 6px; }
  #startL i { width: 28px; height: 28px; font-size: 15px; margin: 0 2px; }
  #startL i:nth-child(2) { transform: translateY(-6px); }
  #start em { font-size: 11px; margin: 0 3px; }
  #start canvas { margin: 0 -4px; }
  #startBk { margin-top: 0; }
}
@media (max-height: 480px) and (max-width: 760px) { #startL button { font-size: 11px; } }
:root.calm #start button, :root.calm #start canvas, :root.calm #start.bye { transition: none; }

/* ---------- moments ---------- */
#combo { position: fixed; left: 0; top: 0; pointer-events: none; text-align: center; opacity: 0; white-space: nowrap; font-weight: 900; line-height: 0.95; -webkit-text-stroke: 7px var(--ink); paint-order: stroke fill; }
#combo b { display: block; font-size: 20px; color: #fff; letter-spacing: 0.5px; }
#combo i { display: block; font-style: normal; font-size: 46px; color: var(--c); letter-spacing: -1px; }
#toast { position: fixed; top: calc(20px + env(safe-area-inset-top, 0px)); left: 50%; display: flex; align-items: center; gap: 10px; padding: 7px 20px 8px 8px; border-radius: 18px; background: var(--c); pointer-events: none; translate: -50% 0; max-width: calc(100vw - 24px); }
#toast .pic { flex: none; width: 46px; height: 46px; border-radius: 50%; background: var(--paper); border: 2px solid var(--ink); display: grid; place-items: center; }
#toast b { display: block; font-size: 19px; font-weight: 900; line-height: 1.1; letter-spacing: 0.2px; color: #fff; -webkit-text-stroke: 4.5px var(--ink); paint-order: stroke fill; }
#toast small { display: block; font-size: 13px; font-weight: 800; color: var(--t, #fff); margin-top: 2px; }
#undo { position: fixed; left: 50%; bottom: calc(132px + env(safe-area-inset-bottom, 0px)); translate: -50% 0; display: flex; gap: 12px; align-items: center; padding: 5px 6px 5px 15px; }
#undo button { padding: 5px 13px; margin-bottom: 3px; }

#win { position: fixed; left: 50%; top: 13%; translate: -50% 0; width: min(760px, calc(100vw - 28px)); text-align: center; pointer-events: none; }
#win h1 { margin: 0; font-size: clamp(44px, 8vw, 92px); line-height: 0.95; font-weight: 900; letter-spacing: -2px; color: var(--c); -webkit-text-stroke: 13px var(--ink); paint-order: stroke fill; rotate: -2deg; }
#win p { display: inline-block; margin: 16px 0 12px; padding: 5px 15px; font-size: clamp(14px, 2.2vw, 18px); font-weight: 800; background: var(--paper); border: 2px solid var(--ink); border-radius: 14px; }

/* ---------- smaller windows ---------- */
.name, #tabbar { display: none; }
@media (max-width: 1460px) { .tool { --tw: 44px; } #row { gap: 10px; } .small { width: 38px; } } /* nine teams: at 1440 the bigger icons ran past the edge */
@media (max-width: 1180px) { .tool { --tw: 37px; } .tool canvas { width: 52px !important; height: 52px !important; } }
@media (max-width: 1000px) { #toast { top: calc(72px + env(safe-area-inset-top, 0px)); } }
@media (min-width: 1001px) and (max-width: 1400px) and (min-height: 481px) { .run #toast { top: calc(72px + env(safe-area-inset-top, 0px)); } } /* against the computer the money chip reaches the middle */
/* phones and tablets: a strip you swipe, with tabs. Every icon has its name under it */
@media (max-width: 1032px), (max-width: 1400px) and (pointer: coarse) {
  /* one strip with the three trays side by side, always one row. What does not fit, you swipe. The tabs jump to each part */
  #row { width: 100%; gap: 8px; padding: 22px calc(8px + env(safe-area-inset-right, 0px)) 7px calc(8px + env(safe-area-inset-left, 0px)); overscroll-behavior-x: contain; pointer-events: auto; touch-action: pan-x; -webkit-overflow-scrolling: touch; } /* the strip itself has to take touches: on an iPhone a scroller that lets them through does not swipe */
  #row button { touch-action: pan-x; }
  .group { padding: 2px 6px 4px; }
  .group::after { content: ""; position: absolute; z-index: -1; inset: -2px -10px -9px; } /* the gaps between the trays swipe the strip too, not the canvas */
  .group:first-child { margin-left: auto; }
  .group:last-child { margin-right: auto; }
  #basics { display: contents; }
  .cap { display: none; }
  .tool, .small { width: 64px; height: 62px; margin: 0; padding-bottom: 15px; position: relative; display: grid; place-items: end center; border-radius: 12px; }
  .small { place-items: center; padding-bottom: 12px; }
  .tool canvas { width: 50px !important; height: 50px !important; transform: translateY(-1px); }
  .tool::before { left: 50%; right: auto; width: 42px; margin-left: -21px; bottom: 16px; height: 12px; }
  .tool.on canvas { transform: translateY(-5px) scale(1.1); }
  .tool > svg { margin-bottom: 7px; } .tool.on > svg { transform: translateY(-3px) scale(1.1); }
  .tool .count { top: 1px; right: calc(50% - 31px); }
  .name { display: block; position: absolute; left: -2px; right: -2px; bottom: 1px; font-size: 11px; font-weight: 700; line-height: 14px; text-align: center; white-space: nowrap; pointer-events: none; }
  .tool.on .name { left: 50%; right: auto; transform: translateX(-50%); padding: 0 6px; font-weight: 900; background: var(--sun); border-radius: 6px; }
  #tabbar { display: flex; gap: 6px; padding: 0 calc(8px + env(safe-area-inset-right, 0px)) calc(9px + env(safe-area-inset-bottom, 0px)) calc(8px + env(safe-area-inset-left, 0px)); justify-content: center; }
  #tabs { display: flex; gap: 6px; flex: 0 1 320px; pointer-events: auto; }
  #undoT { flex: none; width: 48px; height: 44px; display: grid; place-items: center; border-radius: 13px; background: rgba(255, 253, 248, 0.86); pointer-events: auto; }
  #undoT:disabled svg { opacity: 0.28; }
  /* tapping the tab you are on puts the tray away, so you can watch */
  #dock.shut #row { display: none; }
  #dock.shut #tabs button[aria-selected="true"] { background: rgba(255, 253, 248, 0.86); color: inherit; }
  #controls button { min-width: 41px; height: 44px; }
  #zoom button { min-width: 40px; height: 44px; }
  #brand { min-height: 44px; }
  #menu button { min-height: 44px; font-size: 15px; }
  #tour button { height: 44px; } #tour #tourX { min-width: 44px; }
  #speeds button { min-height: 44px; font-size: 15px; }
  #menu kbd { display: none; }
  #undo button, #about footer button { min-height: 44px; padding: 0 18px; }
  #about a { display: inline-grid; align-items: center; min-height: 44px; }
  #tabs button { flex: 1 1 0; height: 44px; border-radius: 13px; border: 2px solid transparent; font-size: 14px; font-weight: 800; background: rgba(255, 253, 248, 0.86); position: relative; display: flex; align-items: center; justify-content: center; gap: 6px; }
  #tabs svg { order: -1; width: 20px; height: 20px; } /* each tab: its icon, filled on the one you are on, then its word */
  #tabs button[aria-selected="true"] { background: var(--ink); color: var(--paper); }
  #tabs i { position: absolute; top: 4px; right: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--c); border: 1.5px solid #fff; box-shadow: 0 0 0 1.5px var(--ink); visibility: hidden; }
  #tabs .has i { visibility: visible; } /* the tray that holds the brush you are using */
  #undo { bottom: calc(var(--dock, 190px) + 8px); }
}
@media (max-width: 640px) {
  #zoom { display: none; } /* pinch does it */
  #brand { font-size: 17px; padding: 4px 10px 5px; }
  #toast { top: calc(80px + env(safe-area-inset-top, 0px)); width: max-content; }
  #win { top: 16%; }
}
/* the smallest phones: the logo and the play controls met in the middle. Both move out a little and the logo is a size smaller. Nothing gets shorter than 44 */
@media (max-width: 340px) {
  #brand { left: calc(10px + env(safe-area-inset-left, 0px)); font-size: 16px; padding: 4px 8px 5px; }
  #brand svg { margin-left: 3px; }
  #top { right: calc(10px + env(safe-area-inset-right, 0px)); }
}
@media (max-width: 1032px) and (max-height: 480px) { /* a phone on its side: tabs and tray share one row */
  #dock { display: flex; align-items: stretch; }
  #row { order: 2; flex: 1 1 0; width: auto; min-width: 0; padding: 18px calc(8px + env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) 6px; }
  .group:first-child { margin-left: 0; }
  #tabbar { order: 1; flex-direction: column; justify-content: flex-end; gap: 0; padding: 10px 0 calc(12px + env(safe-area-inset-bottom, 0px)) calc(8px + env(safe-area-inset-left, 0px)); }
  #tabs { flex: none; gap: 2px; background: rgba(255, 253, 248, 0.86); border-radius: 13px; padding: 2px; }
  #tabs button { flex: none; width: 66px; height: 44px; font-size: 11px; background: none; flex-direction: column; gap: 0; line-height: 13px; } /* on its side: the icon over the word */
  #tabs svg { width: 18px; height: 18px; }
  #tabs i { top: 3px; right: 8px; }
  #undoT { position: fixed; right: calc(14px + env(safe-area-inset-right, 0px)); top: calc(76px + env(safe-area-inset-top, 0px)); background: var(--paper); border: 2px solid var(--ink); box-shadow: 0 3px 0 var(--ink); }
  .tool, .small { height: 54px; padding-bottom: 14px; }
  .tool canvas { width: 42px !important; height: 42px !important; margin: 0 -8px !important; }
  .name { font-size: 10px; }
  #zoom { display: none; }
  #toast { top: calc(12px + env(safe-area-inset-top, 0px)); padding: 3px 14px 4px 5px; max-width: calc(100vw - 400px); }
  #toast .pic { width: 36px; height: 36px; } #toast .pic canvas { width: 34px !important; height: 34px !important; }
  #toast b { font-size: 15px; -webkit-text-stroke-width: 3.5px; } #toast small { font-size: 11px; margin-top: 0; }
  #win { top: 8px; width: min(440px, calc(100vw - 390px)); }
  #win h1 { font-size: 38px; -webkit-text-stroke-width: 9px; }
  #win p { margin: 7px 0 6px; padding: 3px 11px; font-size: 13px; }
  #tour { width: 290px; padding: 8px 12px 4px; } /* a phone on its side: a smaller card */
  #tour p { font-size: 13px; }
  #menu { max-height: calc(100dvh - 76px); overflow-y: auto; }
}
.tool.hit:not(.on)::before { opacity: 1; box-shadow: 0 0 0 2px var(--ink); animation: hit 0.5s ease-in-out infinite alternate; }
.tool.hit:not(.on) canvas { transform: translateY(-6px); }
@keyframes hit { to { transform: scale(1.25); } }
.who { display: flex; justify-content: center; align-items: center; margin-top: 3px; }
.who img { width: 26px; height: 26px; margin: 0 -1px; }
.who em { font-style: normal; font-size: 11px; font-weight: 800; background: var(--sun); border-radius: 7px; padding: 1px 8px; }
@media (max-width: 760px) and (max-height: 480px) { #tabs button { width: 54px; } }
:root.calm .tool.hit::before { animation: none !important; } :root.calm .tool canvas, :root.calm .tool > svg, :root.calm .tool::before, :root.calm #size i, :root.calm #line span { transition: none; }

/* pixel art: the switch in the menu, and icons with hard edges */
#pixelM::after { content: ''; width: 18px; height: 18px; border: 2px solid var(--ink); border-radius: 5px; background: var(--paper, #fffdf8); }
#pixelM[aria-checked="true"]::after { background: var(--ink); box-shadow: inset 0 0 0 3px #ffd84d; }
.tool canvas.pix, #toast canvas.pix { image-rendering: pixelated; filter: none; }
@media (pointer: coarse) { #pixelM { min-height: 44px; } }

/* ---------- against the computer (js/run.js) ---------- */
/* the chip: money and the level. Next to the logo, or under it when there is no room */
#run { position: fixed; top: calc(16px + env(safe-area-inset-top, 0px)); left: calc(204px + env(safe-area-inset-left, 0px)); display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px 0 12px; white-space: nowrap; z-index: 2; }
#runM { display: inline-block; font-size: 19px; font-weight: 900; font-variant-numeric: tabular-nums; color: #1f8a4c; }
#runW { font-size: 14px; font-weight: 800; }
#runG { display: flex; flex-direction: column; gap: 3px; width: 76px; }
#runN { font-size: 11px; font-weight: 800; line-height: 1; color: #6b5f52; }
#runG i { display: block; height: 7px; border-radius: 4px; background: rgba(38, 34, 30, 0.12); box-shadow: inset 0 0 0 1.5px #26221e; overflow: hidden; }
#runB { display: block; height: 100%; width: 0; background: #ffd84d; box-shadow: inset -1.5px 0 0 #26221e; transition: width 0.3s ease-out; }
@media (max-width: 900px), (max-height: 480px) { /* phones and small tablets: a smaller chip that stays out of the office (up to 900 wide it would run into the zoom buttons). The round's name is said when a round closes */
  #run { top: calc(69px + env(safe-area-inset-top, 0px)); left: calc(14px + env(safe-area-inset-left, 0px)); height: 34px; gap: 8px; padding: 0 11px 0 10px; }
  #runM { font-size: 17px; } #runW { font-size: 13px; }
  #runN { display: none; } #runG { width: 36px; } #runG i { height: 6px; }
}
@media (max-height: 480px) { /* a phone on its side: the chip sits on the top row, next to the logo, and the messages just under that row */
  #run { top: calc(13px + env(safe-area-inset-top, 0px)); left: calc(198px + env(safe-area-inset-left, 0px)); }
  .run #toast { top: calc(62px + env(safe-area-inset-top, 0px)); max-width: calc(100vw - 28px); }
}
@media (max-height: 480px) and (max-width: 700px) { #runG { display: none; } } /* the smallest phones on their side: no room for the bar between the logo and the controls */
@media (max-width: 1000px) and (min-height: 481px) { .run #toast { top: calc(128px + env(safe-area-inset-top, 0px)); } }
/* prices on the brushes, and the brushes of the crowd */
.price { display: none; }
.run .tool .price { display: block; position: absolute; bottom: -5px; left: 50%; translate: -50% 0; min-width: 19px; height: 19px; padding: 0 4px; border-radius: 10px; border: 2px solid var(--ink); background: var(--paper); font-size: 10px; font-weight: 800; line-height: 15px; text-align: center; font-variant-numeric: tabular-nums; z-index: 1; }
.run .tool.poor canvas { opacity: 0.35; }
.run .tool.poor .price { background: #ffd0d0; }
.run .tool.norun { display: none; }
#menu #leaveM, .run #vsM, .run #restart, .run #moreM, .run #demo, .run #gen, .run #genM, .run #clearPeople, .run #clearAll, .run #menu hr:first-of-type { display: none; }
.run #menu #leaveM { display: flex; }
/* an office from a link: the way back to your own, or keep it. After keeping it, the way back to the one before. A run has no link */
#menu #mineM, #menu #keepM, #menu #oldM, .run #shareM { display: none; }
.link:not(.run) #menu #mineM, .link:not(.run) #menu #keepM, .kept:not(.link):not(.run) #menu #oldM { display: flex; }
/* the end of a run: again, or back to the free canvas */
/* the screen before a run: one line, the rules, your best, and Start */
#vs { width: min(440px, calc(100vw - 28px)); max-height: calc(100dvh - 24px); padding: 20px 20px 18px; color: inherit; background: var(--paper); border: 2px solid var(--ink); border-radius: 20px; box-shadow: 0 6px 0 var(--ink); overflow: auto; }
#vs::backdrop { background: rgba(38, 34, 30, 0.4); }
#vs h2 { margin: 0 44px 14px 0; }
#vsX { position: absolute; top: 8px; right: 8px; width: 44px; height: 44px; display: grid; place-items: center; }
#vsD { margin: 0 0 10px; font-size: 14px; font-weight: 600; line-height: 1.3; color: var(--muted); }
/* the rules: four short lines, a small picture in front of each */
#vsR { margin: 0 0 14px; padding: 10px 12px; list-style: none; display: grid; gap: 7px; border-radius: 14px; background: var(--soft); }
#vsR li { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; line-height: 1.25; }
#vsR i { flex: none; width: 22px; height: 22px; display: grid; place-items: center; font-style: normal; }
#vsR .m { color: #1f8a4c; }
#vsR .r::before { content: ""; width: 14px; height: 11px; background: #ef4d43; clip-path: polygon(0 0, 100% 0, 50% 100%); filter: drop-shadow(0 0 0.8px var(--ink)) drop-shadow(0 0 0.8px var(--ink)); }
#vs footer { display: flex; align-items: center; gap: 4px; padding-bottom: 3px; }
#vs footer button { min-height: 44px; padding: 0 12px; border-radius: 11px; font-weight: 800; white-space: nowrap; }
#vsH { margin-right: auto; }
#vsB { margin: -4px 0 10px; font-size: 13px; font-weight: 700; color: var(--muted); }
#vsB:empty { display: none; }
#vs #vsGo { min-width: 104px; margin-left: 6px; font-size: 16px; }
@media (max-height: 480px) { /* a phone on its side: wider and lower, the rules two by two, so Start is on screen without a swipe */
  #vs { width: min(580px, calc(100vw - 28px)); padding: 12px 16px 12px; }
  #vs h2 { margin-bottom: 8px; font-size: 18px; }
  #vsD { margin-bottom: 6px; }
  #vsR { grid-template-columns: 1fr 1fr; gap: 5px 12px; padding: 7px 10px; margin-bottom: 8px; }
}
@media (max-width: 380px) { #vs { padding-left: 16px; padding-right: 16px; } #vs footer button { padding: 0 8px; } #vs #vsGo { min-width: 84px; } }
@media (hover: hover) { #vsX:hover, #vsH:hover { background: var(--soft); } }
@media (max-width: 1032px), (max-width: 1400px) and (pointer: coarse) { .run .tool .price { bottom: auto; top: 1px; left: calc(50% - 31px); translate: none; } } /* the name is under the icon there */

/* ---------- phones: what is said is small and sits just over the trays, so it never covers the fight ---------- */
@media (max-width: 640px), (max-height: 480px) {
  #toast, .run #toast { top: auto; bottom: calc(var(--dock, 150px) - 8px); gap: 7px; width: max-content; max-width: calc(100vw - 20px); padding: 3px 12px 4px 4px; border-radius: 13px; box-shadow: 0 3px 0 var(--ink); }
  #toast .pic { width: 30px; height: 30px; } #toast .pic canvas { width: 28px !important; height: 28px !important; }
  #toast b { font-size: 13px; line-height: 1.15; letter-spacing: 0; -webkit-text-stroke-width: 3px; }
  #toast small { font-size: 11px; line-height: 1.2; margin-top: 0; }
  :root:has(#undo:not([hidden])) #toast { bottom: calc(var(--dock, 150px) + 60px); } /* the undo bar is there for a moment */
  :root:has(#upB:not([hidden])) #toast { bottom: calc(var(--dock, 150px) + 52px); } /* and over the sticker that buys a rank */
}

/* ---------- phones: the top is one thin row. The logo is a small mark (still the menu), sound is in the menu, and in a run the money sits between them ---------- */
#brand b { display: none; }
@media (max-width: 640px), (max-height: 480px) {
  #brand { top: calc(8px + env(safe-area-inset-top, 0px)); left: calc(8px + env(safe-area-inset-left, 0px)); min-width: 46px; height: 44px; min-height: 44px; padding: 0 5px 1px; font-size: 18px; letter-spacing: -0.5px; box-shadow: 0 3px 0 var(--ink); }
  #brand span { display: none; }
  #brand svg { width: 12px; height: 12px; margin-left: 0; vertical-align: -1px; } /* a small arrow: it says the mark opens something */
  #brand b { display: inline; font-weight: 900; }
  #top { top: calc(6px + env(safe-area-inset-top, 0px)); right: calc(8px + env(safe-area-inset-right, 0px)); }
  #controls { box-shadow: 0 3px 0 var(--ink); }
  #controls #sound { display: none; }
  #run { top: calc(11px + env(safe-area-inset-top, 0px)); left: calc(70px + env(safe-area-inset-left, 0px)); height: 38px; max-width: calc(100vw - 183px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)); box-shadow: 0 3px 0 var(--ink); }
  #runW { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  #undoT { top: calc(66px + env(safe-area-inset-top, 0px)); }
}
@media (max-width: 640px) and (min-height: 481px) { #run.long #runG { display: none; } } /* "Paint your team" needs the room of the bar, and there is nothing in the bar yet */
@media (max-width: 370px) and (min-height: 481px) { /* the smallest phones: no room for the bar. The round's name is said when a round closes */
  #runG { display: none; }
  #run.long #runW { white-space: normal; font-size: 11px; line-height: 1.1; }
}
@media (max-width: 340px) and (min-height: 481px) { #run { gap: 6px; padding: 0 8px; } #runM { font-size: 15px; } }

/* how to put the game on the home screen of an iPhone or iPad: two steps, each with the icon Safari shows */
#home { width: min(360px, calc(100vw - 28px)); max-height: calc(100dvh - 24px); padding: 20px 20px 16px; color: inherit; background: var(--paper); border: 2px solid var(--ink); border-radius: 20px; box-shadow: 0 6px 0 var(--ink); overflow: auto; }
#home::backdrop { background: rgba(38, 34, 30, 0.4); }
#home h2 { margin: 0 44px 16px 0; }
#homeX { position: absolute; top: 8px; right: 8px; width: 44px; height: 44px; display: grid; place-items: center; }
#home ol { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; font-size: 16px; font-weight: 700; }
#home li { display: flex; align-items: center; gap: 12px; }
#home li i { flex: none; display: grid; place-items: center; width: 44px; height: 44px; background: var(--soft); border: 2px solid var(--ink); border-radius: 12px; }
#home li svg { width: 24px; height: 24px; }
#home li b { font-weight: 900; }
#home li small { display: block; margin-top: 1px; font-size: 13px; font-weight: 600; color: var(--muted); }
#home p { margin: 14px 0 0; font-size: 14px; font-weight: 600; color: var(--muted); }
@media (max-width: 640px) and (min-height: 481px) { #home { margin-top: calc(64px + env(safe-area-inset-top, 0px)); } } /* at the top on a phone: the sheet of Safari comes up from the bottom, and the steps stay in view */
@media (hover: hover) { #homeX:hover { background: var(--soft); } }
/* ---------- one look. The rules are in CLAUDE.md, under "One look" ---------- */
/* the main button of a screen: a yellow sticker. One on a screen. (#startGo and #again are the same, bigger) */
#vs #vsGo, #tour #tourN, #about footer button, #undo button { color: var(--ink); background: var(--sun); border: 2px solid var(--ink); border-radius: 14px; box-shadow: 0 3px 0 var(--ink); font-weight: 900; }
#vs #vsGo:active, #tour #tourN:active, #about footer button:active, #undo button:active { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
/* a quiet button: plain underlined words */
#startQ button, #startBk, #vsH, #tour #tourB, #about a { font-weight: 800; text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 2px; border-radius: 11px; }
/* close: a cross at the top right */
#vsX, #homeX, #tour #tourX { border-radius: 12px; }
/* the title of a box: a yellow tag, a little turned */
#about h2, #vs h2, #home h2 { display: inline-block; padding: 3px 13px 5px; font-size: 22px; font-weight: 900; letter-spacing: -0.4px; background: var(--sun); border: 2px solid var(--ink); border-radius: 13px; transform: rotate(-2deg); }
@media (max-height: 480px) { #vs h2 { font-size: 18px; } }
@media (max-width: 370px) and (min-height: 481px) { #tabs span { display: none; } #tabs svg { width: 22px; height: 22px; } } /* the smallest phones: the tabs are only their icons */

/* ---------- a run: the warning when nobody is on the floor, the end that says it is over, and its rows in the menu ---------- */
#run.warn { background: #ffd0d0; transform-origin: left center; animation: warn 0.5s ease-in-out infinite alternate; }
#run.warn #runW { font-size: 16px; font-weight: 900; color: #b3261e; }
#run.warn #runG { display: none; }
@keyframes warn { to { transform: scale(1.08); } }
@keyframes warn2 { to { background: #ff9d94; } }
@media (max-width: 640px), (max-height: 480px) { #run.warn { animation-name: warn2; } #run.warn #runW { font-size: 14px; white-space: nowrap; } #run.warn #runM { display: none; } }
@media (max-width: 370px) and (min-height: 481px) { #run.warn #runW { font-size: 12px; } } /* the words and the seconds need the room of the money */
:root.calm #run.warn { animation: none; }
#winK, #menu #againM { display: none; }
.run #winK { display: block; margin-bottom: 12px; font-size: clamp(15px, 2.4vw, 20px); font-weight: 900; }
.run #menu #againM { display: flex; }
@media (max-height: 480px) { .run #winK { margin-bottom: 6px; font-size: 13px; } }

/* ---------- small things: the card under the controls at the top, a price that reads as a price, one undo on a phone ---------- */
#tip.under { transform: translate(-50%, 0) rotate(-1deg); }
.run .tool .count:not(:empty)::before { content: "×"; }
@media (pointer: coarse), (max-width: 640px) { #tip kbd { display: none; } } /* no keyboard there */
@media (max-width: 1032px), (max-width: 1400px) and (pointer: coarse) { #undoB { display: none; } } /* undo sits next to the tabs there */

/* ---------- the first screen: two ways in, side by side. Play a fight is the yellow one, Start blank a plain sticker of the same height ---------- */
#startTwo { display: flex; flex-wrap: wrap; align-items: stretch; justify-content: center; gap: 12px 14px; }
#startBlank { min-height: 68px; padding: 4px 24px 6px; font-size: 20px; font-weight: 900; transition: transform 0.16s var(--spring), box-shadow 0.12s var(--out); }
#startBlank:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
@media (hover: hover) { #startBlank:hover { transform: translateY(-3px) rotate(1deg); } }
/* the two kinds of game over the heading, as one toggle: never yellow (Play a fight is the yellow one).
   Words from the owner, this casing, everywhere: Free Play, Versus the Computer
   (vs the Computer, lowercase vs, only where the long one does not fit: here, on a phone) */
#startModes .short { display: none; }
@media (max-width: 699px) { #startModes .long { display: none; } #startModes .short { display: inline; } }
/* one sticker, two halves: a toggle. The half you are in is filled with ink, like the tab you are on */
#startModes { display: flex; gap: 4px; padding: 4px; margin-bottom: 24px; }
#startModes .mode { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 2px; width: 290px; min-height: 66px; padding: 9px 16px 10px; text-align: left; border: 0; border-radius: 10px; background: transparent; color: var(--ink); transition: background 0.14s; }
#startModes .mode b { font-size: 20px; font-weight: 900; line-height: 1.15; }
#startModes .mode small { font-size: 14px; font-weight: 600; line-height: 1.25; color: var(--muted); }
#startModes .mode[aria-pressed="true"] { background: var(--ink); color: var(--paper); cursor: default; }
#startModes .mode[aria-pressed="true"] small { color: rgba(255, 250, 240, 0.72); }
@media (hover: hover) { #startModes .mode[aria-pressed="false"]:hover { background: var(--soft); } }
#startModes .mode[aria-pressed="false"]:active { background: var(--soft); }
@media (max-width: 699px) { #startModes { width: 100%; max-width: 380px; margin-bottom: 16px; } #startModes .mode { width: auto; flex: 1 1 0; min-height: 56px; padding: 7px 10px 8px; } #startModes .mode b { font-size: 16px; } #startModes .mode small { font-size: 12px; } }
@media (max-height: 640px) and (max-width: 699px) { #startModes .mode { min-height: 42px; } #startModes .mode small { display: none; } } /* a small phone: only the names */
@media (max-height: 480px) { #startModes { margin-bottom: 8px; } #startModes .mode { width: 210px; min-height: 40px; padding: 5px 12px 6px; } #startModes .mode b { font-size: 15px; } #startModes .mode small { display: none; } } /* a phone on its side: only the names */
:root.calm #startModes .mode { transition: none; }
#start #startHere { margin: 0; font-size: 26px; font-weight: 900; letter-spacing: -0.4px; color: var(--muted); }
@media (max-width: 699px) { #startBlank { min-height: 60px; font-size: 18px; padding: 4px 20px 6px; } #start #startHere { font-size: 22px; } }
@media (max-width: 480px) { #startTwo { flex-direction: column; align-items: center; gap: 10px; } #startBlank { min-height: 48px; font-size: 17px; } }
@media (max-height: 480px) { #startBlank { min-height: 52px; font-size: 16px; } #start #startHere { font-size: 20px; } }
:root.calm #startBlank { transition: none; }

/* ---------- in a run: a rank for a team. A mark on the icon when you can pay for it, and the sticker over the picked team that buys it ---------- */
.tool .up { display: none; position: absolute; right: -2px; bottom: 12px; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--ink); place-items: center; pointer-events: none; z-index: 1; color: var(--ink); }
@media (min-width: 1033px) { .tool .up { bottom: 18px; } } /* clear of the price on desktop */
.tool .up svg { width: 14px; height: 14px; rotate: 180deg; }
.run .tool.canUp .up { display: grid; animation: upIn 0.3s var(--spring); }
@keyframes upIn { from { scale: 0.4; } }
@media (max-width: 1032px), (max-width: 1400px) and (pointer: coarse) { .tool .up { right: calc(50% - 31px); bottom: 16px; } }
#upB { position: fixed; transform: translate(-50%, -100%); display: flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 14px 0 10px; border-radius: 14px; box-shadow: 0 3px 0 var(--ink); font: inherit; font-size: 15px; font-weight: 800; white-space: nowrap; color: var(--ink); pointer-events: auto; z-index: 6; }
#upB svg { width: 20px; height: 20px; rotate: 180deg; }
#upB[hidden] { display: none; }
#upB::after { content: ""; position: absolute; left: var(--tail, 50%); bottom: -9px; width: 12px; height: 12px; margin-left: -8px; background: inherit; border: solid var(--ink); border-width: 0 2px 2px 0; transform: rotate(45deg); box-shadow: 2px 2px 0 var(--ink); }
#upB:active { transform: translate(-50%, calc(-100% + 2px)); box-shadow: 0 1px 0 var(--ink); }
:root.calm.run .tool.canUp .up { animation: none; }

/* ---------- the settings of the menu: sound in four steps, messages, calm mode (js/settings.js) ---------- */
/* how loud: three small bars at the end of the row, as many dark as the level. A tap goes one step up, high goes to off */
#soundM kbd { margin-left: 8px; }
#soundM .bars { margin-left: auto; display: flex; align-items: flex-end; gap: 3px; height: 16px; padding-left: 12px; }
#soundM .bars i { width: 5px; border-radius: 2px; background: #e4dbcc; }
#soundM .bars i:nth-child(1) { height: 7px; } #soundM .bars i:nth-child(2) { height: 11px; } #soundM .bars i:nth-child(3) { height: 16px; }
#soundM[data-v="1"] .bars i:nth-child(-n+1), #soundM[data-v="2"] .bars i:nth-child(-n+2), #soundM[data-v="3"] .bars i { background: var(--ink); }
/* on or off: a small switch at the end of the row, and the filled icon when on */
#msgM::after, #calmM::after { content: ""; margin-left: auto; flex: none; width: 30px; height: 18px; border-radius: 9px; border: 2px solid var(--ink); box-sizing: border-box; background: radial-gradient(circle, var(--ink) 4px, transparent 4.5px) no-repeat 0 50% / 14px 14px var(--paper); transition: background-position 0.2s var(--spring), background-color 0.15s; } /* the knob slides */
#msgM[aria-checked="true"]::after, #calmM[aria-checked="true"]::after { background-image: radial-gradient(circle, var(--paper) 4px, transparent 4.5px); background-position: 12px 50%; background-color: var(--sun); }

/* ---------- big titles: letters that land one after another (js/pop.js) ---------- */
#win h1 .word { display: inline-block; white-space: nowrap; margin: 0 0.07em; } /* the thick outline eats the space between words */
#win h1 .ch, #toast b .ch, #combo b .ch { display: inline-block; transform-origin: 50% 88%; }
#toast b .word, #combo b .word { display: inline-block; white-space: nowrap; }

/* ---------- the end of a fight: the ways on. One yellow button, choices as plain stickers, the rest in quiet words ---------- */
#winB { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
#winB button, #winQ button { display: inline-flex; align-items: center; gap: 7px; pointer-events: auto; color: var(--ink); }
#winB button { height: 52px; padding: 0 18px 0 14px; font-size: 17px; font-weight: 800; }
#winB #again { background: var(--sun); font-weight: 900; }
#winB svg { width: 22px; height: 22px; }
#winB button:active { transform: translateY(4px); box-shadow: 0 0 0 var(--ink); }
#winQ { display: flex; justify-content: center; gap: 6px; margin-top: 8px; }
#winQ button { min-height: 44px; padding: 0 10px; background: rgba(255, 253, 248, 0.85); font-size: 15px; font-weight: 800; text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 2px; border-radius: 11px; }
#winQ svg { width: 18px; height: 18px; }
#leaveW, .run #newW, .run #blankW, .run #homeW { display: none !important; }
.run #leaveW { display: inline-flex !important; }
@media (hover: hover) { #winB button:hover { transform: translateY(-2px); } #winQ button:hover { background: var(--paper); } }
@media (max-width: 640px), (max-height: 480px) { /* a phone: one row when it fits, two short ones when not */
  #winB { gap: 6px; }
  #winB button { height: 44px; padding: 0 10px 0 8px; font-size: 14px; gap: 5px; box-shadow: 0 3px 0 var(--ink); }
  #winB svg { width: 19px; height: 19px; }
  #winQ { margin-top: 4px; }
  #winQ button { font-size: 14px; }
}
@media (max-width: 640px) and (min-height: 481px) { #win { width: calc(100vw - 16px); } } /* a phone upright: the three stickers fit in one row at 390 */

/* ---------- who made it: one quiet line on the first screen, and his links in About ---------- */
#start #startBy { margin: 22px 0 0; font-size: 12px; line-height: 16px; font-weight: 600; color: var(--muted); opacity: 0.8; } /* a footer: smaller and lighter than everything above it. #start p is 18 px and wins without the #start */
#startBy a { pointer-events: auto; color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; display: inline-block; padding: 12px 4px; margin: -12px 0; } /* a 44 px tall target, without a taller line */
@media (max-height: 480px) { #startBy { display: none; } } /* a phone on its side: no room under the buttons. About has it */
#about .also { margin-top: -6px; font-size: 15px; font-weight: 600; color: var(--muted); }
#aboutV { padding: 0; font: inherit; font-weight: 800; color: var(--ink); text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 2px; }
#about .by { margin: 16px 0 0; font-size: 14px; font-weight: 700; }
#about .by span { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 4px; font-size: 14px; }
.run #shareW { display: none; }

/* ---------- small motion: hover, press, and what comes in and goes out. Short and quiet, never in the way of a tap ---------- */
/* every button eases between its states. Rules above that name their own transition keep it */
button { transition: transform 0.14s var(--out), box-shadow 0.14s var(--out), background-color 0.14s, color 0.14s, opacity 0.14s; }
#soundM .bars i, #tour .dots i { transition: background-color 0.15s, transform 0.16s var(--spring); }
/* press: small things shrink a little, stickers sink into their shadow (the rules for that are above) */
.small:active:not(:disabled), #undoT:active:not(:disabled), #tour #tourX:active, #vsX:active, #homeX:active { transform: scale(0.9); }
#menu button:active:not(:disabled), #speeds button:active { transform: scale(0.97); }
#startQ button:active, #startBk:active, #vsH:active, #tour #tourB:active:not(:disabled), #winQ button:active { transform: scale(0.95); }
@media (max-width: 1032px), (max-width: 1400px) and (pointer: coarse) { #tabs button:active { transform: scale(0.95); } }
/* the models in the trays: a hover lifts them (above), a press squashes them like a stamp */
.tool:not(.on):active canvas { transform: translateY(-1px) scale(1.08, 0.9); transition-duration: 0.08s; }
.tool:not(.on):active > svg { transform: scale(0.88); transition-duration: 0.08s; }
.tool:not(.on):active::before { transform: scale(0.9); }
#startL button:active canvas, #startGo:active canvas { transform: scale(1.05, 0.93); transition-duration: 0.08s; }
@media (hover: hover) { #menu button:not(:disabled):hover svg { transform: rotate(-8deg) scale(1.08); } }
#menu button svg { transition: transform 0.18s var(--spring); }

/* the menu and the speeds: they grow out of the button that opened them, the rows follow one after another, and they fade out quicker than they came */
#menu, #speeds { transition: opacity 0.12s, scale 0.16s var(--out), translate 0.16s var(--out), display 0.16s allow-discrete; transform-origin: 20px 0; }
#speeds { transform-origin: 50% 0; }
#menu[hidden], #speeds[hidden] { opacity: 0; scale: 0.96; translate: 0 -4px; pointer-events: none; }
@starting-style { #menu:not([hidden]), #speeds:not([hidden]) { opacity: 0; scale: 0.92; translate: 0 -6px; } }
#menu > *, #speeds > * { animation: rowIn 0.22s var(--out) backwards; animation-delay: calc(var(--i, 0) * 14ms + 20ms); }
@keyframes rowIn { from { opacity: 0; translate: -6px 0; } }

/* the boxes: About, Add to home screen, the screen before a run. In with a little rise, out with a quick fade */
#about, #home, #vs { transition: opacity 0.16s, scale 0.2s var(--out), translate 0.2s var(--out), display 0.2s allow-discrete, overlay 0.2s allow-discrete; }
#about:not([open]), #home:not([open]), #vs:not([open]) { opacity: 0; scale: 0.97; translate: 0 6px; }
@starting-style { #about[open], #home[open], #vs[open] { opacity: 0; scale: 0.94; translate: 0 14px; } }
#about::backdrop, #home::backdrop, #vs::backdrop { transition: opacity 0.2s, display 0.2s allow-discrete, overlay 0.2s allow-discrete; }
#about:not([open])::backdrop, #home:not([open])::backdrop, #vs:not([open])::backdrop { opacity: 0; }
@starting-style { #about[open]::backdrop, #home[open]::backdrop, #vs[open]::backdrop { opacity: 0; } }
#vsR li, #home li { animation: rise 0.3s var(--out) backwards; }
#vsR li:nth-child(1), #home li:nth-child(1) { animation-delay: 0.08s; } #vsR li:nth-child(2), #home li:nth-child(2) { animation-delay: 0.12s; } #vsR li:nth-child(3) { animation-delay: 0.16s; } #vsR li:nth-child(4) { animation-delay: 0.2s; } #vsR li:nth-child(5) { animation-delay: 0.24s; }
@keyframes rise { from { opacity: 0; translate: 0 8px; } }

/* the first screen: its parts come in one after another, top to bottom, each time it shows and on each step */
#start1 > *, #start2 > *, #startL > button { animation: rise 0.34s var(--out) backwards; }
#start1 > :nth-child(2), #start2 > :nth-child(2) { animation-delay: 0.05s; }
#start1 > :nth-child(3), #start2 > :nth-child(3) { animation-delay: 0.1s; }
#start1 > :nth-child(4), #start2 > :nth-child(4) { animation-delay: 0.15s; }
#start1 > :nth-child(5) { animation-delay: 0.2s; }
#start1 > :nth-child(n+6) { animation-delay: 0.25s; }
#startL > button:nth-child(1) { animation-delay: 0.06s; } #startL > button:nth-child(2) { animation-delay: 0.1s; } #startL > button:nth-child(3) { animation-delay: 0.14s; } #startL > button:nth-child(4) { animation-delay: 0.18s; } #startL > button:nth-child(5) { animation-delay: 0.22s; }
#start.bye { transition: opacity 0.16s; translate: 0 -6px; transition-property: opacity, translate; }

/* the trays come up one after another: when the page opens, and on a phone when the strip comes back */
.group { animation: trayIn 0.36s var(--out) backwards; }
.group:nth-child(2) { animation-delay: 0.05s; } .group:nth-child(3) { animation-delay: 0.1s; }
@keyframes trayIn { from { opacity: 0; translate: 0 18px; } }
/* the undo bar rises in */
#undo { transition: opacity 0.18s, transform 0.22s var(--spring), display 0.22s allow-discrete; }
#undo[hidden] { opacity: 0; transform: translateY(6px); pointer-events: none; }
@starting-style { #undo:not([hidden]) { opacity: 0; transform: translateY(10px) scale(0.96); } }

/* calm mode: things still fade, nothing moves */
:root.calm button, :root.calm #menu button svg, :root.calm .tool:active canvas { transition-property: background-color, color, opacity, box-shadow; }
:root.calm #menu, :root.calm #speeds, :root.calm #about, :root.calm #home, :root.calm #vs, :root.calm #undo { scale: none; translate: none; transform: none; }
:root.calm #menu > *, :root.calm #speeds > *, :root.calm #vsR li, :root.calm #home li, :root.calm #start1 > *, :root.calm #start2 > *, :root.calm #startL > button, :root.calm .group { animation: none; }
:root.calm #start.bye { translate: none; }
