:root {
  --paper: #F1E4CB;
  --paper-2: #E8D7B5;
  --paper-3: #F7EDD8;
  --ink: #241F1B;
  --ink-soft: #4A4038;
  --red: #C0452C;
  --red-deep: #96331F;
  --teal: #2C6A61;
  --mustard: #DFA22B;
  --brass: #B08A4A;
  --wood: #7B5233;
  --blue: #6E8FA3;
  --line: rgba(44, 92, 130, 0.18);
  --shadow: 0 10px 24px rgba(36, 31, 27, 0.24);
  --display: 'Alfa Slab One', Georgia, 'Times New Roman', serif;
  --text: 'Karla', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Space Mono', ui-monospace, 'Courier New', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #DCC9A4;
  color: var(--ink);
  font-family: var(--text);
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

#game {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 30% 10%, #E8D6B0 0%, #DCC9A4 55%, #D2BD96 100%);
}

#world {
  position: absolute;
  inset: 0;
}
#world canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  touch-action: none;
}

#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 20;
}

.hud-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) 12px 0;
}

.brand { flex: 0 1 auto; min-width: 0; }
.brand-plate {
  position: relative;
  display: inline-block;
  filter: drop-shadow(0 4px 8px rgba(36, 31, 27, 0.22));
  transform: rotate(-1.1deg);
}
.brand-sign {
  display: block;
  width: clamp(132px, 17vw, 216px);
  height: auto;
}
.brand-word {
  position: absolute;
  white-space: nowrap;
  inset: 0;
  display: grid;
  place-items: center;
  padding-bottom: 2%;
  font-family: var(--display);
  font-size: clamp(15px, 2.1vw, 27px);
  letter-spacing: 0.045em;
  text-transform: uppercase;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}
.brand-day {
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: clamp(8px, 1vw, 10px);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  white-space: nowrap;
}
.brand-dot { color: var(--red); }

.stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
  pointer-events: none;
  flex: 1 1 auto;
}
.stat {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 4px 11px 4px 8px;
  background:
    linear-gradient(180deg, var(--paper-3), var(--paper));
  border: 1.6px solid var(--ink);
  border-radius: 7px;
  box-shadow: 2px 3px 0 rgba(36, 31, 27, 0.14);
  font-family: var(--mono);
  font-size: clamp(11px, 1.1vw, 14px);
  white-space: nowrap;
}
.stat b { font-weight: 700; }
.stat-label {
  font-family: var(--text);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.stat-ico { width: 26px; height: 26px; object-fit: contain; }
.stat.cash b { color: var(--teal); }
.stat.energy { gap: 6px; }
.ebar {
  display: block;
  width: clamp(44px, 6vw, 86px);
  height: 12px;
  border: 1.4px solid var(--ink);
  border-radius: 3px;
  background: #FFF8E8;
  overflow: hidden;
}
.ebar i {
  display: block;
  height: 100%;
  width: 72%;
  background: repeating-linear-gradient(90deg, var(--mustard) 0 6px, #C98C1C 6px 8px);
  transition: width 0.35s ease;
}
.stat.career { gap: 6px; }
.stat-next { color: var(--ink-soft); font-family: var(--text); font-size: 10.5px; }
.stat.low .ebar i { background: repeating-linear-gradient(90deg, var(--red) 0 6px, var(--red-deep) 6px 8px); }

.tools {
  display: flex;
  gap: 7px;
  align-items: flex-start;
  pointer-events: auto;
  flex: 0 0 auto;
}
.tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-width: 46px;
  height: 44px;
  padding: 3px 7px;
  background: var(--paper);
  border: 1.6px solid var(--ink);
  border-radius: 7px;
  box-shadow: 2px 3px 0 rgba(36, 31, 27, 0.16);
  font-family: var(--text);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--ink);
  cursor: pointer;
}
.tool img { width: 22px; height: 16px; object-fit: contain; }
.tool.round {
  min-width: 44px;
  width: 44px;
  border-radius: 50%;
  font-family: var(--display);
  font-size: 18px;
  line-height: 1;
}
.tool:active { transform: translateY(1px); box-shadow: 1px 2px 0 rgba(36, 31, 27, 0.16); }
.tool:focus-visible, .act:focus-visible, #actBtn:focus-visible, button:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
}
.tool[aria-pressed="true"] { background: #3A4463; color: var(--paper); border-color: #241F1B; }
.lamp-mark {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  background: radial-gradient(circle at 35% 35%, #FFE9A8, var(--mustard) 60%, #A36F12);
  box-shadow: 0 0 0 2px rgba(223, 162, 43, 0.25);
}
.tool[aria-pressed="true"] .lamp-mark { background: #FFF3CC; box-shadow: 0 0 12px 3px rgba(255, 236, 170, 0.55); }

#hintBar {
  position: absolute;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  transform: translateX(-50%) rotate(-0.35deg);
  max-width: min(620px, calc(100vw - 210px));
  padding: 7px 15px;
  background: var(--paper-3);
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  box-shadow: 2px 3px 0 rgba(36, 31, 27, 0.16);
  font-family: var(--mono);
  font-size: clamp(10px, 1.1vw, 12.5px);
  color: var(--ink);
  text-align: center;
  z-index: 22;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
#hintBar.near { background: #FBE9C9; border-color: var(--red-deep); }
#hintBar.hide { opacity: 0; }

#joystick {
  position: absolute;
  left: max(18px, env(safe-area-inset-left));
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 24;
  display: none;
  touch-action: none;
  width: 118px;
  height: 118px;
}
#joystick.on { display: block; }
#stickBase {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(36, 31, 27, 0.62);
  background: radial-gradient(circle at 40% 35%, rgba(247, 237, 216, 0.82), rgba(232, 215, 181, 0.62));
  box-shadow: inset 0 3px 10px rgba(36, 31, 27, 0.18), 0 4px 10px rgba(36, 31, 27, 0.16);
}
#stickKnob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 54px;
  height: 54px;
  margin: -27px 0 0 -27px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: radial-gradient(circle at 38% 32%, #D4684F, var(--red) 62%, #9A3623);
  box-shadow: 0 4px 8px rgba(36, 31, 27, 0.3);
}
#joystick.nudge #stickKnob { transition: transform 0.12s ease-out; }

#actBtn {
  position: absolute;
  right: max(20px, env(safe-area-inset-right));
  bottom: calc(26px + env(safe-area-inset-bottom));
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 2.5px solid var(--ink);
  background: radial-gradient(circle at 40% 32%, #D4684F, var(--red) 58%, #96331F);
  color: #FFF5DF;
  font-family: var(--text);
  box-shadow: 0 6px 0 #7E2A19, 0 10px 18px rgba(36, 31, 27, 0.3);
  cursor: pointer;
  touch-action: manipulation;
}
#actBtn b { font-family: var(--display); font-size: 22px; line-height: 1; font-weight: 400; }
#actBtn span { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-align: center; padding: 0 4px; }
#actBtn:active { transform: translateY(3px); box-shadow: 0 3px 0 #7E2A19, 0 6px 12px rgba(36, 31, 27, 0.3); }
#actBtn[hidden] { display: none; }

body.touch #hintBar { bottom: calc(18px + env(safe-area-inset-bottom)); max-width: calc(100vw - 250px); }

#toast {
  position: absolute;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translate(-50%, 12px) rotate(-0.5deg);
  z-index: 40;
  max-width: min(460px, calc(100vw - 40px));
  padding: 10px 16px;
  background: #FBE9C9;
  border: 1.7px solid var(--ink);
  border-radius: 4px;
  box-shadow: var(--shadow);
  font-family: var(--text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
#toast.show { opacity: 1; transform: translate(-50%, 0) rotate(-0.5deg); }
#toast.bad { background: #F6D9CE; }

#fade {
  position: absolute;
  inset: 0;
  background: #1B1714;
  opacity: 0;
  pointer-events: none;
  z-index: 60;
  transition: opacity 0.45s ease;
}
#fade.on { opacity: 1; }
#fade.stay { transition: none; opacity: 1; }

#startWrap {
  position: absolute;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 16px;
  background:
    radial-gradient(120% 100% at 30% 0%, rgba(241, 228, 203, 0.4), rgba(120, 91, 62, 0.42) 78%),
    radial-gradient(90% 90% at 70% 100%, rgba(44, 106, 97, 0.12), transparent 60%);
  overflow: auto;
}
#startWrap.gone { display: none; }
#startCard {
  position: relative;
  width: min(680px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: auto;
  padding: 18px clamp(16px, 3vw, 30px) 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), transparent 30%),
    repeating-linear-gradient(180deg, transparent 0 27px, var(--line) 27px 28px),
    var(--paper);
  border: 2px solid var(--ink);
  border-radius: 3px;
  box-shadow: 0 22px 44px rgba(30, 24, 18, 0.4), inset 0 0 60px rgba(176, 138, 74, 0.14);
  transform: rotate(-0.4deg);
}
#startCard::before,
#startCard::after {
  content: '';
  position: absolute;
  top: -12px;
  width: 92px;
  height: 26px;
  background: rgba(226, 210, 170, 0.85);
  border: 1px solid rgba(123, 82, 51, 0.25);
  box-shadow: 0 2px 5px rgba(36, 31, 27, 0.12);
}
#startCard::before { left: 14px; transform: rotate(-3deg); }
#startCard::after { right: 14px; transform: rotate(2.5deg); }

.start-head { text-align: center; }
.start-sign {
  position: relative;
  display: inline-block;
  width: min(440px, 90%);
  filter: drop-shadow(0 5px 8px rgba(36, 31, 27, 0.22));
}
.start-sign img { display: block; width: 100%; height: auto; }
.start-sign h1 {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  padding-bottom: 2%;
  font-family: var(--display);
  font-size: clamp(30px, 7.2vw, 56px);
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink);
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.4);
}
.start-line {
  margin-top: 7px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.start-body {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin: 16px 0 6px;
  padding-top: 12px;
  border-top: 2px solid var(--red);
}
.start-face {
  width: clamp(84px, 18vw, 128px);
  height: auto;
  border: 4px solid #FBF3E2;
  box-shadow: 0 2px 7px rgba(36, 31, 27, 0.25);
  transform: rotate(-2.4deg);
  flex: 0 0 auto;
}
.start-words { min-width: 0; }
.start-hello {
  margin: 0 0 6px;
  font-family: var(--display);
  font-size: clamp(16px, 3vw, 21px);
  font-weight: 400;
  line-height: 1.2;
  color: var(--ink);
}
.start-goal {
  margin: 0 0 10px;
  font-size: clamp(13px, 2.6vw, 15px);
  line-height: 1.42;
  color: var(--ink-soft);
}
.start-keys {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 14px;
  font-size: clamp(11.5px, 2.4vw, 13px);
  line-height: 1.35;
  color: var(--ink-soft);
}
.start-keys li::before { content: '▸ '; color: var(--red); }
.start-keys b { color: var(--ink); }
.start-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1.5px dashed rgba(36, 31, 27, 0.3);
}
.start-save { font-family: var(--mono); font-size: 10px; color: var(--ink-soft); letter-spacing: 0.03em; }
#startBtn {
  padding: 12px 24px;
  min-height: 48px;
  background: var(--red);
  color: #FFF6E5;
  border: 2px solid var(--ink);
  border-radius: 5px;
  box-shadow: 0 4px 0 #7E2A19;
  font-family: var(--display);
  font-size: clamp(14px, 2.8vw, 17px);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}
#startBtn:disabled { opacity: 0.6; cursor: default; box-shadow: 0 2px 0 #7E2A19; }
#startBtn:not(:disabled):active { transform: translateY(3px); box-shadow: 0 1px 0 #7E2A19; }

#sheetWrap {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 14px;
}
#sheetWrap[hidden] { display: none; }
#sheetBackdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 23, 18, 0.42);
  backdrop-filter: blur(1.5px);
}
#sheet {
  position: relative;
  width: min(620px, 100%);
  max-height: min(78vh, 760px);
  overflow: auto;
  padding: 20px clamp(16px, 3vw, 28px) 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 22%),
    repeating-linear-gradient(180deg, transparent 0 27px, var(--line) 27px 28px),
    var(--paper);
  border: 2px solid var(--ink);
  border-radius: 4px;
  box-shadow: 0 -8px 40px rgba(20, 16, 12, 0.45);
  transform: rotate(-0.25deg);
  animation: sheetIn 0.2s ease-out;
  outline: none;
}
@keyframes sheetIn { from { transform: translateY(18px) rotate(-0.25deg); opacity: 0.4; } }
.sheet-tape {
  position: absolute;
  top: -10px;
  left: 50%;
  width: 110px;
  height: 22px;
  margin-left: -55px;
  background: rgba(226, 210, 170, 0.9);
  border: 1px solid rgba(123, 82, 51, 0.24);
  box-shadow: 0 2px 5px rgba(36, 31, 27, 0.12);
  transform: rotate(-2deg);
}
#sheetClose {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 40px;
  height: 40px;
  border: 1.6px solid var(--ink);
  border-radius: 50%;
  background: var(--paper-3);
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}
.sheet-kicker {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--red-deep);
  margin: 0 0 2px;
}
.sheet-title {
  margin: 0 0 4px;
  font-family: var(--display);
  font-size: clamp(22px, 4.6vw, 30px);
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 1.05;
  padding-right: 34px;
}
.sheet-under {
  width: 74px;
  height: 5px;
  margin: 4px 0 13px;
  background: var(--red);
  border-radius: 2px;
  transform: rotate(-0.8deg);
}
.sheet-text {
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink-soft);
  margin: 0 0 10px;
}
.sheet-text b { color: var(--ink); }
.crew-line {
  margin: 0 0 10px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--ink-soft);
}
.crew-line b { color: var(--ink); }
.panel-art {
  display: block;
  width: min(240px, 62%);
  height: auto;
  margin: 4px auto 10px;
  filter: drop-shadow(0 4px 6px rgba(36, 31, 27, 0.2));
}
.big-money {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--display);
  font-size: clamp(28px, 7vw, 44px);
  line-height: 1;
  margin: 6px 0 2px;
}
.big-money small { font-family: var(--text); font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.money-meta { font-family: var(--mono); font-size: 11.5px; color: var(--ink-soft); margin-bottom: 12px; }

.career-plate {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 10px 12px;
  margin: 0 0 12px;
  background: var(--paper-3);
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  box-shadow: 2px 2px 0 rgba(36, 31, 27, 0.1);
}
.career-job { font-family: var(--display); font-size: 18px; font-weight: 400; }
.career-pips { display: inline-flex; gap: 4px; }
.career-pips i { width: 10px; height: 10px; border: 1.4px solid var(--ink); border-radius: 50%; background: transparent; }
.career-pips i.on { background: var(--mustard); }
.career-meta { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--ink-soft); }

.row-list { display: grid; gap: 8px; margin: 6px 0 12px; }
.row {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 11px;
  background: rgba(255, 250, 238, 0.72);
  border: 1.4px solid rgba(36, 31, 27, 0.72);
  border-radius: 5px;
  text-align: left;
  color: var(--ink);
  font-family: var(--text);
  cursor: pointer;
}
.row:disabled { cursor: default; opacity: 0.6; }
.row:not(:disabled):active { transform: translateY(1px); }
.row-ico { width: 34px; height: 34px; object-fit: contain; flex: 0 0 auto; }
.row-words { display: grid; gap: 1px; min-width: 0; }
.row-name { font-weight: 700; font-size: 14px; line-height: 1.2; }
.row-note { font-size: 11.5px; color: var(--ink-soft); line-height: 1.25; }
.row-cost { margin-left: auto; font-family: var(--mono); font-size: 12.5px; white-space: nowrap; color: var(--teal); }
.row-cost.spend { color: var(--red-deep); }
.row.done { background: rgba(223, 162, 43, 0.15); }
.row.done .row-name::after { content: ' · done today'; font-family: var(--text); font-size: 10.5px; font-weight: 600; color: var(--ink-soft); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  background: var(--paper-3);
  border: 1.4px solid var(--ink);
  border-radius: 5px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}
.chip img { width: 22px; height: 22px; object-fit: contain; }
.chip .pips { display: inline-flex; gap: 3px; }
.chip .pips i { width: 7px; height: 7px; border: 1px solid var(--ink); border-radius: 50%; }
.chip .pips i.on { background: var(--mustard); }
.chip.sound { opacity: 1; }

.goal-note { margin: 4px 0 12px; }
.goal-bar { height: 11px; border: 1.4px solid var(--ink); border-radius: 3px; background: #FFF8E8; overflow: hidden; }
.goal-bar i { display: block; height: 100%; background: repeating-linear-gradient(90deg, var(--teal) 0 8px, #245A52 8px 10px); }
.goal-line { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11.5px; margin-bottom: 4px; color: var(--ink-soft); }

.ledger { margin-top: 6px; border-top: 2px solid var(--red); }
.ledger-head, .ledger-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 72px 72px 82px;
  gap: 4px;
  padding: 5px 2px;
  font-family: var(--mono);
  font-size: 11px;
  align-items: baseline;
}
.ledger-head { color: var(--ink-soft); font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase; border-bottom: 1px solid rgba(36, 31, 27, 0.3); }
.ledger-row { border-bottom: 1px solid rgba(44, 92, 130, 0.16); }
.ledger-row .desc { font-family: var(--text); font-weight: 600; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ledger-row .num { text-align: right; white-space: nowrap; }
.ledger-row .in { color: var(--teal); }
.ledger-row .out { color: var(--red-deep); }
.ledger-row .bal { color: var(--ink); font-weight: 700; }
.ledger-scroll { max-height: 34vh; overflow: auto; }
.link-btn {
  margin-top: 10px;
  padding: 9px 14px;
  min-height: 42px;
  background: var(--paper-3);
  border: 1.5px solid var(--ink);
  border-radius: 5px;
  font-family: var(--text);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}
.link-btn.primary { background: var(--teal); color: #F2F7EC; }
.link-btn.primary:active { transform: translateY(1px); }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.sheet-foot { margin-top: 12px; padding-top: 9px; border-top: 1.5px dashed rgba(36, 31, 27, 0.28); font-family: var(--mono); font-size: 10px; color: var(--ink-soft); display: flex; justify-content: space-between; gap: 10px; }

.help-list { margin: 4px 0 8px; padding-left: 18px; font-size: 13px; line-height: 1.55; color: var(--ink-soft); }
.help-list b { color: var(--ink); }
.help-list li { margin-bottom: 4px; }

@media (max-width: 760px) {
  .hud-top { flex-wrap: wrap; row-gap: 6px; gap: 6px; padding-left: 8px; padding-right: 8px; }
  .brand { order: 1; }
  .tools { order: 2; margin-left: auto; }
  .stats { order: 3; flex-basis: 100%; justify-content: flex-start; gap: 5px; overflow-x: auto; padding-bottom: 2px; }
  .brand-sign { width: clamp(118px, 32vw, 168px); }
  .brand-word { font-size: clamp(14px, 4.4vw, 21px); }
  .brand-day { font-size: 7.5px; letter-spacing: 0.08em; gap: 4px; }
  .stat { height: 34px; padding: 3px 8px 3px 6px; font-size: 11px; gap: 5px; flex: 0 0 auto; }
  .stat-ico { width: 20px; height: 20px; }
  .stat-label { display: none; }
  .stat.career { max-width: none; }
  .stat-next { display: none; }
  .ebar { width: 40px; height: 10px; }
  .tools { gap: 5px; }
  .tool { min-width: 40px; height: 40px; padding: 2px 5px; font-size: 9px; }
  .tool.round { min-width: 40px; width: 40px; }
  .tool img { width: 18px; height: 13px; }
  #hintBar { bottom: calc(100px + env(safe-area-inset-bottom)); top: auto; max-width: calc(100vw - 20px); font-size: 10.5px; }
  body.touch #hintBar { bottom: calc(150px + env(safe-area-inset-bottom)); max-width: calc(100vw - 24px); }
  #toast { bottom: calc(160px + env(safe-area-inset-bottom)); }
  #actBtn { width: 78px; height: 78px; }
  #joystick { width: 108px; height: 108px; }
  #stickKnob { width: 50px; height: 50px; margin: -25px 0 0 -25px; }
  .start-keys { grid-template-columns: 1fr; }
  .start-body { gap: 12px; }
  .start-face { width: 86px; }
  #sheetWrap { padding: 0; align-items: flex-end; }
  #sheet { width: 100%; max-height: 82vh; border-radius: 12px 12px 0 0; padding-bottom: calc(16px + env(safe-area-inset-bottom)); transform: none; }
  .ledger-head, .ledger-row { grid-template-columns: 34px minmax(0, 1fr) 0 64px 74px; }
  .ledger-head span:nth-child(3), .ledger-row .in { display: none; }
  .ledger-row .desc { font-size: 11.5px; }
}

@media (max-width: 430px) {
  .brand-day .brand-dot, .brand-day span:last-child { display: none; }
  .stat.cash b { font-size: 11px; }
  .tool span:not(.lamp-mark) { display: none; }
  .tool { min-width: 40px; padding: 0; }
  .start-line { letter-spacing: 0.09em; font-size: 9.5px; }
}

@media (max-height: 660px) {
  #sheet { padding-top: 12px; max-height: 92vh; }
  .start-sign { width: min(320px, 84%); }
  .panel-art { width: min(158px, 38%); margin: 2px auto 6px; }
  .sheet-title { font-size: clamp(20px, 4vw, 26px); }
  .sheet-under { margin: 3px 0 8px; }
  .sheet-kicker { font-size: 9.5px; }
  .sheet-text { font-size: 12.5px; margin-bottom: 7px; }
  .row { padding: 6px 10px; }
  .row-ico { width: 28px; height: 28px; }
  .row-name { font-size: 13px; }
  .chips { gap: 6px; margin: 2px 0 8px; }
  .chip { padding: 5px 8px; }
  .sheet-foot { margin-top: 8px; }
  .big-money { font-size: 30px; margin: 2px 0; }
  .ledger-scroll { max-height: 26vh; }
  #startCard { padding: 10px 18px 12px; }
  .start-body { margin: 8px 0 4px; padding-top: 8px; }
  .start-face { width: 74px; }
  .start-keys { grid-template-columns: 1fr 1fr; }
  .start-goal { margin-bottom: 6px; }
  .start-foot { margin-top: 8px; padding-top: 8px; }
}

@media (max-height: 500px) and (min-width: 700px) {
  .hud-top { padding-top: max(4px, env(safe-area-inset-top)); gap: 6px; }
  .brand-sign { width: clamp(104px, 13vw, 150px); }
  .brand-word { font-size: clamp(13px, 2.2vw, 18px); }
  .brand-day { margin-top: 2px; font-size: 8px; letter-spacing: 0.07em; gap: 3px; }
  .brand-day .brand-dot, .brand-day span:last-child { display: none; }
  .stats { gap: 5px; }
  .stat { height: 32px; padding: 2px 8px 2px 6px; font-size: 11px; gap: 5px; }
  .stat-ico { width: 20px; height: 20px; }
  .stat-label, .stat-next { display: none; }
  .ebar { width: 44px; height: 10px; }
  .tools { gap: 5px; }
  .tool { min-width: 38px; height: 38px; padding: 2px 5px; font-size: 9px; }
  .tool.round { min-width: 38px; width: 38px; height: 38px; font-size: 16px; }
  .tool img { width: 18px; height: 13px; }
}

@media (max-height: 460px) and (min-width: 700px) {
  #joystick { width: 96px; height: 96px; }
  #stickKnob { width: 44px; height: 44px; margin: -22px 0 0 -22px; }
  #hintBar { bottom: 8px; }
  #actBtn { width: 70px; height: 70px; bottom: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  #sheet, #startCard { animation: none; }
  #toast, .ebar i, #fade { transition: none; }
}
