:root {
  color-scheme: dark;
  font-family: "Arial Black", Impact, system-ui, sans-serif;
  background: #161714;
  color: #f4e7bf;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 20%, #424438 0, #24251f 42%, #10110f 100%);
}

button, input { font: inherit; }

.game-shell {
  width: 100vw;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  padding: 0;
}

.hud, .toolbelt {
  display: flex;
  align-items: center;
  min-height: 58px;
  border: 3px ridge #b6a16b;
  background: linear-gradient(#3e433a, #22251f);
  box-shadow: 0 4px 12px #000a;
}

.hud { gap: clamp(12px, 3vw, 42px); padding: 7px 15px; }
.brand { margin-right: auto; color: #e73b2e; letter-spacing: .08em; text-shadow: 2px 2px #250a07; }
.company { display: grid; color: #aaa58f; font: 9px system-ui; text-transform: uppercase; }
.company input { width: clamp(110px, 14vw, 210px); padding: 3px 6px; border: 1px solid #776b4b; color: #fff0a4; background: #151612; font: bold 12px monospace; text-transform: uppercase; }
.stat { display: grid; text-align: right; }
.stat span { color: #bcb79f; font: 10px system-ui; text-transform: uppercase; }
.stat strong { color: #ffd44d; font-variant-numeric: tabular-nums; }
.debug-toggle { font: 12px system-ui; color: #c9c9c0; }
.hud-button { padding: 5px 8px; border: 1px solid #9d8d62; color: #e7ddbc; background: #33362f; cursor: pointer; font: 11px system-ui; }
.rage { width: clamp(90px, 13vw, 160px); font: 9px system-ui; color: #ffb33f; }
.rage-track { height: 10px; margin-top: 3px; overflow: hidden; border: 1px solid #9a7438; background: #17130e; }
.rage-fill { width: 0; height: 100%; background: linear-gradient(90deg, #d7281e, #ffb52f); transition: width 120ms; }

.stage {
  position: relative;
  overflow: hidden;
  min-height: 0;
  border: 4px ridge #96845c;
  background: #090a08;
  cursor: none;
  transform-origin: center;
}

.stage.shake { animation: shake 90ms steps(2) both; }
.stage.hit-stop canvas { filter: contrast(1.2) brightness(1.18); }

#game { display: block; width: 100%; height: 100%; }

.instructions {
  position: absolute;
  left: 50%; bottom: 2.5%;
  translate: -50% 0;
  padding: 5px 10px;
  color: #fff2b5;
  background: #111c;
  border: 1px solid #dcc66e;
  font-size: clamp(8px, 1vw, 14px);
  letter-spacing: .08em;
  pointer-events: none;
}

.hit-label {
  position: absolute;
  z-index: 3;
  color: #ffed66;
  font-size: clamp(18px, 3vw, 46px);
  text-shadow: 3px 3px #7c1008;
  pointer-events: none;
  opacity: 0;
}

.hit-label.pop { animation: pop 420ms ease-out; }

.toolbelt { min-height: 52px; gap: 10px; justify-content: center; padding: 3px 8px; }
.tools { display: flex; gap: 5px; overflow-x: auto; padding: 3px; }
.tool, .reset {
  border: 2px outset #b8a66e;
  color: #f5eacb;
  background: #484b40;
  cursor: pointer;
}
.tool { display: grid; justify-items: center; gap: 1px; min-width: 58px; padding: 2px 5px; font-size: 10px; }
.tool.active { outline: 2px solid #e64a33; background: #5d543b; }
.tool:disabled { cursor: not-allowed; filter: grayscale(1) brightness(.55); }
.tool.rage-ready { animation: rage-pulse 500ms infinite alternate; filter: none; }
.tool img { width: 34px; height: 34px; object-fit: contain; }
.view-tools-label { align-self: stretch; display: grid; place-items: center; padding: 0 7px; border-left: 1px solid #8e7d55; color: #e58a65; font: bold 8px monospace; letter-spacing: .08em; writing-mode: vertical-rl; }
.view-tool { border-color: #d07350; background: #3b2c25; }
.status { min-width: 180px; color: #d4cfb7; font: 13px system-ui; text-align: center; }
.reset { padding: 9px 14px; }
.reset:hover { filter: brightness(1.2); }

.message-box {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 6px 10px;
  border-inline: 3px ridge #b6a16b;
  background: #272a24;
  font: 12px system-ui;
}
.message-box button { padding: 6px 12px; border: 2px outset #b8a66e; color: #ffe589; background: #4a4230; cursor: pointer; }
.rant-composer { display: flex; flex: 1; min-width: 280px; gap: 6px; }
.rant-composer input { flex: 1; min-width: 120px; padding: 7px 10px; border: 1px solid #82785a; color: #fff; background: #111; font: 13px system-ui; }
.rant-tags { order: 3; width: 100%; display: flex; gap: 5px; overflow-x: auto; padding: 2px 0; }
.rant-tags button { flex: 0 0 auto; padding: 3px 8px; border: 1px solid #7c271f; border-radius: 999px; color: #ffb5aa; background: #2b1110; font: 10px system-ui; }
.rant-tags button:hover { color: #fff; background: #8d1d16; }

.name-overlays { position: absolute; inset: 0; pointer-events: none; }
.name-control { position: absolute; z-index: 5; translate: -50% -100%; display: flex; gap: 3px; pointer-events: auto; }
.name-control input { display: none; width: 100px; padding: 4px 6px; border: 2px solid #e0c75d; color: #fff19b; background: #111e; cursor: text; font: 12px monospace; text-align: center; }
.name-overlays.editing .name-control input { display: block; }

.scene-menu { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; background: #080908d9; cursor: default; }
.scene-menu[hidden] { display: none; }
.scene-menu-panel { width: min(760px, 92%); padding: 14px; border: 3px ridge #b6a16b; background: linear-gradient(#373a33, #181a17); box-shadow: 0 18px 60px #000; }
.scene-menu-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.scene-menu-header h2 { margin: 0; color: #f2df9a; font-size: 18px; text-transform: uppercase; }
.scene-menu-header button { border: 1px solid #887b59; color: #fff; background: #491713; cursor: pointer; font-size: 20px; }
.scene-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.scene-card { position: relative; min-height: 150px; overflow: hidden; border: 3px solid #67675d; background-position: center; background-size: cover; cursor: pointer; }
.scene-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 45%, #000e); }
.scene-card span { position: absolute; z-index: 1; left: 10px; bottom: 8px; color: #fff1ae; font: bold 14px system-ui; text-shadow: 2px 2px #000; }
.scene-card:hover, .scene-card.active { border-color: #ffbd38; filter: brightness(1.12); }
.scene-card[data-scene="asianOffice"] { background-image: url("assets/backgrounds/office-japan-crowded-intact.png"); }
.scene-card[data-scene="meetingRoom"] { background-image: url("assets/backgrounds/meeting-room-intact.png"); }
.scene-card[data-scene="claude"] { background-image: url("assets/claude/indie-dev-workspace.png"); }
.scene-card[data-scene="airport"] { background-image: url("assets/backgrounds/airport-chaos-intact.png"); }
.scene-card[data-scene="fastFood"] { background-image: url("assets/backgrounds/fast-food-intact.png"); }
.scene-card[data-scene="classroom"] { background-image: url("assets/backgrounds/classroom-intact.png"); }

.stage.claude-glitch canvas { animation: claude-glitch 160ms steps(2); }

.shout {
  position: absolute;
  z-index: 4;
  max-width: 28%;
  color: #e31717;
  font: 900 clamp(10px, 1.45vw, 24px) Impact, sans-serif;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  overflow-wrap: anywhere;
  text-shadow: 2px 2px 0 #000;
  pointer-events: none;
  animation: shout-burst 1.5s cubic-bezier(.16,.8,.25,1) forwards;
}
.shout:nth-of-type(even) { color: #050505; text-shadow: 1px 1px 0 #e31717; }
.shout-icon { position: absolute; z-index: 4; font-size: clamp(18px, 3vw, 48px); pointer-events: none; animation: icon-throw 1.2s ease-out forwards; }

@keyframes shake {
  0% { transform: translate(0); }
  25% { transform: translate(-5px, 3px) rotate(-.15deg); }
  50% { transform: translate(5px, -2px); }
  75% { transform: translate(-3px, -1px) rotate(.15deg); }
  100% { transform: translate(0); }
}

@keyframes pop {
  0% { opacity: 1; scale: .6; translate: -50% -20%; }
  35% { opacity: 1; scale: 1.15; }
  100% { opacity: 0; scale: .9; translate: -50% -120%; }
}

@keyframes rage-pulse { to { outline: 3px solid #ff3a20; filter: brightness(1.4); } }
@keyframes shout-burst {
  0% { opacity: 0; scale: .1; rotate: -8deg; filter: blur(8px); }
  18% { opacity: 1; scale: 1.25; rotate: 3deg; filter: blur(0); }
  65% { opacity: 1; scale: .95; }
  100% { opacity: 0; scale: 1.5; translate: 0 -120px; }
}
@keyframes icon-throw {
  0% { opacity: 0; translate: 0 160px; scale: .2; rotate: -30deg; }
  25% { opacity: 1; scale: 1.4; }
  100% { opacity: 0; translate: 0 -220px; scale: .8; rotate: 35deg; }
}
@keyframes claude-glitch {
  0% { translate: 0; filter: none; }
  25% { translate: -5px 2px; filter: hue-rotate(80deg) contrast(1.5); }
  50% { translate: 5px -2px; filter: saturate(2); }
  100% { translate: 0; filter: none; }
}

@media (max-width: 650px) {
  .hud { min-height: 44px; }
  .brand { font-size: 12px; }
  .company span { display: none; }
  .debug-toggle { display: none; }
  .hud-button { font-size: 0; }
  .hud-button::first-letter { font-size: 16px; }
  .scene-button { font-size: 9px; }
  .scene-grid { grid-template-columns: 1fr 1fr; }
  .scene-card { min-height: 90px; }
  .toolbelt { min-height: 48px; }
  .message-box { padding: 4px; }
  .status { min-width: 0; font-size: 10px; }
  .tool span { display: none; }
  .tool { min-width: 38px; padding: 2px; }
  .tool img { width: 28px; height: 28px; }
  .reset { padding: 7px; font-size: 10px; }
}
