/* Backbeat Pizza. On a wide screen in play: the stage with the kitchen beside it, and one log
   column per drummer across the bottom. On a narrow one everything stacks. */
:root {
  --night: #1d1530;
  --panel: #2a2046;
  --panel-2: #352a58;
  --ink: #f6efe2;
  --muted: #b9add6;
  --gold: #ffd36b;
  --perfect: #7be08a;
  --close: #ffd36b;
  --miss: #ff7b7b;
  --line: #4a3d78;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--night); color: var(--ink); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.45; }
button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
h1, h2, h3 { margin: 0 0 0.4em; line-height: 1.15; }
h2 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }

#stage { position: relative; height: 56vh; min-height: 260px; overflow: hidden; }
body[data-mode="title"] #stage, body[data-mode="intro"] #stage,
body[data-mode="won"] #stage, body[data-mode="lost"] #stage, body[data-mode="finale"] #stage { height: 100vh; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

#bar { position: absolute; top: 0; left: 0; right: 0; display: flex; gap: 1rem; align-items: center; padding: 0.5rem 0.8rem;
  background: linear-gradient(#1d1530ee, #1d153000); z-index: 3; flex-wrap: wrap; }
#bar-title { font-weight: 800; letter-spacing: 0.04em; color: var(--gold); }
#bar-level { color: var(--muted); }
#bar .spacer { flex: 1; }
#bar button { background: #0006; border: 1px solid var(--line); border-radius: 999px; padding: 0.25rem 0.8rem; }

#bubbles { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.bubble { position: absolute; transform: translate(-50%, -100%); max-width: 20rem;
  background: #fffaf0; color: #22142e; border-radius: 14px; padding: 0.45rem 0.65rem; font-size: 0.85rem;
  box-shadow: 0 3px 0 #22142e; border: 2px solid #22142e; }
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -10px; border: 8px solid transparent; border-top-color: #22142e; transform: translateX(-50%); }
.bubble strong { display: block; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; }
.bubble .verdict { font-weight: 800; }
.bubble p { margin: 0.15rem 0 0; }
.bubble[data-verdict="perfect"] { border-color: #2e8a3d; box-shadow: 0 3px 0 #2e8a3d; }
.bubble[data-verdict="miss"] { border-color: #b02a2a; box-shadow: 0 3px 0 #b02a2a; }
.bubble[data-verdict="tasting"] p { font-style: italic; }
/* a rated hint's scorecard: each part with its mark, coloured by verdict */
.ratings { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.rating { display: inline-flex; gap: 0.3rem; align-items: baseline; border-radius: 6px; padding: 0 0.4rem;
  font-size: 0.78rem; font-weight: 700; border: 2px solid var(--line); }
.rating .part { font-weight: 400; }
.rating[data-verdict="perfect"] { border-color: var(--perfect); }
.rating[data-verdict="close"] { border-color: var(--close); }
.rating[data-verdict="miss"] { border-color: var(--miss); }
.bubble .ratings { margin-top: 0.15rem; gap: 0.15rem; }
.bubble .rating { font-size: 0.7rem; padding: 0 0.25rem; border-width: 1.5px; flex-wrap: wrap; max-width: 100%; }
.bubble .rating[data-verdict="perfect"] { border-color: #2e8a3d; }
.bubble .rating[data-verdict="close"] { border-color: #b98a12; }
.bubble .rating[data-verdict="miss"] { border-color: #b02a2a; }

#play { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.6rem; padding: 0.6rem; }
#kitchen, #log { background: var(--panel); border-radius: 14px; padding: 0.7rem; border: 1px solid var(--line); min-height: 0; }
#log { display: flex; flex-direction: column; }
/* in play on a wide screen the page fills the window exactly, and each log column scrolls on its own */
@media (min-width: 900px) {
  /* the bar gets its own strip, so the bubbles never run into it */
  body[data-mode="play"] { display: grid; height: 100vh; overflow: hidden;
    grid-template-columns: minmax(0, 1fr) minmax(19rem, 30rem); grid-template-rows: auto max(50vh, 24rem) minmax(0, 1fr) auto; }
  body[data-mode="play"] #bar { position: static; grid-column: 1 / -1; grid-row: 1; background: var(--night); }
  body[data-mode="play"] #stage { height: auto; min-height: 0; grid-column: 1; grid-row: 2; }
  body[data-mode="play"] #play { display: contents; }
  body[data-mode="play"] #kitchen { grid-column: 2; grid-row: 2; margin: 0 0.6rem 0 0; overflow: auto; }
  body[data-mode="play"] #log { grid-column: 1 / -1; grid-row: 3; margin: 0.6rem 0.6rem 0; }
  body[data-mode="play"] footer { grid-column: 1 / -1; grid-row: 4; }
  /* the serve buttons stay in sight when the kitchen is short */
  #serve { position: sticky; bottom: -0.7rem; background: var(--panel); padding: 0.4rem 0 0.7rem; margin-bottom: -0.7rem; }
}
@media (min-width: 900px) and (max-height: 820px) {
  .bubble { font-size: 0.72rem; padding: 0.25rem 0.45rem; line-height: 1.25; }
  .bubble strong { font-size: 0.65rem; }
  /* on a short screen a bubble with a scorecard leaves its words to the log */
  .bubble .ratings ~ p { display: none; }
  #bar { padding: 0.3rem 0.8rem; }
  #kitchen h2 { margin-bottom: 0.2em; }
  .option { font-size: 0.82rem; padding: 0.1rem 0.5rem 0.1rem 0.3rem; }
  .options { gap: 0.25rem; margin-bottom: 0.35rem; }
  #pizza { margin-bottom: 0.35rem; padding: 0.25rem; }
  #serve { gap: 0.3rem; }
  #serve button { padding: 0.25rem 0.6rem; font-size: 0.85rem; }
}
#play[hidden] { display: none; }
/* the drummer names head the columns, so the log heading is for screen readers only */
#log > h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
#log-drummers { flex: 1; min-height: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(13rem, 1fr); gap: 0.6rem; overflow-x: auto; }
@media (max-width: 760px) {
  #log-drummers { grid-auto-columns: minmax(80vw, 1fr); scroll-snap-type: x mandatory; }
  .drummer { max-height: 70vh; scroll-snap-align: start; }
  .bubble { font-size: 0.7rem; padding: 0.3rem 0.4rem; }
  /* a narrow bubble with a scorecard leaves its words to the log just below */
  .bubble .ratings ~ p { display: none; }
}
.options { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.5rem; }
.option { display: inline-flex; align-items: center; gap: 0.4rem; background: var(--panel-2); border: 2px solid var(--line);
  border-radius: 999px; padding: 0.2rem 0.65rem 0.2rem 0.35rem; font-size: 0.92rem; }
.option[aria-pressed="true"] { border-color: var(--gold); background: #4b3b1c; }
.option[aria-pressed="true"]::after { content: "✓"; color: var(--gold); font-weight: 800; }
.chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }
#pizza { min-height: 2rem; margin-bottom: 0.5rem; padding: 0.4rem; border: 2px dashed var(--line); border-radius: 12px; }
.chip { display: inline-flex; align-items: center; gap: 0.3rem; background: #0003; border-radius: 999px; padding: 0.1rem 0.55rem 0.1rem 0.25rem; font-size: 0.85rem; }
#serve { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
#serve-buttons { display: contents; }
#serve button { border-radius: 10px; padding: 0.4rem 0.8rem; border: 2px solid var(--line); background: var(--panel-2); }
#serve button.serve { background: #e2662b; border-color: #ffb28a; font-weight: 700; color: #fff; }

.drummer { background: #0002; border-radius: 10px; padding: 0.5rem; overflow-y: auto; min-height: 0; }
.drummer[data-fed="true"] { opacity: 0.7; }
.drummer h3 { font-size: 1rem; display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: baseline; position: sticky; top: -0.5rem;
  background: var(--panel); margin: -0.5rem -0.5rem 0.4rem; padding: 0.5rem; border-radius: 10px 10px 0 0; z-index: 1; }
.drummer .status { font-size: 0.8rem; color: var(--gold); }
.drummer .empty { color: var(--muted); margin: 0; font-size: 0.85rem; }
.entries { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; }
.entry { background: var(--panel-2); border-left: 4px solid var(--line); border-radius: 8px; padding: 0.3rem 0.45rem; display: grid; gap: 0.2rem; }
.entry-head { display: flex; align-items: center; gap: 0.45rem; }
.entry .number { color: var(--muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.entry .chip { font-size: 0.78rem; }
.entry[data-verdict="perfect"] { border-left-color: var(--perfect); }
.entry[data-verdict="close"] { border-left-color: var(--close); }
.entry[data-verdict="miss"] { border-left-color: var(--miss); }
.entry .verdict { font-weight: 800; font-size: 0.85rem; }
.entry .line { margin: 0; font-size: 0.8rem; color: var(--muted); }
.entry .rebuild { margin-left: auto; background: none; border: 1px solid var(--line); border-radius: 6px; font-size: 0.75rem; padding: 0.1rem 0.5rem; }

.card { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 4; width: min(36rem, 92vw);
  max-height: 90vh; overflow: auto; background: #2a2046f2; border: 2px solid var(--gold); border-radius: 18px; padding: 1.2rem 1.4rem; box-shadow: 0 6px 0 #0008; }
.card h1 { color: var(--gold); font-size: 2rem; }
.card ul { padding-left: 1.2rem; }
.card .label { color: var(--muted); margin: 0; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.8rem; }
.card button { border-radius: 10px; padding: 0.55rem 1.1rem; margin: 0.3rem 0.4rem 0 0; border: 2px solid var(--line); background: var(--panel-2); }
.card button.primary { background: #e2662b; border-color: #ffb28a; color: #fff; font-weight: 700; }
#level-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: 0.4rem; }
#level-list .level { margin: 0; text-align: left; display: grid; }
#level-list .label { font-size: 0.75rem; color: var(--muted); }
#level-list .name { font-weight: 700; }

#message { position: fixed; bottom: 2.2rem; left: 50%; transform: translateX(-50%); margin: 0; z-index: 5; background: #000c; border-radius: 8px; padding: 0 0.6rem; }
#message:empty { display: none; }
footer { color: var(--muted); font-size: 0.7rem; padding: 0.3rem 0.8rem; opacity: 0.6; }

/* ingredient icons: a shape in the ingredient's colour, so colour is not the only cue */
.icon { --c: #888; display: inline-block; width: 1.3rem; height: 1.3rem; flex: none; background: var(--c); border: 2px solid #22142e; }
.shape-thin { border-radius: 50%; height: 0.6rem; }
.shape-thick { border-radius: 40%; height: 1rem; }
.shape-stuffed { border-radius: 50%; box-shadow: inset 0 0 0 3px #fff8; }
.shape-sauce { border-radius: 50% 50% 50% 10%; }
.shape-disc { border-radius: 50%; }
.shape-dome { border-radius: 50% 50% 15% 15%; }
.shape-ring { border-radius: 50%; background: transparent; box-shadow: inset 0 0 0 4px var(--c); }
.shape-arc { border-radius: 100% 0; }
.shape-cube { border-radius: 2px; transform: rotate(12deg) scale(0.85); }
.shape-hoop { border-radius: 50%; background: transparent; box-shadow: inset 0 0 0 2px var(--c); border-style: dashed; }
.shape-blob { border-radius: 45% 55% 40% 60%; }
.shape-fish { border-radius: 50% 10% 50% 10%; height: 0.7rem; width: 1.6rem; }
.shape-none { background: transparent; border-style: dotted; border-radius: 50%; }
