* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #6fc3e8; font-family: "Trebuchet MS", "Segoe UI", sans-serif; }
#game { display: block; width: 100%; height: 100%; }
.hidden { display: none !important; }

.overlay {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(20, 40, 60, 0.45); backdrop-filter: blur(3px);
}
.panel {
  background: #fff7e6; border: 4px solid #2b2b2b; border-radius: 14px; padding: 28px 32px;
  width: 340px; max-width: 94vw; max-height: 92vh; overflow: auto; box-shadow: 0 12px 0 #2b2b2b; text-align: center;
}
.panel h1 { margin: 0; font-size: 34px; color: #e8541e; letter-spacing: 1px; }
.panel .sub { margin: 4px 0 20px; color: #666; font-size: 13px; }
.panel label { display: block; text-align: left; font-size: 13px; color: #444; margin-bottom: 12px; }
.panel input {
  display: block; width: 100%; margin-top: 4px; padding: 10px; font-size: 16px;
  border: 3px solid #2b2b2b; border-radius: 8px; background: #fff;
}
.panel button {
  width: 100%; padding: 12px; font-size: 18px; font-weight: bold; color: #fff; cursor: pointer;
  background: #e8541e; border: 3px solid #2b2b2b; border-radius: 8px; box-shadow: 0 5px 0 #2b2b2b;
}
.panel button:active { transform: translateY(3px); box-shadow: 0 2px 0 #2b2b2b; }
.panel .hint { font-size: 11px; color: #777; margin: 16px 0 0; }
.panel .error { color: #c0392b; font-size: 13px; min-height: 1em; margin: 8px 0 0; }

#hud { position: fixed; inset: 0; pointer-events: none; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
#crosshair {
  position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px;
  border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.5);
}
#stats { position: absolute; left: 12px; top: 10px; font-size: 12px; font-family: monospace; opacity: .9; }
#players { position: absolute; right: 12px; top: 10px; font-size: 14px; text-align: right; }
#players div { margin-bottom: 2px; }
#health {
  position: absolute; left: 20px; bottom: 20px; width: 220px; height: 26px;
  background: rgba(0,0,0,.45); border: 3px solid #2b2b2b; border-radius: 8px; overflow: hidden;
}
#health-bar { height: 100%; width: 100%; background: linear-gradient(#ff7a4a, #e8541e); transition: width .15s; }
#health-text { position: absolute; inset: 0; text-align: center; line-height: 20px; font-weight: bold; font-size: 14px; }
#feed { position: absolute; right: 12px; top: 70px; font-size: 13px; text-align: right; }
#feed div { margin-bottom: 3px; opacity: .95; }
#damage-flash {
  position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at center, rgba(255,0,0,0) 45%, rgba(220,30,30,.55) 100%);
  transition: opacity .35s;
}
#damage-flash.on { opacity: 1; transition: opacity .05s; }
#ko-screen {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 90px; font-weight: 900; color: #fff; background: rgba(120, 10, 10, .55);
  text-shadow: 0 6px 0 #2b2b2b; letter-spacing: 4px;
}
#click-hint {
  position: absolute; left: 50%; bottom: 40px; transform: translateX(-50%);
  background: rgba(0,0,0,.55); padding: 8px 16px; border-radius: 8px; font-size: 14px;
}

/* ---------------------------------------------------------------- M1: clock, money, hint, toasts */
#clock {
  position: absolute; left: 50%; top: 12px; transform: translateX(-50%); text-align: center;
  background: rgba(0,0,0,.45); border: 3px solid #2b2b2b; border-radius: 10px; padding: 6px 18px; min-width: 190px;
}
#clock-time { font-size: 20px; font-weight: bold; letter-spacing: 1px; }
#clock-phase { font-size: 12px; color: #ffd9a8; text-transform: uppercase; letter-spacing: 2px; }
#clock-left { font-size: 11px; color: #ddd; min-height: 1.1em; }
/* what to do next in this phase (always visible, one short line) */
#clock-hint { font-size: 12px; color: #fff; max-width: 420px; margin: 2px auto 0; line-height: 1.3; }
#clock-hint b { color: #ffd43b; }
#timer {
  position: absolute; left: 50%; top: 120px; transform: translateX(-50%);
  font-size: 56px; font-weight: 900; color: #fff; text-shadow: 0 4px 0 #2b2b2b; letter-spacing: 2px;
}
#timer.urgent { color: #ff3b2e; animation: pulse .6s ease-in-out infinite alternate; }
@keyframes pulse { from { transform: translateX(-50%) scale(1); } to { transform: translateX(-50%) scale(1.12); } }
#bottom-right {
  position: absolute; right: 20px; bottom: 20px; display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
}
#money {
  font-size: 22px; font-weight: bold; color: #ffe59a;
  background: rgba(0,0,0,.45); border: 3px solid #2b2b2b; border-radius: 8px; padding: 6px 14px;
}
/* prompt list: [E] Tomate nehmen, one line per possible action */
#hint {
  background: rgba(0,0,0,.55); border-radius: 8px; padding: 8px 12px; font-size: 15px; white-space: nowrap;
  text-align: right; line-height: 1.7;
}
#hint kbd, #hint-card kbd, #endday kbd {
  display: inline-flex; align-items: center; gap: 4px; min-width: 26px; padding: 1px 7px; margin-right: 6px; text-align: center;
  font: bold 12px "Trebuchet MS", "Segoe UI", sans-serif; color: #2b2b2b; background: #fff7e6;
  border: 2px solid #2b2b2b; border-radius: 6px; box-shadow: 0 2px 0 #2b2b2b; text-shadow: none; vertical-align: 1px;
}
kbd .mouse { display: inline-block; vertical-align: middle; }
#hint-card {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 460px; max-width: 92vw; pointer-events: auto; cursor: pointer;
  background: #fff7e6; color: #2b2b2b; text-shadow: none; border: 4px solid #2b2b2b; border-radius: 14px; padding: 18px 22px; box-shadow: 0 10px 0 #2b2b2b;
  font-size: 15px; line-height: 1.9;
}
#hint-card h3 { margin: 0 0 8px; color: #e8541e; font-size: 20px; }
#hint-card small { display: block; color: #777; margin-top: 8px; }
#endday {
  position: absolute; left: 50%; top: 200px; transform: translateX(-50%); background: rgba(192,57,43,.9); border: 4px solid #2b2b2b; border-radius: 12px;
  padding: 12px 24px; font-size: 26px; text-align: center; box-shadow: 0 8px 0 #2b2b2b;
}
#endday div { font-size: 14px; margin-top: 6px; }
#summary-failed { background: #c0392b; color: #fff; border-radius: 8px; padding: 10px 14px; margin: 0 0 12px; text-align: center; }
#summary-failed .big { font-size: 28px; font-weight: 900; letter-spacing: 3px; }
#summary-failed .retry { font-size: 12px; opacity: .9; margin-top: 4px; }
#goals div.risk { color: #ffb347; animation: risk-flash 1s ease-in-out infinite alternate; }
#goals div.risk em { font-style: normal; font-size: 11px; }
@keyframes risk-flash { from { opacity: 1; } to { opacity: .55; } }
#hold-ring { position: absolute; left: 50%; top: 50%; margin: -20px 0 0 -20px; }
#hold-ring-fg { transition: stroke-dashoffset .05s linear; }
/* hit by a thrown tomato/yogurt/…: blobs in the item's colour, fading out */
#splat-overlay {
  position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .6s; --splat: #d8342a;
  background:
    radial-gradient(circle at 22% 30%, var(--splat) 0 9%, transparent 11%),
    radial-gradient(circle at 70% 25%, var(--splat) 0 13%, transparent 15%),
    radial-gradient(circle at 48% 62%, var(--splat) 0 16%, transparent 18%),
    radial-gradient(circle at 82% 70%, var(--splat) 0 8%, transparent 10%),
    radial-gradient(circle at 15% 78%, var(--splat) 0 11%, transparent 13%),
    radial-gradient(circle at 60% 88%, rgba(255,255,255,.7) 0 6%, transparent 8%);
}
#splat-overlay.on { opacity: .85; transition: opacity .05s; }
#game.blurred { filter: blur(6px); transition: filter .2s; }
#game { transition: filter .6s; }
#toasts { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.toast {
  background: #fff7e6; color: #2b2b2b; text-shadow: none; border: 3px solid #2b2b2b; border-radius: 8px;
  padding: 7px 16px; font-size: 14px; font-weight: bold; box-shadow: 0 4px 0 #2b2b2b;
  opacity: 1; transition: opacity .5s;
}
.toast.fade { opacity: 0; }

/* summary overlay */
#summary { pointer-events: auto; color: #2b2b2b; text-shadow: none; }
.panel.summary { width: 440px; text-align: left; }
.panel.summary h2 { margin: 0 0 12px; color: #e8541e; text-align: center; }
.panel.summary table { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 10px; }
.panel.summary th { text-align: left; font-size: 12px; color: #777; border-bottom: 2px solid #2b2b2b; padding: 2px 4px; }
.panel.summary td { padding: 3px 4px; border-bottom: 1px solid #e0d6c4; }
.panel.summary tr.total td { font-weight: bold; color: #c0392b; border-bottom: none; }
.panel.summary td.good { color: #2f9e44; font-weight: bold; }
.panel.summary p { margin: 6px 0; font-size: 13px; color: #444; }
.panel.summary p.money { font-size: 18px; font-weight: bold; color: #2b2b2b; margin: 12px 0; }
.panel.summary button { margin-top: 6px; }
.panel.summary p.ready { text-align: center; color: #777; margin-top: 10px; }

/* ---------------------------------------------------------------- M2: prompts, tickets, goals, hand item */
#hint div.muted { color: #bbb; font-size: 13px; }
#tickets {
  position: absolute; right: 12px; top: 110px; width: 230px; display: flex; flex-direction: column; gap: 8px; text-align: left;
}
.ticket { background: rgba(0,0,0,.55); border: 2px solid #2b2b2b; border-radius: 8px; padding: 6px 8px; font-size: 13px; }
.ticket.new { border-color: #ffd43b; }
.ticket-head { display: flex; gap: 6px; align-items: baseline; }
.ticket-head b { font-size: 14px; color: #ffe59a; }
.ticket-head span { color: #ccc; font-size: 12px; flex: 1; }
.ticket-head em { font-style: normal; color: #fff; }
.ticket-ings { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.ticket-ings .ing { background: rgba(255,255,255,.12); border-radius: 4px; padding: 1px 6px; font-size: 12px; }
.ticket-ings .ing.done { background: rgba(61,220,90,.3); color: #b9ffc6; text-decoration: line-through; }
.ticket-note { font-size: 12px; color: #ffd9a8; margin-top: 2px; }
.patience { height: 6px; background: rgba(0,0,0,.5); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.patience div { height: 100%; transition: width .3s linear; }
#goals { position: absolute; left: 12px; top: 30px; font-size: 13px; text-align: left; background: rgba(0,0,0,.4); border-radius: 8px; padding: 6px 10px; line-height: 1.5; }
#goals div.done { color: #b9ffc6; }
#goals div span { color: #bbb; font-size: 12px; }
#goals .stars { color: #ffd43b; font-size: 15px; letter-spacing: 1px; }
#cold-warning {
  position: absolute; left: 50%; top: 165px; transform: translateX(-50%); color: #fff; background: rgba(192,57,43,.85);
  border: 3px solid #2b2b2b; border-radius: 8px; padding: 6px 14px; font-weight: bold; font-size: 15px;
}
#hand-item {
  position: absolute; left: 50%; bottom: 60px; transform: translateX(-50%); background: rgba(0,0,0,.55); border-radius: 8px;
  padding: 6px 14px; font-size: 14px; white-space: nowrap;
}
/* summary extensions */
#summary-stars { text-align: center; font-size: 44px; line-height: 1; margin: 4px 0 10px; color: #cfc6b5; }
#summary-stars span { display: inline-block; opacity: .35; transform: scale(.7); }
#summary-stars span.on { color: #ffb300; opacity: 1; animation: star-pop .5s cubic-bezier(.3,1.6,.5,1) both; text-shadow: 0 2px 0 #2b2b2b; }
@keyframes star-pop { from { transform: scale(0) rotate(-30deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }
#summary-goals { list-style: none; margin: 0 0 10px; padding: 0; font-size: 14px; }
#summary-goals li { padding: 2px 0; }
#summary-goals li.done { color: #2f9e44; }
#summary-goals li.missed { color: #c0392b; }
#summary.failed .panel.summary h2 { color: #c0392b; }
/* progress layer: rank bar, personal best, tomorrow's teaser */
#summary-progress { margin: 8px 0; font-size: 14px; }
#summary-progress .rank { font-weight: bold; }
#summary-progress .rank.up { color: #e8590c; animation: rankPop .5s ease-in-out 4 alternate; display: inline-block; }
@keyframes rankPop { from { transform: scale(1); } to { transform: scale(1.08); } }
#summary-progress .bar { height: 10px; background: #ddd2bb; border: 2px solid #2b2b2b; border-radius: 6px; overflow: hidden; margin: 4px auto; max-width: 320px; }
#summary-progress .bar i { display: block; height: 100%; background: linear-gradient(90deg, #ffb300, #e8590c); }
#summary-progress .best { color: #2b8a3e; font-weight: bold; }
#summary-progress .tomorrow { background: #fff3bf; border: 2px dashed #2b2b2b; border-radius: 8px; padding: 6px 10px; margin-top: 6px; display: inline-block; }
#summary-map { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin: 8px 0; font-size: 12px; color: #ffb300; }
#summary-map div { background: #f3ead8; border: 2px solid #2b2b2b; border-radius: 6px; padding: 2px 6px; text-align: center; }
#summary-map div.current { background: #ffe59a; }
#summary-map small { display: block; color: #666; font-size: 10px; }
#cig { position: absolute; left: 20px; bottom: 56px; display: flex; align-items: center; gap: 8px; font-size: 16px; background: rgba(0,0,0,.45); border-radius: 8px; padding: 4px 10px; }
#cig .cig-bar { display: inline-block; width: 70px; height: 8px; background: rgba(0,0,0,.5); border-radius: 4px; overflow: hidden; }
#cig .cig-bar span { display: block; height: 100%; background: #ff8a2a; }
#cig .stress { color: #ff6b5a; font-weight: bold; font-size: 13px; }
/* narrow screens: stats and goals stack, tickets shrink */
@media (max-width: 700px) {
  #stats { font-size: 10px; }
  #goals { top: 24px; font-size: 11px; max-width: 46vw; padding: 4px 8px; }
  #tickets { width: 170px; top: 90px; font-size: 11px; }
  #players { font-size: 11px; }
  #clock { min-width: 150px; padding: 4px 10px; }
  #clock-time { font-size: 16px; }
  .ticket-head b { font-size: 12px; }
}
@media (max-height: 420px) {
  #goals { top: 22px; }
  #hand-item { bottom: 50px; font-size: 12px; }
}
#megaphone { position: absolute; left: 50%; top: 92px; transform: translateX(-50%); background: rgba(0,0,0,.45); border: 2px solid #2b2b2b; border-radius: 8px; padding: 3px 10px; font-size: 13px; color: #ffe59a; white-space: nowrap; }
#push-toast { position: absolute; left: 50%; top: 130px; transform: translateX(-50%); display: flex; gap: 8px; align-items: center; background: #fff; color: #2b2b2b; text-shadow: none; border: 3px solid #2b2b2b; border-radius: 12px; padding: 8px 14px; font-size: 14px; box-shadow: 0 6px 0 #2b2b2b; pointer-events: auto; cursor: pointer; animation: push-in .3s ease-out; }
#push-toast .icon { font-size: 18px; }
@keyframes push-in { from { transform: translate(-50%, -20px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
#truck { position: absolute; left: 50%; top: 92px; transform: translateX(calc(-50% + 150px)); background: rgba(0,0,0,.45); border: 2px solid #2b2b2b; border-radius: 8px; padding: 3px 10px; font-size: 13px; color: #cfe9ff; white-space: nowrap; }

/* ---- end-of-day summary, structured (tiles · ledger · progress) */
#summary .sum-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 6px 0 10px; }
#summary .sum-tile { background: #fff; border: 2px solid #2b2b2b; border-radius: 10px; padding: 6px 4px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 1px; }
#summary .sum-tile .ico { font-size: 18px; line-height: 1.1; }
#summary .sum-tile b { font-size: 18px; }
#summary .sum-tile small { font-size: 11px; color: #6b6458; }
#summary .sum-tile em { font-size: 10px; font-style: normal; color: #8a8173; }
#summary .sum-tile em.rec { color: #2b8a3e; font-weight: bold; }
#summary .sum-ledger { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; background: #fff; border: 2px solid #2b2b2b; border-radius: 10px; padding: 8px 12px; font-size: 13px; text-align: left; }
#summary .sum-ledger h4 { margin: 0 0 3px; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: #6b6458; }
#summary .sum-ledger .row { display: flex; justify-content: space-between; gap: 8px; padding: 1px 0; }
#summary .sum-ledger .in { color: #2b8a3e; font-weight: bold; white-space: nowrap; }
#summary .sum-ledger .out { color: #c0392b; font-weight: bold; white-space: nowrap; }
#summary .sum-ledger .muted { color: #aaa; }
#summary .sum-ledger .bal { grid-column: 1 / -1; border-top: 2px dashed #d8ccb4; padding-top: 5px; display: flex; justify-content: space-between; font-size: 14px; }
#summary .sum-ledger .bal.pos b { color: #2b8a3e; }
#summary .sum-ledger .bal.neg b { color: #c0392b; }
#summary .sum-waste { font-size: 12px; margin: 6px 0 2px; text-align: left; }
#summary .sum-waste.good { color: #2b8a3e; }
#summary .sum-waste.bad { color: #c0392b; }
#summary-money { font-size: 20px !important; margin: 8px 0 4px !important; }
#summary-money b { font-size: 26px; }
#summary-stored { font-size: 12px; color: #6b6458; margin: 2px 0 6px; }
#summary-spoiled:empty { display: none; }
#summary-goals { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
#summary-goals li { background: #fff; border: 2px solid currentColor; border-radius: 999px; padding: 2px 10px !important; font-size: 13px; }
@media (max-width: 560px) { #summary .sum-tiles { grid-template-columns: repeat(2, 1fr); } #summary .sum-ledger { grid-template-columns: 1fr; } }

#summary-ready .rdy-list { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 4px; }
#summary-ready .rdy { border: 2px solid #b9ad97; color: #8a8173; border-radius: 999px; padding: 2px 10px; font-size: 13px; background: #fff; }
#summary-ready .rdy.on { border-color: #2f9e44; color: #fff; background: #2f9e44; font-weight: bold; }
#summary-next.is-ready { background: #2f9e44 !important; }
