/* 打工猫 — 视觉沿用 tyurry 生态 token（暖白 / 赤陶 / 无 emoji） */
:root {
  --bg: #FAF7F2;
  --paper: #FFFFFF;
  --panel: #F4F0E9;
  --rule: #E8E2D9;
  --rule-soft: #F0EBE3;
  --ink: #2A2723;
  --ink-2: #6F6A62;
  --ink-3: #8C857A;
  --terracotta: #BC5230;
  --terracotta-deep: #9E4226;
  --tint: #F3E3DA;
  --amber: #C08A2E;
  --green: #4E7A52;
  --r: 8px;
  --sans: "PingFang SC", "Noto Sans SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "Songti TC", Georgia, serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  user-select: none;
  overscroll-behavior: none;
}
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

#boot {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--bg); color: var(--ink-2); font-size: 14px; z-index: 90;
  letter-spacing: .04em;
}
#boot.is-hidden { display: none; }

/* ── HUD ── */
.hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  padding: calc(10px + var(--safe-t)) calc(12px + var(--safe-r)) 0 calc(12px + var(--safe-l));
  pointer-events: none;
}
.hud__row { display: flex; align-items: center; gap: 10px; }
.hud__score {
  display: flex; align-items: baseline; gap: 6px;
  background: rgba(255,255,255,.86); border: 1px solid var(--rule);
  border-radius: var(--r); padding: 5px 10px; min-width: 86px;
}
.hud__label { font-size: 11px; color: var(--ink-3); letter-spacing: .06em; }
.hud__score b { font-size: 18px; font-variant-numeric: tabular-nums; }
.hud__time { flex: 1; display: flex; align-items: center; gap: 8px; }
.hud__timebar {
  flex: 1; height: 6px; background: rgba(232,226,217,.9); border-radius: 999px; overflow: hidden;
}
.hud__timebar i {
  display: block; height: 100%; width: 100%; background: var(--terracotta);
  border-radius: 999px; transition: width .2s linear, background .3s;
}
.hud__timebar i.is-low { background: var(--terracotta-deep); }
.hud__time span { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; min-width: 30px; text-align: right; }
.hud__right { display: flex; align-items: center; gap: 6px; }
.hud__lives { display: flex; gap: 3px; }
.paw { width: 20px; height: 20px; display: block; color: var(--terracotta); }
.paw svg { width: 100%; height: 100%; fill: currentColor; }
.paw--lost { color: var(--rule); }
.iconbtn {
  pointer-events: auto; width: 32px; height: 32px; padding: 0; border: 1px solid var(--rule);
  background: rgba(255,255,255,.86); border-radius: var(--r); color: var(--ink-2);
  display: grid; place-items: center; cursor: pointer;
}
.iconbtn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.iconbtn.is-muted { color: var(--rule); }
.iconbtn.is-muted .wave { display: none; }

.hud__hint {
  margin: 8px auto 0; max-width: 420px; text-align: center;
  font-size: 13px; color: var(--ink); background: rgba(255,255,255,.9);
  border: 1px solid var(--rule); border-radius: 999px; padding: 5px 14px;
  transition: opacity .2s;
}
.hud__hint.is-empty { opacity: 0; }

/* ── 提示条 / 飘字 ── */
.banner {
  position: fixed; left: 50%; top: calc(104px + var(--safe-t)); transform: translate(-50%, -8px);
  background: var(--terracotta); color: #fff; border-radius: var(--r);
  padding: 8px 16px; text-align: center; z-index: 30; opacity: 0; pointer-events: none;
  transition: opacity .12s, transform .12s;
  box-shadow: 0 6px 18px rgba(188,82,48,.25);
}
.banner.is-on { opacity: 1; transform: translate(-50%, 0); animation: pulse .55s ease-in-out infinite; }
.banner__title { font-size: 15px; font-weight: 700; letter-spacing: .02em; }
.banner__sub { font-size: 11px; opacity: .85; margin-top: 2px; }
@keyframes pulse { 0%,100% { box-shadow: 0 6px 18px rgba(188,82,48,.25); } 50% { box-shadow: 0 6px 26px rgba(188,82,48,.55); } }

.toast {
  position: fixed; left: 50%; bottom: calc(196px + var(--safe-b)); transform: translate(-50%, 6px);
  background: rgba(255,255,255,.95); color: var(--ink); font-size: 12px; padding: 6px 14px;
  border: 1px solid var(--rule); border-radius: 999px; z-index: 25; opacity: 0; pointer-events: none;
  transition: opacity .18s, transform .18s; white-space: nowrap; max-width: 88vw;
  box-shadow: 0 3px 12px rgba(42,39,35,.07);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

.flash { position: fixed; inset: 0; background: var(--terracotta); opacity: 0; z-index: 40; pointer-events: none; }
.flash.is-on { animation: flash .5s ease-out; }
@keyframes flash { 0% { opacity: .5; } 100% { opacity: 0; } }

.floaters { position: fixed; inset: 0; pointer-events: none; z-index: 22; }
.floater {
  position: absolute; transform: translate(-50%, -50%);
  font-size: 15px; font-weight: 700; color: var(--terracotta-deep);
  text-shadow: 0 1px 0 #fff, 0 0 10px rgba(255,255,255,.9);
  animation: floatup .9s ease-out forwards;
}
@keyframes floatup {
  0% { opacity: 0; transform: translate(-50%, -40%) scale(.8); }
  25% { opacity: 1; transform: translate(-50%, -60%) scale(1.05); }
  100% { opacity: 0; transform: translate(-50%, -140%) scale(1); }
}

.diag {
  position: fixed; left: 8px; bottom: calc(8px + var(--safe-b)); z-index: 50;
  font: 11px/1.35 ui-monospace, monospace; color: var(--ink-2);
  background: rgba(255,255,255,.85); border: 1px solid var(--rule);
  border-radius: 4px; padding: 4px 6px; pointer-events: none; display: none;
}
body.diag-on .diag { display: block; }

/* ── 控件 ── */
.controls { position: fixed; inset: auto 0 0 0; z-index: 24; pointer-events: none; }
.joy {
  position: absolute; left: calc(18px + var(--safe-l)); bottom: calc(22px + var(--safe-b));
  width: 132px; height: 132px; border-radius: 50%;
  background: rgba(255,255,255,.55); border: 1px solid rgba(232,226,217,.95);
  pointer-events: auto; touch-action: none;
  box-shadow: inset 0 0 0 6px rgba(255,255,255,.35);
}
.joy__knob {
  position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px;
  border-radius: 50%; background: rgba(255,255,255,.95);
  border: 1px solid var(--rule); box-shadow: 0 2px 6px rgba(42,39,35,.12);
  transition: transform .04s linear;
}
.actions {
  position: absolute; right: calc(18px + var(--safe-r)); bottom: calc(22px + var(--safe-b));
  display: flex; gap: 12px; pointer-events: auto;
}
.abtn {
  width: 76px; height: 76px; border-radius: 50%; border: 1px solid var(--terracotta);
  background: rgba(255,255,255,.94); color: var(--terracotta-deep);
  font-family: var(--sans); font-size: 16px; font-weight: 700;
  display: grid; place-items: center; gap: 0; cursor: pointer; touch-action: none;
  box-shadow: 0 3px 10px rgba(42,39,35,.10);
}
.abtn small { font-size: 10px; font-weight: 500; color: var(--ink-3); letter-spacing: .08em; }
.abtn--claw { background: var(--terracotta); color: #fff; border-color: var(--terracotta-deep); }
.abtn--claw small { color: rgba(255,255,255,.75); }
.abtn.is-down { transform: scale(.94); }
.abtn--sleep.is-down { background: var(--tint); }

/* ── 页面（开始 / 结算） ── */
.screen {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: calc(16px + var(--safe-t)) 16px calc(16px + var(--safe-b));
  background: rgba(250,247,242,.93);
  overflow-y: auto;
}
.screen.is-hidden { display: none; }
.card {
  width: 100%; max-width: 380px; background: var(--paper);
  border: 1px solid var(--rule); border-radius: 12px;
  padding: 26px 22px 22px;
  box-shadow: 0 10px 40px rgba(42,39,35,.08);
}
.brandline { display: flex; align-items: center; gap: 8px; }
.catmark { width: 30px; height: 30px; fill: var(--terracotta); }
.catmark .eye { fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; }
.eyebrow { font-size: 11px; letter-spacing: .16em; color: var(--ink-3); }
h1 {
  font-family: var(--serif); font-size: 40px; line-height: 1.1; margin: 14px 0 8px;
  letter-spacing: .04em;
}
h2 { font-family: var(--serif); font-size: 24px; margin: 10px 0 6px; letter-spacing: .02em; }
.lead { font-size: 13px; line-height: 1.65; color: var(--ink-2); margin: 0 0 16px; }
.howto { list-style: none; margin: 0 0 20px; padding: 0; border-top: 1px solid var(--rule-soft); }
.howto li {
  font-size: 12.5px; color: var(--ink-2); padding: 9px 0;
  border-bottom: 1px solid var(--rule-soft); line-height: 1.5;
}
.howto b { color: var(--ink); margin-right: 6px; font-weight: 700; }
.btn {
  width: 100%; min-height: 48px; border-radius: var(--r);
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 15px; font-weight: 600; cursor: pointer;
  letter-spacing: .04em;
}
.btn--primary {
  background: var(--terracotta); border-color: var(--terracotta-deep); color: #fff;
}
.btn:active { transform: translateY(1px); }
.fineprint { font-size: 11px; color: var(--ink-3); text-align: center; margin: 12px 0 0; }
.btnrow { display: flex; gap: 10px; margin-top: 18px; }
.btnrow .btn { flex: 1; }

.scoreline {
  display: flex; align-items: baseline; justify-content: space-between;
  border-top: 1px solid var(--rule-soft); border-bottom: 1px solid var(--rule-soft);
  padding: 10px 0; margin: 12px 0;
}
.scoreline span { font-size: 12px; color: var(--ink-3); letter-spacing: .06em; }
.scoreline b { font-family: var(--serif); font-size: 34px; color: var(--terracotta-deep); font-variant-numeric: tabular-nums; }
.res-stats { display: grid; gap: 6px; }
.res-row { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-2); }
.res-row b { color: var(--ink); font-variant-numeric: tabular-nums; }

.stamp {
  position: fixed; left: 50%; bottom: calc(4px + var(--safe-b)); transform: translateX(-50%);
  font-size: 9px; color: rgba(140,133,122,.65); letter-spacing: .08em; z-index: 5;
  pointer-events: none;
}

/* 横屏 / 宽屏：控件缩一点，别挡画面 */
@media (min-height: 620px) and (min-width: 900px) {
  .joy { width: 116px; height: 116px; }
  .joy__knob { width: 52px; height: 52px; margin: -26px 0 0 -26px; }
  .abtn { width: 72px; height: 72px; }
}
@media (max-height: 480px) {
  .joy { width: 96px; height: 96px; }
  .joy__knob { width: 44px; height: 44px; margin: -22px 0 0 -22px; }
  .abtn { width: 62px; height: 62px; font-size: 14px; }
  h1 { font-size: 30px; }
  .card { padding: 18px 18px 16px; }
  .howto li { padding: 6px 0; font-size: 12px; }
}
