/* ペンギン珈琲店 style.css — 構造とクラス名は docs/design.md を参照 */
:root {
  --c-ink: #3b2f2f; --c-ink-sub: #7a6a5e; --c-paper: #fffdf7; --c-cream: #fff4dc; --c-line: #eadcc0;
  --c-red: #e8413b; --c-red-deep: #b8302c; --c-green: #3fa66a; --c-green-deep: #2b7a4b;
  --c-orange: #ff8a3d; --c-orange-deep: #d9651c; --c-gold: #ffc83d; --c-gold-deep: #d99a00;
  --c-blue: #4fa8ff; --c-blue-deep: #2a6fc0; --c-purple: #9b6be0; --c-pink: #ff7fa8;
  --c-coffee: #8a5a3b; --c-coffee-deep: #5e3d28; --c-lock: #a7a9b8;
  --c-bg: #f6dfba; --c-bg-stripe: #f2d6a9;
  --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;
  --radius-s: 12px; --radius-m: 18px; --radius-l: 28px; --btn-depth: 6px;
  --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px); --safe-right: env(safe-area-inset-right, 0px);
  --dur-fast: .15s; --dur-mid: .3s; --ease-pop: cubic-bezier(.34, 1.56, .64, 1);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  word-break: auto-phrase;
  font-family: var(--font-base);
  color: var(--c-ink);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  touch-action: none;
  line-height: 1.5;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  overflow: hidden;
}
button { font: inherit; color: inherit; }
.num { font-family: var(--font-num); font-weight: 900; font-variant-numeric: tabular-nums; }

.app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    repeating-linear-gradient(135deg, var(--c-bg) 0 22px, var(--c-bg-stripe) 22px 44px);
}

/* ---------- 画面切替 ---------- */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: calc(16px + var(--safe-top)) calc(16px + var(--safe-right)) calc(16px + var(--safe-bottom)) calc(16px + var(--safe-left));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity var(--dur-mid) ease, transform var(--dur-mid) ease, visibility 0s linear var(--dur-mid);
  overflow-y: auto;
  touch-action: pan-y;
}
.screen.is-active {
  opacity: 1; visibility: visible; pointer-events: auto; transform: none;
  transition: opacity var(--dur-mid) ease, transform var(--dur-mid) ease, visibility 0s;
}
.screen > * { flex-shrink: 0; }

/* ---------- ボタン（押すと沈む） ---------- */
.btn {
  --btn-bg: var(--c-red);
  --btn-edge: var(--c-red-deep);
  --btn-fg: #fff;
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 56px;
  padding: 12px 28px;
  border: 3px solid var(--c-ink);
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 20px; font-weight: 800; letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 var(--btn-depth) 0 var(--btn-edge), 0 var(--btn-depth) 0 3px var(--c-ink);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter var(--dur-fast);
  margin-bottom: var(--btn-depth);
}
.btn::after {
  content: ""; position: absolute; top: 5px; left: 18%; right: 18%; height: 6px;
  border-radius: 999px; background: rgba(255, 255, 255, 0.35); pointer-events: none;
}
.btn:hover { filter: brightness(1.05); }
.btn:active, .btn.is-pressed {
  transform: translateY(var(--btn-depth));
  box-shadow: 0 0 0 var(--btn-edge), 0 0 0 3px var(--c-ink);
}
.btn:disabled { filter: grayscale(0.8) opacity(0.6); cursor: not-allowed; }
.btn--block { display: flex; width: 100%; }
.btn--green { --btn-bg: var(--c-green); --btn-edge: var(--c-green-deep); }
.btn--orange { --btn-bg: var(--c-orange); --btn-edge: var(--c-orange-deep); }
.btn--blue { --btn-bg: var(--c-blue); --btn-edge: var(--c-blue-deep); }
.btn--gold { --btn-bg: var(--c-gold); --btn-edge: var(--c-gold-deep); --btn-fg: var(--c-ink); }
.btn--ghost { --btn-bg: var(--c-paper); --btn-edge: var(--c-line); --btn-fg: var(--c-ink); }
.btn--small { min-height: 40px; padding: 6px 16px; font-size: 15px; --btn-depth: 4px; }

.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; flex: none;
  border: 3px solid var(--c-ink); border-radius: 50%; background: var(--c-paper); color: var(--c-ink);
  font-size: 18px; font-weight: 900; line-height: 1; cursor: pointer; box-shadow: 0 3px 0 var(--c-ink);
}
.icon-btn:active { transform: translateY(3px); box-shadow: none; }
.icon-btn.is-off { color: var(--c-lock); }
.icon-btn.is-off::after { content: ""; position: absolute; width: 26px; height: 3px; background: var(--c-ink); transform: rotate(-45deg); }
.btn:focus-visible, .icon-btn:focus-visible, .card:focus-visible, .choice:focus-visible { outline: 4px solid var(--c-blue); outline-offset: 2px; }
.btn { white-space: nowrap; }

/* ---------- タイトル ---------- */
.screen--title { align-items: center; justify-content: space-between; padding: 0; overflow: hidden; touch-action: none; }
.title-art { position: absolute; inset: 0; width: 100%; height: 100%; }
.screen--title > *:not(.title-art) { position: relative; z-index: 2; }
.screen--title > a.back-to-games {
  position: absolute; top: calc(12px + var(--safe-top)); left: calc(12px + var(--safe-left)); 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:active { transform: translateY(3px); box-shadow: none; }
.logo { margin: calc(64px + var(--safe-top)) 0 0; text-align: center; line-height: 1.1; }
.logo__sub { display: inline-block; padding: 4px 16px; border: 3px solid var(--c-ink); border-radius: 999px; background: var(--c-gold); font-size: 15px; font-weight: 900; }
.logo__main { display: block; margin-top: 8px; font-size: clamp(44px, 14vw, 60px); font-weight: 900; color: #fff; -webkit-text-stroke: 10px var(--c-ink); paint-order: stroke fill; text-shadow: 0 5px 0 var(--c-ink); }
.logo__main em { display: block; font-style: normal; color: var(--c-gold); letter-spacing: .08em; }
.title-best { margin: 10px auto auto; padding: 4px 14px; border: 3px solid var(--c-ink); border-radius: 999px; background: var(--c-paper); font-size: 14px; font-weight: 800; }
.title-best .num { font-size: 18px; color: var(--c-red); }
.title-btns { width: min(330px, calc(100% - 40px)); display: flex; flex-direction: column; gap: 10px; padding-bottom: calc(22px + var(--safe-bottom)); }
.title-btns .btn--ghost { min-height: 46px; font-size: 17px; }

/* ---------- 月の画面 ---------- */
.screen--game { padding: calc(6px + var(--safe-top)) 0 0; overflow: hidden; touch-action: none; }
.screen--game > *, .plan > * { width: 100%; max-width: 520px; margin-inline: auto; }
.hud { display: flex; align-items: center; gap: 6px; padding: 0 8px 5px; }
.hud__month { flex: none; min-width: 48px; padding: 3px 4px; text-align: center; border: 3px solid var(--c-ink); border-radius: 12px; background: var(--c-red); color: #fff; font-size: 13px; font-weight: 900; line-height: 1.1; white-space: nowrap; }
.hud__month .num { font-size: 22px; }
.hud__stats { flex: 1; min-width: 0; display: grid; grid-template-columns: 1.35fr 1fr 1fr 1fr; border: 3px solid var(--c-ink); border-radius: 12px; overflow: hidden; background: var(--c-paper); }
.stat { position: relative; min-width: 0; padding: 2px 3px 3px; display: grid; justify-items: center; line-height: 1.15; border-left: 2px solid var(--c-line); }
.stat:first-child { border-left: 0; background: var(--c-gold); }
.stat__icon { display: none; }
.stat__label { font-size: 10px; font-weight: 800; color: var(--c-ink-sub); white-space: nowrap; }
.stat:first-child .stat__label { color: var(--c-ink); }
.stat__val { font-size: 16px; white-space: nowrap; letter-spacing: -.02em; }
.stat.is-minus .stat__val, .stat.is-danger .stat__val { color: var(--c-red); }
.stat.is-up { animation: stat-up .5s var(--ease-pop); }
.stat.is-down { animation: stat-down .4s; background: #ffd9d4; }
@keyframes stat-up { 40% { transform: scale(1.14); background: #d6f3df; } }
@keyframes stat-down { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.hud .icon-btn { width: 38px; height: 38px; font-size: 16px; }

.shop-view { position: relative; flex: 1 1 0 !important; min-height: 96px; max-width: none !important; border-block: 3px solid var(--c-ink); background: #bfe6ff; overflow: hidden; }
.shop-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.shop-toast { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); padding: 4px 14px; border: 3px solid var(--c-ink); border-radius: 999px; background: var(--c-paper); font-size: 14px; font-weight: 900; white-space: nowrap; }

.plan { display: flex; flex-direction: column; max-width: none !important; padding: 5px 0 calc(6px + var(--safe-bottom)); background: var(--c-bg); }
.news { margin: 0 auto 5px !important; padding: 0 12px; display: flex; gap: 7px; align-items: center; font-size: 13px; font-weight: 700; line-height: 1.25; min-height: 22px; }
.news b { flex: none; padding: 1px 9px; border-radius: 999px; background: var(--c-ink); color: #fff; font-size: 12px; }
.cards { display: flex; flex-direction: column; gap: 5px; padding: 0 8px; }
.card {
  --cat: var(--c-blue);
  position: relative; display: grid; grid-template-columns: 46px 1fr auto; align-items: center; gap: 8px;
  width: 100%; height: 60px; padding: 0 8px 0 5px; text-align: left; cursor: pointer;
  border: 3px solid var(--c-ink); border-radius: 14px; background: var(--c-paper); box-shadow: 0 3px 0 var(--c-ink);
  transition: transform .08s, box-shadow .08s, opacity .15s; touch-action: manipulation;
}
.card[data-cat="menu"] { --cat: var(--c-orange); }
.card[data-cat="ad"], .card[data-cat="promo"] { --cat: var(--c-pink); }
.card[data-cat="equip"] { --cat: var(--c-green); }
.card[data-cat="team"] { --cat: var(--c-purple); }
.card[data-cat="challenge"] { --cat: var(--c-gold); }
.card:active { transform: translateY(3px); box-shadow: none; }
.card__icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 10px; background: color-mix(in srgb, var(--cat) 34%, #fff); overflow: hidden; }
.card__icon canvas { display: block; max-width: 44px; max-height: 44px; }
.card__body { min-width: 0; display: grid; gap: 1px; }
.card__name { font-size: 15px; font-weight: 900; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card__lv { margin-left: 4px; padding: 0 5px; border-radius: 6px; background: var(--cat); color: var(--c-ink); font: 900 11px/1.3 var(--font-num); }
.card__desc { font-size: 11.5px; line-height: 1.25; color: var(--c-ink-sub); font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card__side { display: grid; justify-items: end; gap: 2px; }
.card__cost { font-size: 15px; white-space: nowrap; }
.card__fx { display: flex; gap: 3px; }
.fx { padding: 0 5px; border-radius: 6px; background: var(--c-cream); font-size: 10.5px; line-height: 1.45; font-style: normal; font-weight: 900; white-space: nowrap; }
.fx--up { background: #d6f3df; color: #1c6b3c; }
.fx--down { background: #ffd9d4; color: #a0221d; }
.card.is-selected { background: #fff0b5; box-shadow: inset 0 0 0 3px var(--c-gold), 0 3px 0 var(--c-ink); }
.card.is-selected::after {
  content: "✓"; position: absolute; left: -5px; top: -7px; width: 24px; height: 24px; display: grid; place-items: center;
  border: 3px solid var(--c-ink); border-radius: 50%; background: var(--c-red); color: #fff; font-size: 13px; font-weight: 900; animation: pop .25s var(--ease-pop);
}
.card.is-dim { opacity: .62; }
.card.is-poor, .card.is-locked, .card:disabled { cursor: not-allowed; background: #ebe4d8; box-shadow: none; }
.card.is-poor > *, .card.is-locked > *, .card:disabled > * { opacity: .55; }
.card.is-poor .card__side { opacity: 1; }
.card.is-poor .card__cost { color: var(--c-red); }
.card.is-poor .card__cost::before { content: "お金不足 "; font: 800 10px var(--font-base); }
.card.is-shake { animation: stat-down .3s; }
@keyframes pop { from { transform: scale(0); } }
.plan__foot { display: flex; align-items: center; gap: 10px; padding: 8px 12px 0; }
.pick { flex: 1; min-width: 0; display: flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 800; }
.pick__dot { width: 18px; height: 18px; border: 3px solid var(--c-ink); border-radius: 50%; background: var(--c-paper); flex: none; }
.pick__dot.is-on { background: var(--c-red); }
.pick__txt { margin-left: 3px; white-space: nowrap; }
.btn--open { min-height: 46px; padding: 6px 30px; --btn-depth: 5px; }

/* ---------- 営業アニメ ---------- */
.live { display: none; padding: 10px 14px calc(14px + var(--safe-bottom)); }
.screen--game.is-open .plan { display: none; }
.screen--game.is-open .live { display: block; }
.live__bar { height: 16px; border: 3px solid var(--c-ink); border-radius: 999px; background: var(--c-paper); overflow: hidden; }
.live__bar i { display: block; height: 100%; background: var(--c-green); }
.live__nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.live__nums span { display: grid; justify-items: center; padding: 6px 2px; border: 3px solid var(--c-ink); border-radius: var(--radius-s); background: var(--c-paper); font-size: 12px; font-weight: 800; line-height: 1.2; }
.live__nums .num { font-size: 24px; }
.live__nums .is-bad .num { color: var(--c-red); }
.live__tap { margin: 8px 0 0; text-align: center; font-size: 14px; font-weight: 800; color: var(--c-ink-sub); }

/* ---------- シート ---------- */
.sheet-wrap { position: absolute; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; padding: 12px 12px calc(12px + var(--safe-bottom)); background: rgba(59, 47, 47, .38); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity var(--dur-fast), visibility 0s linear var(--dur-fast); }
.sheet-wrap.is-active { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity var(--dur-fast); }
.sheet { width: 100%; max-width: 440px; max-height: calc(100% - var(--safe-top)); overflow-y: auto; touch-action: pan-y; padding: 16px 18px 18px; border: 4px solid var(--c-ink); border-radius: var(--radius-l); background: var(--c-paper); box-shadow: 0 6px 0 var(--c-ink); }
.sheet-wrap.is-active .sheet { animation: sheet-in .3s var(--ease-pop); }
@keyframes sheet-in { from { transform: translateY(40px) scale(.96); } }
.sheet__art { height: 120px; margin: 0 0 10px; border: 3px solid var(--c-ink); border-radius: var(--radius-m); background: #cfeaf7; overflow: hidden; display: grid; place-items: end center; }
.sheet__art canvas { display: block; max-width: 100%; max-height: 100%; }
.sheet--fight .sheet__art { background: repeating-conic-gradient(from 0deg at 50% 60%, #ffb199 0 12deg, #ffd0bd 12deg 24deg); }
.sheet--quit .sheet__art { background: linear-gradient(#b9c6dd, #dfe6f1); }
.sheet--loan .sheet__art { background: linear-gradient(#bfe6ff, #eef9ff); }
.sheet__title { margin: 0 0 4px; font-size: 22px; font-weight: 900; line-height: 1.25; text-align: center; }
.sheet--report .sheet__title { margin: -16px -18px 10px; padding: 8px; background: var(--c-coffee); color: #fff; border-bottom: 4px solid var(--c-ink); }
.sheet__text { margin: 0 0 12px; font-size: 15px; line-height: 1.55; font-weight: 600; text-align: center; }
.choices { display: grid; gap: 9px; }
.choice { min-height: 54px; padding: 7px 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 3px solid var(--c-ink); border-radius: 16px; background: var(--c-cream); box-shadow: 0 4px 0 var(--c-ink); cursor: pointer; line-height: 1.3; }
.choice b { font-size: 16px; font-weight: 900; }
.choice span { font-size: 12px; font-weight: 700; color: var(--c-ink-sub); }
.choice:active { transform: translateY(4px); box-shadow: none; }
.choice:disabled { opacity: .5; box-shadow: none; }
.pl { width: 100%; border-collapse: collapse; font-size: 15px; font-weight: 700; }
.pl th { text-align: left; font-weight: 700; padding: 3px 4px; }
.pl td { text-align: right; font-size: 17px; padding: 3px 4px; }
.pl .is-minus td { color: var(--c-ink-sub); }
.pl__total th, .pl__total td { border-top: 3px dashed var(--c-line); padding-top: 6px; font-size: 18px; font-weight: 900; }
.pl__total td { font-size: 26px; color: var(--c-green-deep); }
.pl__total.is-loss td { color: var(--c-red); }
.deltas { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 8px 0; }
.delta { padding: 2px 10px; border-radius: 999px; background: var(--c-cream); font-size: 13px; font-weight: 800; }
.delta.is-up { background: #d6f3df; color: #1c6b3c; }
.delta.is-down { background: #ffd9d4; color: #a0221d; }
.why { margin: 8px 0 14px; padding: 9px 12px; border-radius: 14px; background: var(--c-cream); font-size: 14px; line-height: 1.5; font-weight: 700; }
.why b { color: var(--c-red); }

/* ---------- 年度末 ---------- */
.screen--result { align-items: center; gap: 10px; padding-inline: 14px; }
.screen--result > * { width: 100%; max-width: 440px; }
.result__head { position: relative; height: 130px; border: 4px solid var(--c-ink); border-radius: var(--radius-m); overflow: hidden; background: #bfe6ff; }
.result__art { width: 100%; height: 100%; display: block; }
.rank { position: absolute; right: 10px; top: 8px; margin: 0; width: 66px; height: 66px; display: grid; place-items: center; border: 4px solid var(--c-ink); border-radius: 50%; background: var(--c-gold); font: 900 36px/1 var(--font-num); transform: rotate(8deg); animation: pop .5s .4s var(--ease-pop) backwards; }
.result__title { margin: 0; text-align: center; font-size: 19px; font-weight: 900; line-height: 1.3; }
.score { margin: -6px 0; text-align: center; font-size: 50px; line-height: 1.1; color: var(--c-red); -webkit-text-stroke: 6px var(--c-paper); paint-order: stroke fill; }
.score small { font-size: 20px; }
.next-try { margin: 0; padding: 7px 14px; text-align: center; border: 3px solid var(--c-ink); border-radius: 14px; background: #fff0b5; font-size: 14px; font-weight: 800; line-height: 1.4; }
.panel { padding: 8px; border: 3px solid var(--c-ink); border-radius: var(--radius-m); background: var(--c-paper); }
.chart { display: block; width: 100%; height: 150px; }
.breakdown { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.breakdown > div { display: flex; justify-content: space-between; align-items: center; padding: 4px 10px; border-radius: 10px; background: var(--c-paper); font-size: 13px; font-weight: 700; }
.breakdown dt, .breakdown dd { margin: 0; }
.breakdown dd { font-size: 17px; }
.scenes { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.scenes li { display: flex; align-items: center; gap: 10px; padding: 5px 10px; border: 3px solid var(--c-ink); border-radius: 14px; background: var(--c-paper); font-size: 14px; font-weight: 700; line-height: 1.35; }
.scenes canvas { flex: none; }
.scenes b { margin-right: 5px; color: var(--c-red); }
.titles { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; }
.title-chip { padding: 2px 9px; border: 2px solid var(--c-ink); border-radius: 999px; background: var(--c-gold); font-size: 12px; font-weight: 800; }
.title-chip.is-locked { background: #ddd5c6; color: #8b7f72; border-color: #a99d8e; }
.result__btns { position: sticky; bottom: 0; display: flex; gap: 10px; padding-top: 6px; background: linear-gradient(transparent, var(--c-bg) 25%); }
.result__btns .btn { flex: 0 1 auto; padding-inline: 18px; min-height: 52px; }
.result__btns .btn--block { flex: 1; }

/* ---------- 横向き ---------- */
.rotate-note { position: fixed; inset: 0; z-index: 100; display: none; place-items: center; text-align: center; background: var(--c-coffee-deep); color: #fff; font-size: 20px; font-weight: 900; }
.rotate-note > div::before { content: ""; display: block; width: 44px; height: 72px; margin: 0 auto 18px; border: 5px solid #fff; border-radius: 10px; animation: tilt 1.6s ease-in-out infinite; }
@keyframes tilt { 0%, 30% { transform: rotate(-90deg); } 60%, 100% { transform: none; } }
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) { .rotate-note { display: grid; } }

@media (min-height: 780px) {
  .card { height: 66px; }
  .cards { gap: 7px; }
  .plan__foot { padding-top: 10px; }
  .sheet__art { height: 150px; }
}
@media (max-width: 370px) {
  .card { gap: 6px; }
  .card__name { font-size: 14px; }
  .card__desc { font-size: 11px; }
  .stat__val { font-size: 14px; }
  .hud__month { min-width: 42px; }
}
@media (max-height: 600px) { .card { height: 56px; } .cards { gap: 4px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
.screen--game:not(.is-open) .shop-toast { display: none; }
