:root {
  --bg: #120d1c;
  --panel: #1f1830;
  --panel2: #2a2140;
  --line: rgba(255, 255, 255, 0.1);
  --text: #f5efe6;
  --sub: #b9aecb;
  --accent: #ffb347;
  --red: #ff5a4e;
  --green: #6fdc8c;
  --font: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
}

body {
  background:
    radial-gradient(circle at 80% 0%, rgba(255, 140, 60, 0.12), transparent 40%),
    var(--bg);
  min-height: 100vh;
}

[hidden] { display: none !important; }

.wrap {
  max-width: 520px;
  margin: 0 auto;
  padding: 12px 16px 40px;
}

/* ===== 上の帯(日付・所持金・評判) ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(18, 13, 28, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
  font-size: 14px;
}
.topbar .day { font-weight: 800; font-size: 16px; }
.topbar .day small { color: var(--sub); font-weight: 600; }
.topbar .money { margin-left: auto; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.topbar .rep { color: #ffd166; letter-spacing: 1px; white-space: nowrap; }
.mute-btn {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--sub);
  border-radius: 8px;
  width: 34px;
  height: 30px;
  font-size: 15px;
  cursor: pointer;
}

/* ===== カード ===== */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin-top: 12px;
}
.card h2 {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--accent);
  letter-spacing: 0.05em;
}
.card h2 small { color: var(--sub); font-weight: 600; font-size: 12px; margin-left: 6px; }
.note { margin: 8px 0 0; font-size: 12px; color: var(--sub); line-height: 1.6; }
.warn { color: var(--red); }

/* 今日のようす */
.today { display: flex; gap: 12px; align-items: center; }
.today .wx { font-size: 40px; line-height: 1; }
.today .wx-text b { font-size: 17px; }
.today .wx-text div { font-size: 13px; color: var(--sub); margin-top: 3px; }
.events { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.event {
  font-size: 13px;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(255, 179, 71, 0.12);
  border: 1px solid rgba(255, 179, 71, 0.35);
}
.event b { color: var(--accent); margin-right: 6px; }

/* 場所 */
.locs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.loc {
  text-align: left;
  border: 1.5px solid var(--line);
  background: var(--panel2);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 10px;
  cursor: pointer;
  font-family: inherit;
}
.loc b { font-size: 15px; display: block; }
.loc span { font-size: 11px; color: var(--sub); display: block; margin-top: 3px; line-height: 1.45; }
.loc.on { border-color: var(--accent); background: rgba(255, 179, 71, 0.14); }
.loc.fest { border-style: dashed; }

/* 数を増減する行 */
.row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}
.row:first-of-type { border-top: 0; }
.row .label b { font-size: 15px; }
.row .label div { font-size: 11.5px; color: var(--sub); margin-top: 2px; line-height: 1.5; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button {
  min-width: 38px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel2);
  color: var(--text);
  font: 700 13px var(--font);
  cursor: pointer;
  touch-action: manipulation;
}
.stepper button:active { background: #3a2f58; }
.stepper .val {
  min-width: 64px;
  text-align: center;
  font-weight: 800;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

/* 合計と開店 */
.total { display: flex; justify-content: space-between; font-size: 14px; padding: 4px 0; }
.total b { font-variant-numeric: tabular-nums; }
.total.big { font-size: 16px; font-weight: 800; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 22px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #ff8a3d, #ff5a4e);
  color: #fff;
  font: 800 16px var(--font);
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 8px 20px -8px rgba(255, 90, 78, 0.7);
  -webkit-tap-highlight-color: transparent;
}
.btn:disabled { opacity: 0.45; cursor: default; box-shadow: none; }
.btn.wide { width: 100%; margin-top: 12px; }
.btn.sub {
  background: transparent;
  border: 1.5px solid var(--sub);
  color: var(--sub);
  box-shadow: none;
  font-size: 14px;
  min-height: 40px;
}
.reason { text-align: center; font-size: 12.5px; color: var(--red); margin: 8px 0 0; min-height: 1em; }

/* ===== タイトル ===== */
.title-screen { text-align: center; padding-top: 28px; }
.title-screen .logo { font-size: 64px; line-height: 1; }
.title-screen h1 { margin: 10px 0 2px; font-size: 34px; letter-spacing: 0.06em; }
.title-screen .en { color: var(--sub); letter-spacing: 0.3em; font-size: 12px; font-weight: 700; }
.title-screen .lead { margin: 16px auto 0; max-width: 360px; line-height: 1.8; font-size: 14px; color: var(--text); }
.title-screen .seed { margin-top: 14px; font-size: 13px; color: var(--accent); font-weight: 700; }
.title-screen .seed small { display: block; color: var(--sub); font-weight: 500; margin-top: 3px; }
.title-screen .best { margin-top: 10px; font-size: 14px; color: #ffd166; font-weight: 800; }
.title-buttons { display: flex; flex-direction: column; gap: 10px; align-items: center; margin-top: 22px; }
.title-buttons .btn { min-width: 240px; }

/* メニュー(ランキング・遊び方・ホーム) */
.menu { margin-top: 18px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.menu-buttons { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.menu-status { margin: 0; font-size: 13px; color: var(--accent); text-align: center; }
.menu-status:empty { display: none; }

/* ===== 営業中 ===== */
.stage {
  position: relative;
  margin-top: 12px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0c0a16;
}
.stage canvas { display: block; width: 100%; height: auto; }
.counters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.counter { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px; text-align: center; }
.counter span { display: block; font-size: 11px; color: var(--sub); }
.counter b { font-size: 18px; font-variant-numeric: tabular-nums; }
.sales-buttons { display: flex; gap: 8px; margin-top: 12px; }
.sales-buttons .btn { flex: 1; }

/* ===== 結果 ===== */
.result-head { text-align: center; }
.result-head .profit { font-size: 34px; font-weight: 800; margin: 4px 0; font-variant-numeric: tabular-nums; }
.result-head .profit.minus { color: var(--red); }
.result-head .profit.plus { color: var(--green); }
.voices { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.voice { font-size: 13px; padding: 7px 9px; border-radius: 8px; background: var(--panel2); display: flex; justify-content: space-between; }
.voice b { font-variant-numeric: tabular-nums; }
.voice.bad { color: #ff9c94; }

/* ===== 夜の改良 ===== */
.up {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.up:first-of-type { border-top: 0; }
.up b { font-size: 15px; }
.up .lv { color: var(--accent); font-size: 12px; margin-left: 6px; }
.up div div { font-size: 12px; color: var(--sub); margin-top: 3px; line-height: 1.5; }
.up .btn { min-height: 38px; font-size: 13px; padding: 0 12px; }

/* ===== 最終結果 ===== */
.final { text-align: center; padding-top: 18px; }
.final .score { font-size: 42px; font-weight: 800; color: var(--accent); margin: 6px 0; font-variant-numeric: tabular-nums; }
.final .newrec { color: #ffd166; font-weight: 800; }

/* ===== モーダル(ランキング・名前登録) ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(10, 6, 18, 0.78);
}
.panel {
  width: 100%;
  max-width: 360px;
  max-height: 100%;
  overflow-y: auto;
  padding: 18px;
  border-radius: 14px;
  border: 2px solid var(--accent);
  background: #1c1430;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.panel h2 { margin: 0; font-size: 19px; color: var(--accent); text-align: center; }
.status { margin: 0; font-size: 13px; color: var(--sub); text-align: center; }
.status:empty { display: none; }
.status.error { color: var(--red); }
.rank-tabs { display: flex; gap: 8px; justify-content: center; }
.rank-tab {
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: transparent;
  color: var(--sub);
  font: 700 13px/1 var(--font);
  cursor: pointer;
}
.rank-tab.active { border-color: var(--accent); color: var(--accent); background: rgba(255, 179, 71, 0.12); }
.ranking-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.ranking-list li {
  display: grid;
  grid-template-columns: 2.4em 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  font-size: 14px;
}
.ranking-list li.me { background: rgba(255, 209, 102, 0.2); outline: 1px solid #ffd166; }
.ranking-list .rank { font-weight: 800; color: var(--sub); }
.ranking-list li:nth-child(1) .rank { color: #ffd166; }
.ranking-list .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranking-list .score { font-weight: 800; font-variant-numeric: tabular-nums; }
.entry-info { margin: 0; text-align: center; font-size: 17px; font-weight: 800; color: #ffd166; }
.entry-label { font-size: 13px; color: var(--sub); }
#entry-name {
  min-height: 42px;
  padding: 0 12px;
  border: 2px solid var(--sub);
  border-radius: 8px;
  background: #0f0a18;
  color: #fff;
  font-size: 16px;
}
#entry-name:focus { border-color: var(--accent); outline: none; }
.panel .rowb { display: flex; gap: 10px; }
.panel .rowb .btn { flex: 1; min-height: 42px; font-size: 14px; }

/* スマホ: 増減ボタンが説明を押しつぶさないよう、説明の下に並べる */
@media (max-width: 480px) {
  .row { grid-template-columns: 1fr; gap: 6px; }
  .row .stepper { justify-self: stretch; justify-content: space-between; gap: 3px; }
  .stepper button { min-width: 0; flex: 1; height: 38px; padding: 0; }
  .stepper .val { min-width: 52px; font-size: 15px; }
}

.final .logo { font-size: 48px; }

/* 明日の予報と1日目のコツ */
.tomorrow { font-size: 13px; color: var(--sub); padding: 8px 10px; border-radius: 8px; background: var(--panel2); line-height: 1.6; }
.tip { font-size: 13px; padding: 8px 10px; border-radius: 8px; background: rgba(111, 220, 140, 0.12); border: 1px solid rgba(111, 220, 140, 0.35); line-height: 1.6; }
#btn-same { margin-top: 12px; }
#btn-auto { margin-top: 10px; }
.up .fx { color: var(--accent); font-weight: 700; }
.final .title-name { font-size: 20px; font-weight: 800; color: #ffd166; margin-bottom: 6px; }
