/* フードファイターへの道 */
:root {
  --c-ink: #2b2522;
  --c-ink-sub: #74685f;
  --c-paper: #ffffff;
  --c-bg: #fff4e2;
  --c-bg-deep: #fbe2bf;
  --c-main: #e8503a;
  --c-main-deep: #b93424;
  --c-soy: #8a5a2b;
  --c-gold: #ffc53d;
  --c-green: #3aa66b;
  --c-blue: #3a86d6;
  --c-purple: #8a63d2;
  --font-base: "Hiragino Maru Gothic ProN", "Hiragino Maru Gothic Pro", "BIZ UDPGothic",
    "Hiragino Sans", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  --font-num: "Arial Rounded MT Bold", "Hiragino Maru Gothic ProN", "SF Pro Rounded", ui-rounded, system-ui, sans-serif;
  --border: 3px solid var(--c-ink);
  --radius: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  background: var(--c-bg);
  background-image: radial-gradient(var(--c-bg-deep) 1.5px, transparent 1.6px);
  background-size: 22px 22px;
  color: var(--c-ink); font-family: var(--font-base);
  -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.app { position: relative; height: 100%; max-width: 520px; margin: 0 auto; }

.screen { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; padding: calc(10px + var(--safe-top)) 14px calc(12px + var(--safe-bottom)); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.screen.is-active { display: flex; animation: fadein 0.25s ease both; }
@keyframes fadein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.btn {
  display: block; width: 100%; max-width: 340px; padding: 13px 18px 14px; flex-shrink: 0;
  font-weight: 900; font-size: 19px; letter-spacing: 0.04em;
  background: var(--c-main); color: #fff; border: var(--border); border-radius: 999px;
  box-shadow: 0 6px 0 var(--c-ink); transition: transform 0.08s, box-shadow 0.08s;
}
.btn:active { transform: translateY(6px); box-shadow: 0 0 0 var(--c-ink); }
.btn--sub { background: var(--c-paper); color: var(--c-ink); font-size: 16px; padding: 10px 16px 11px; }
.btn:disabled { opacity: 0.5; }
.link-btn { background: none; border: 0; text-decoration: underline; font-weight: 800; font-size: 15px; color: var(--c-ink-sub); padding: 10px; }
.icon-btn { width: 34px; height: 34px; border: var(--border); border-radius: 50%; background: var(--c-paper); font-weight: 900; font-size: 14px; box-shadow: 0 3px 0 var(--c-ink); padding: 0; flex-shrink: 0; }
.icon-btn:active { transform: translateY(3px); box-shadow: none; }
.sec-title { margin: 6px 0 10px; font-size: 24px; font-weight: 900; text-align: center; }

/* タイトル */
.screen--title { justify-content: safe center; gap: 12px; }
.screen--title > a.back-to-games { position: absolute !important; top: calc(12px + var(--safe-top)); left: 12px; z-index: 6; display: inline-flex; align-items: center; padding: 6px 12px 7px; font: 800 13px/1 var(--font-base); color: var(--c-ink); text-decoration: none; background: var(--c-paper); border: 3px solid var(--c-ink); border-radius: 999px; box-shadow: 0 3px 0 var(--c-ink); }
.screen--title > a.back-to-games[hidden] { display: none; }
.screen--title > a.back-to-games:active { transform: translateY(3px); box-shadow: none; }
.logo { margin: 0; display: flex; flex-direction: column; align-items: center; text-align: center; }
.logo__sub { padding: 5px 14px; border: var(--border); border-radius: 999px; background: var(--c-paper); font-size: 14px; font-weight: 900; box-shadow: 0 3px 0 var(--c-ink); }
.logo__main { margin-top: 10px; font-size: clamp(36px, 11vw, 50px); font-weight: 900; line-height: 1.05; color: var(--c-main); -webkit-text-stroke: 2px var(--c-ink); paint-order: stroke fill; text-shadow: 0 4px 0 var(--c-ink); letter-spacing: 0.03em; }
.logo__main small { font-size: 0.6em; color: var(--c-gold); }
.hero { width: 240px; height: 170px; flex-shrink: 0; }
.title__lead { margin: 0; text-align: center; font-weight: 800; line-height: 1.7; font-size: 15px; }
.title__best { margin: 0; font-weight: 800; font-size: 14px; background: var(--c-paper); border: var(--border); border-radius: 999px; padding: 4px 12px; }

/* あそびかた */
.screen--rules { justify-content: safe center; }
.rules__list { margin: 0 0 18px; padding: 14px 16px 14px 34px; background: var(--c-paper); border: var(--border); border-radius: var(--radius); font-size: 15px; line-height: 1.65; font-weight: 600; max-width: 420px; }
.rules__list li + li { margin-top: 6px; }

/* ホーム */
.screen--home { gap: 8px; }
.hud { width: 100%; background: var(--c-paper); border: var(--border); border-radius: var(--radius); padding: 8px 10px; box-shadow: 0 4px 0 var(--c-ink); flex-shrink: 0; }
.hud__top { display: flex; align-items: center; gap: 6px; }
.week { font-size: 22px; font-weight: 900; }
.week__of { font-weight: 800; color: var(--c-ink-sub); font-size: 13px; }
.weeks { flex: 1; display: flex; gap: 3px; margin: 0 4px; }
.weeks i { flex: 1; height: 10px; border-radius: 3px; background: #eee3d6; border: 1.5px solid var(--c-ink); }
.weeks i.is-done { background: var(--c-soy); }
.weeks i.is-now { background: var(--c-gold); }
.weeks i.is-contest { border-radius: 50%; height: 12px; flex: 0 0 12px; background: #fff; }
.weeks i.is-contest.is-done { background: var(--c-main); }
.weeks i.is-contest.is-now { background: var(--c-gold); }
.hud__row { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-weight: 800; font-size: 14px; gap: 8px; }
.money b { font-size: 18px; }
.fatigue { display: flex; align-items: center; gap: 5px; }
.bar { display: inline-block; position: relative; height: 12px; border: 2px solid var(--c-ink); border-radius: 999px; background: #f2ebe2; overflow: hidden; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--c-green); transition: width 0.3s; }
.bar--fat { width: 80px; }
.bar--fat i.is-mid { background: var(--c-gold); }
.bar--fat i.is-high { background: var(--c-main); }

.stats { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; flex-shrink: 0; }
.stat { background: var(--c-paper); border: var(--border); border-radius: 12px; padding: 5px 9px; display: flex; flex-direction: column; gap: 2px; }
.stat__head { display: flex; justify-content: space-between; align-items: baseline; font-weight: 900; font-size: 14px; }
.stat__head b { font-size: 18px; }
.stat__sub { font-size: 11px; color: var(--c-ink-sub); font-weight: 700; }
.stat.is-up { animation: pop 0.5s ease; }
@keyframes pop { 30% { transform: scale(1.06); background: #fff3c4; } }

.next { width: 100%; background: #fff8ec; border: var(--border); border-radius: 12px; padding: 7px 10px; font-size: 13px; font-weight: 700; line-height: 1.5; flex-shrink: 0; }
.next b { font-weight: 900; }
.next__head { font-size: 15px; font-weight: 900; }
.next__head .soon { color: var(--c-main); }
.meter2 { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.meter2__lbl { width: 70px; flex-shrink: 0; }
.meter2__bar { flex: 1; position: relative; height: 14px; border: 2px solid var(--c-ink); border-radius: 999px; background: #f2ebe2; overflow: hidden; }
.meter2__bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--c-blue); }
.meter2__bar u { position: absolute; top: -2px; bottom: -2px; width: 3px; background: var(--c-main); }
.meter2__val { width: 54px; text-align: right; flex-shrink: 0; }

.pick__title { margin: 2px 0 0; font-size: 15px; font-weight: 900; align-self: flex-start; }
.trainings { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; flex-shrink: 0; }
.tr { text-align: left; background: var(--c-paper); border: var(--border); border-radius: 14px; padding: 7px 9px 8px; box-shadow: 0 4px 0 var(--c-ink); display: flex; flex-direction: column; gap: 1px; min-height: 64px; }
.tr:active { transform: translateY(4px); box-shadow: none; }
.tr__name { font-weight: 900; font-size: 15px; }
.tr__eff { font-weight: 800; font-size: 12px; color: var(--c-main-deep); }
.tr__fat { font-weight: 700; font-size: 11px; color: var(--c-ink-sub); }
.tr--rest { background: #eaf6ee; }
.tr.is-tired .tr__eff { color: var(--c-ink-sub); text-decoration: line-through; }
.btn--shop { margin-top: 4px; max-width: 220px; }

/* 大会前 */
.screen--intro { justify-content: safe center; gap: 6px; }
.intro__week { margin: 0; font-weight: 900; color: var(--c-main); font-size: 15px; }
.intro__food { width: 160px; height: 120px; }
.intro__rule { margin: 0; font-weight: 800; font-size: 14px; }
.rivals { list-style: none; margin: 4px 0; padding: 8px 12px; width: 100%; max-width: 360px; background: var(--c-paper); border: var(--border); border-radius: var(--radius); font-weight: 800; font-size: 14px; }
.rivals li { display: flex; justify-content: space-between; padding: 2px 0; }
.rivals li + li { border-top: 1px dashed #d9cfc4; }
.intro__you { margin: 0; font-weight: 800; font-size: 14px; text-align: center; line-height: 1.5; }
.intro__tip { margin: 0 0 8px; font-size: 13px; font-weight: 700; color: var(--c-ink-sub); text-align: center; }

/* 大会 */
.screen--contest { padding: 0; overflow: hidden; }
.stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* 結果 */
.screen--result { justify-content: safe center; gap: 6px; }
.result__name { margin: 0; font-weight: 900; font-size: 16px; }
.result__rank { margin: 0; font-size: 60px; font-weight: 900; color: var(--c-main); -webkit-text-stroke: 2px var(--c-ink); paint-order: stroke fill; text-shadow: 0 4px 0 var(--c-ink); line-height: 1.1; animation: stamp 0.45s cubic-bezier(.2,1.6,.4,1) both; }
.result__rank.is-win { color: var(--c-gold); }
@keyframes stamp { from { transform: scale(2.2); opacity: 0; } to { transform: none; opacity: 1; } }
.result__amount { margin: 0; font-weight: 900; font-size: 18px; }
.result__note { margin: 0; font-weight: 800; font-size: 14px; color: var(--c-main-deep); text-align: center; line-height: 1.5; }
.ranking { margin: 6px 0; padding: 8px 12px 8px 34px; width: 100%; max-width: 360px; background: var(--c-paper); border: var(--border); border-radius: var(--radius); font-weight: 800; font-size: 14px; }
.ranking li { padding: 2px 0; }
.ranking li span { float: right; }
.ranking li.is-you { color: var(--c-main); }
.result__prize { margin: 0 0 8px; font-weight: 900; font-size: 17px; }

/* エンディング */
.screen--ending { justify-content: safe center; gap: 8px; }
.end__stars { margin: 0; font-size: 34px; letter-spacing: 4px; color: var(--c-gold); -webkit-text-stroke: 1.5px var(--c-ink); }
.end__title { margin: 0; font-size: 32px; font-weight: 900; color: var(--c-main); -webkit-text-stroke: 1.5px var(--c-ink); paint-order: stroke fill; text-align: center; }
.end__sub { margin: 0; font-weight: 800; font-size: 15px; text-align: center; }
.end__log { list-style: none; margin: 0; padding: 8px 12px; width: 100%; max-width: 360px; background: var(--c-paper); border: var(--border); border-radius: var(--radius); font-size: 13px; font-weight: 800; }
.end__log li { display: flex; justify-content: space-between; gap: 6px; padding: 1px 0; }
.end__best { margin: 0; font-size: 13px; font-weight: 800; color: var(--c-ink-sub); }
.share-msg { margin: 0; font-size: 13px; font-weight: 800; color: var(--c-green); }

/* モーダル */
.modal { position: absolute; inset: 0; background: rgba(43, 37, 34, 0.45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 20; }
.modal[hidden] { display: none; }
.sheet { width: 100%; max-width: 360px; max-height: 100%; overflow-y: auto; background: var(--c-paper); border: var(--border); border-radius: 20px; padding: 14px 16px 18px; display: flex; flex-direction: column; align-items: center; gap: 8px; box-shadow: 0 6px 0 var(--c-ink); animation: fadein 0.2s ease both; }
.sheet__icon { margin: 0; font-size: 44px; line-height: 1; }
.sheet__title { margin: 0; font-size: 20px; font-weight: 900; text-align: center; }
.sheet__money { font-size: 14px; margin-left: 6px; }
.sheet__note { margin: 0; font-size: 13px; font-weight: 700; color: var(--c-ink-sub); text-align: center; line-height: 1.5; }
.gains { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.gains li { border: 2px solid var(--c-ink); border-radius: 999px; padding: 3px 10px; font-weight: 900; font-size: 15px; background: #fff3c4; }
.gains li.is-bad { background: #fde0da; }
.gains li.is-good { background: #dff4e7; }
.shop { list-style: none; margin: 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: 6px; }
.shop li { display: flex; align-items: center; gap: 8px; border: 2px solid var(--c-ink); border-radius: 12px; padding: 6px 8px; }
.shop__icon { font-size: 26px; }
.shop__body { flex: 1; display: flex; flex-direction: column; }
.shop__name { font-weight: 900; font-size: 15px; }
.shop__desc { font-weight: 700; font-size: 11px; color: var(--c-ink-sub); }
.shop__buy { border: 2px solid var(--c-ink); border-radius: 999px; background: var(--c-gold); font-weight: 900; font-size: 13px; padding: 6px 10px; box-shadow: 0 3px 0 var(--c-ink); white-space: nowrap; }
.shop__buy:active { transform: translateY(3px); box-shadow: none; }
.shop__buy:disabled { background: #eee; color: var(--c-ink-sub); box-shadow: none; transform: none; }

@media (max-height: 700px) {
  .stat__sub { display: none; }
  .tr { min-height: 54px; padding: 5px 8px 6px; }
  .tr__fat { display: none; }
  .hero { width: 180px; height: 128px; }
  .logo__main { font-size: 34px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
