:root {
  --bg: #1a1410;
  --bg-2: #241b15;
  --paper: #f3e4c4;
  --paper-2: #e8d2a4;
  --ink: #1f1712;
  --muted: #8a7460;
  --stamp: #c42b1c;
  --gold: #e0b44a;
  --walk: #d9783a;
  --hitch: #2f7a6b;
  --danger: #c42b1c;
  --ok: #2f7a6b;
  --phone-w: 420px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  background:
    radial-gradient(1200px 600px at 50% -10%, #3a2a1c 0%, transparent 55%),
    #0c0a08;
  color: var(--paper);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.stage {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.phone {
  position: relative;
  width: min(100%, var(--phone-w));
  height: min(100dvh - 24px, 860px);
  background: var(--bg);
  border: 1px solid #3d2f24;
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
}

.grain {
  pointer-events: none;
  position: absolute;
  inset: 0;
  opacity: 0.08;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 5;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 28px 20px calc(20px + var(--safe-b));
  z-index: 1;
}

.hidden {
  display: none !important;
}

.screen-title {
  justify-content: flex-end;
  overflow: auto;
  background:
    linear-gradient(180deg, rgba(26, 20, 16, 0.15) 0%, #1a1410 72%),
    linear-gradient(160deg, #c45c3e 0%, #2a1c14 58%);
}

.eyebrow {
  letter-spacing: 0.18em;
  font-size: 12px;
  color: var(--gold);
  margin-bottom: 10px;
}

.logo {
  font-size: clamp(42px, 12vw, 56px);
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.logo-en {
  margin-top: 6px;
  letter-spacing: 0.42em;
  font-size: 11px;
  color: var(--muted);
}

.title-stamp {
  align-self: flex-start;
  margin: 18px 0 22px;
  padding: 6px 10px;
  border: 3px solid var(--stamp);
  color: var(--stamp);
  font-weight: 800;
  letter-spacing: 0.2em;
  transform: rotate(-8deg);
  opacity: 0.9;
}

.pitch {
  font-size: 16px;
  line-height: 1.7;
  margin-bottom: 12px;
}

.homage {
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  margin-bottom: 22px;
}

.how {
  margin-top: 12px;
  padding: 12px 14px;
  background: rgba(243, 228, 196, 0.08);
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.6;
  color: #d8c4a4;
}

.how p + p {
  margin-top: 6px;
}

.btn {
  width: 100%;
  min-height: 56px;
  border: 0;
  border-radius: 16px;
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.btn + .btn {
  margin-top: 10px;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--gold);
  color: var(--ink);
}

.btn-ghost {
  background: transparent;
  color: var(--paper);
  border: 1px solid #5a4636;
  min-height: 48px;
}

.btn-walk,
.btn-hitch {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 10px 16px;
  text-align: left;
}

.btn-walk {
  background: var(--walk);
  color: #fff8ee;
}

.btn-hitch {
  background: var(--hitch);
  color: #eef8f4;
}

.btn-title {
  font-size: 22px;
  letter-spacing: 0.12em;
}

.btn-sub {
  font-size: 12px;
  font-weight: 500;
  opacity: 0.88;
  margin-top: 2px;
}

.btn:disabled {
  opacity: 0.45;
  pointer-events: none;
}

.screen-play {
  padding: 0;
  background: var(--bg);
}

.hud {
  padding: 16px 16px 10px;
  background: #140f0c;
  border-bottom: 1px solid #3d2f24;
}

.hud-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.brand {
  font-weight: 800;
  letter-spacing: 0.16em;
}

.day {
  color: var(--gold);
  font-size: 13px;
}

.meters {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 10px;
}

.meter {
  background: var(--bg-2);
  border-radius: 12px;
  padding: 8px 10px;
}

.meter-k {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 2px;
}

.meter strong {
  font-size: 18px;
}

.bar {
  height: 8px;
  border-radius: 99px;
  background: #3a2c22;
  overflow: hidden;
  margin: 6px 0 4px;
}

.bar i {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #c42b1c, #e0b44a 55%, #2f7a6b);
  transform-origin: left center;
  transition: transform 0.25s ease;
}

.meter.money .bar i {
  background: linear-gradient(90deg, #c42b1c, #e0b44a);
}

.meter.low strong,
.meter.low .meter-k {
  color: #ffb4a8;
}

.route {
  list-style: none;
  display: flex;
  gap: 4px;
  margin-top: 10px;
}

.route li {
  flex: 1;
  height: 7px;
  border-radius: 99px;
  background: #3a2c22;
}

.route li.done {
  background: var(--gold);
}

.route li.now {
  background: var(--stamp);
}

.scene {
  flex: 1;
  overflow: auto;
  padding: 14px 16px 8px;
}

.scene-art {
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid #3d2f24;
}

.road-svg {
  display: block;
  width: 100%;
  height: auto;
}

.where-k {
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.where {
  font-size: 26px;
  line-height: 1.25;
  margin: 2px 0 4px;
}

.next {
  color: var(--gold);
  font-size: 14px;
  margin-bottom: 8px;
}

.hint {
  color: #d8c4a4;
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 14px;
}

.log {
  list-style: none;
  border-top: 1px dashed #3d2f24;
  padding-top: 10px;
}

.log li {
  font-size: 12px;
  color: #b9a48c;
  line-height: 1.55;
  padding: 3px 0;
}

.actions {
  padding: 10px 16px calc(14px + var(--safe-b));
  background: #140f0c;
  border-top: 1px solid #3d2f24;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  background: rgba(8, 6, 4, 0.72);
  display: flex;
  align-items: flex-end;
  padding: 16px 16px calc(16px + var(--safe-b));
}

.card {
  width: 100%;
  background: var(--paper);
  color: var(--ink);
  border-radius: 22px 22px 18px 18px;
  padding: 22px 18px 16px;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.35);
  animation: rise 0.22s ease;
}

@keyframes rise {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.card-kind {
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--stamp);
  font-weight: 800;
}

.card-title {
  font-size: 28px;
  margin: 6px 0 10px;
}

.card-text {
  font-size: 15px;
  line-height: 1.7;
}

.deltas {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 8px;
}

.pill {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 700;
  background: #ead7b0;
}

.pill.up { color: var(--ok); }
.pill.down { color: var(--danger); }
.pill.flat { color: #6b5846; }

.card-move {
  font-size: 13px;
  color: #6b5846;
  margin-bottom: 16px;
}

.end-stats {
  list-style: none;
  margin: 14px 0 18px;
  padding: 10px 12px;
  background: #ead7b0;
  border-radius: 12px;
}

.end-stats li {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 4px 0;
}

.end-card .card-kind.win { color: var(--ok); }
.end-card .card-kind.fail { color: var(--stamp); }

@media (max-width: 440px) {
  .stage { padding: 0; }
  .phone {
    width: 100%;
    height: 100dvh;
    border-radius: 0;
    border: 0;
  }
}
