/* うちゅうヘアサロン style.css
   シリーズ共通: ポップ・太い墨枠・押すと沈むボタン・丸ゴシック（外部フォントなし）＋宇宙のサロン */
:root {
  --ink: #2e2a3a;
  --ink-sub: #6a6280;
  --paper: #fffdf6;
  --night: #2b2468;
  --night-2: #3a3088;
  --pink: #ff5a8a; --pink-deep: #c93766; --pink-light: #ffd9ec;
  --mint: #3fd1b0; --mint-deep: #1f9c80;
  --sky: #33b6f5;
  --gold: #ffc83d;
  --font: "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", ui-rounded, system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --app-w: min(100vw, 480px);
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); color: var(--ink); background: #1d1848;
  overflow: hidden; position: fixed; inset: 0;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none; line-height: 1.5;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation;
}
button { font: inherit; color: inherit; }
canvas { display: block; touch-action: none; }
.num { font-family: var(--font-num); font-weight: 900; font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

.app {
  position: relative; width: var(--app-w); height: 100dvh; margin: 0 auto; overflow: hidden;
  background-color: var(--night);
  background-image: radial-gradient(rgba(255,248,200,.55) 1.2px, transparent 1.6px), radial-gradient(rgba(255,255,255,.3) 1px, transparent 1.4px);
  background-size: 46px 46px, 31px 31px; background-position: 0 0, 15px 20px;
  box-shadow: 0 0 0 3px var(--ink);
}
.screen {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  padding: calc(14px + var(--safe-top)) 14px calc(14px + var(--safe-bottom));
  opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(10px);
  transition: opacity .3s ease, transform .3s ease, visibility 0s linear .3s;
  overflow-y: auto;
}
.screen.is-active { opacity: 1; visibility: visible; pointer-events: auto; transform: none; transition: opacity .3s ease, transform .3s ease, visibility 0s; }

.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); color: var(--ink); text-decoration: none; background: var(--paper); border: 3px solid var(--ink); border-radius: 999px; box-shadow: 0 3px 0 var(--ink); }
.screen--title > a.back-to-games:active { transform: translateY(3px); box-shadow: none; }
.screen--title:has(> a.back-to-games:not([hidden])) { padding-top: calc(52px + var(--safe-top)); }

/* ボタン */
.btn {
  --bg: var(--pink); --fg: #fff;
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 52px; padding: 10px 22px; border: 3px solid var(--ink); border-radius: 999px;
  background: var(--bg); color: var(--fg); font-weight: 900; font-size: 19px; letter-spacing: .04em;
  box-shadow: 0 6px 0 var(--ink); cursor: pointer; transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translateY(6px); box-shadow: 0 0 0 var(--ink); }
.btn--block { width: 100%; }
.btn--sub { --bg: var(--sky); }
.btn--ghost { --bg: var(--paper); --fg: var(--ink); }
.btn--small { min-height: 40px; font-size: 15px; padding: 6px 16px; box-shadow: 0 4px 0 var(--ink); }
.btn--small:active { transform: translateY(4px); }
.btn:disabled { opacity: .5; pointer-events: none; }

/* タイトル */
.screen--title { align-items: center; justify-content: safe center; gap: 10px; }
.logo { margin: 0; text-align: center; line-height: 1.1; }
.logo__sub { display: inline-block; font-size: 13px; font-weight: 800; background: var(--paper); border: 3px solid var(--ink); border-radius: 999px; padding: 3px 12px; margin-bottom: 8px; }
.logo__main { display: block; font-size: clamp(34px, 11vw, 50px); font-weight: 900; letter-spacing: .04em; color: var(--mint); -webkit-text-stroke: 7px var(--ink); paint-order: stroke fill; text-shadow: 0 5px 0 var(--ink); }
.logo__main--2 { font-size: clamp(38px, 12.5vw, 58px); color: var(--pink-light); }
.logo__c { display: inline-block; animation: bob 1.8s ease-in-out infinite; animation-delay: calc(var(--d, 0) * 1s); }
.logo__c:nth-child(2) { --d: .2; } .logo__c:nth-child(3) { --d: .4; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.title__art { width: 100%; flex: 1 1 auto; min-height: 150px; max-height: 340px; position: relative; }
.title__art canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.title__best { margin: 0; color: var(--paper); font-weight: 900; font-size: 15px; }
.title__best .num { color: var(--gold); font-size: 20px; }
.title__actions { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 14px; padding-bottom: 6px; }
.title__sub { display: flex; gap: 10px; justify-content: center; }

/* プレイ */
.screen--play { padding: calc(8px + var(--safe-top)) 8px calc(8px + var(--safe-bottom)); gap: 6px; overflow: hidden; }
.hud { display: flex; align-items: center; gap: 6px; flex: none; }
.hud__menu { flex: none; width: 42px; height: 42px; border: 3px solid var(--ink); border-radius: 12px; background: var(--paper); box-shadow: 0 3px 0 var(--ink); display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px; padding: 0; cursor: pointer; }
.hud__menu i { display: block; width: 18px; height: 3px; border-radius: 2px; background: var(--ink); }
.hud__menu:active { transform: translateY(3px); box-shadow: none; }
.hud__guest, .hud__score { flex: none; background: var(--paper); border: 3px solid var(--ink); border-radius: 12px; padding: 0 8px; height: 42px; display: flex; align-items: center; gap: 2px; white-space: nowrap; }
.hud__guest small, .hud__score small { font-size: 11px; font-weight: 800; }
.hud__guest .num, .hud__score .num { font-size: 19px; }
.hud__time { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; background: var(--paper); border: 3px solid var(--ink); border-radius: 999px; padding: 4px 10px; height: 42px; }
.hud__time .num { flex: none; min-width: 1.4em; text-align: right; font-size: 18px; }
.timebar { flex: 1; height: 14px; border: 2px solid var(--ink); border-radius: 99px; background: #e6e1f0; overflow: hidden; }
.timebar i { display: block; height: 100%; width: 100%; background: var(--mint); }
.hud__time.is-warn .timebar i { background: var(--pink); }
.hud__time.is-warn .num { color: var(--pink-deep); animation: beat .5s ease-in-out infinite; }
@keyframes beat { 50% { transform: scale(1.25); } }

.board { position: relative; flex: 1 1 auto; min-height: 0; border: 3px solid var(--ink); border-radius: 18px; overflow: hidden; }
.board canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.pop {
  position: absolute; left: 50%; top: 30%; transform: translate(-50%, -50%);
  padding: 6px 18px; background: var(--paper); border: 4px solid var(--ink); border-radius: 999px;
  font-weight: 900; font-size: 22px; white-space: nowrap; box-shadow: 0 5px 0 var(--ink);
  pointer-events: none; animation: pop .35s cubic-bezier(.34, 1.56, .64, 1);
}
.pop.is-bad { background: var(--pink); color: #fff; }
@keyframes pop { from { transform: translate(-50%, -50%) scale(.4); opacity: 0; } }
.board__pause { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(43, 36, 104, .6); color: #fff; font-weight: 900; font-size: 20px; }

.tools { flex: none; display: flex; align-items: center; gap: 8px; height: 66px; }
.tools__pick { display: flex; gap: 6px; flex: 1; min-width: 0; }
.tool { flex: 1; max-width: 120px; height: 58px; display: flex; align-items: center; justify-content: center; gap: 2px; padding: 0 6px; border: 3px solid var(--ink); border-radius: 16px; background: #d8d3ea; box-shadow: 0 4px 0 var(--ink); font-weight: 900; font-size: 14px; cursor: pointer; }
.tool canvas { width: 34px; height: 34px; }
.tool.is-on { background: var(--gold); }
.tool:active { transform: translateY(4px); box-shadow: none; }
.tool.is-hint { animation: wiggle .8s ease-in-out infinite; }
@keyframes wiggle { 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }
.btn--done { --bg: var(--mint); flex: none; min-height: 58px; padding: 6px 22px; font-size: 20px; }

/* モーダル */
.modal { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: rgba(20, 16, 50, .55); opacity: 0; visibility: hidden; transition: opacity .2s, visibility 0s linear .2s; overflow-y: auto; }
.modal:not(.is-open) { pointer-events: none; }
.modal.is-open { opacity: 1; visibility: visible; transition: opacity .2s, visibility 0s; }
.modal--sheet { place-items: end center; background: transparent; padding-bottom: calc(12px + var(--safe-bottom)); }
.modal--sheet .card { animation: up .3s cubic-bezier(.34, 1.3, .64, 1); }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.card { width: 100%; max-width: 360px; background: var(--paper); border: 4px solid var(--ink); border-radius: 26px; box-shadow: 0 7px 0 var(--ink); padding: 18px 18px 20px; max-height: calc(100dvh - 32px); overflow-y: auto; }
.card__title { margin: 0 0 10px; text-align: center; font-size: 22px; font-weight: 900; }
.card__title small { display: block; font-size: 13px; color: var(--ink-sub); font-weight: 800; }
.card__actions { display: flex; flex-direction: column; gap: 12px; align-items: center; margin-top: 14px; }
.card__row { display: flex; gap: 10px; justify-content: center; }
.rules__list { margin: 0; padding-left: 1.3em; font-size: 14px; display: flex; flex-direction: column; gap: 6px; }
.rules__tip { font-size: 13px; margin: 10px 0 0; padding: 8px 10px; background: var(--pink-light); border: 3px solid var(--ink); border-radius: 14px; }

.intro { text-align: center; }
.intro__no { margin: 0; font-size: 14px; color: var(--ink-sub); font-weight: 800; }
.order { position: relative; margin: 0 auto 10px; width: 220px; padding: 10px 10px 8px; background: #fff; border: 3px solid var(--ink); border-radius: 6px; box-shadow: 4px 4px 0 var(--ink); transform: rotate(-2deg); }
.order::before { content: "オーダー"; position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--gold); border: 3px solid var(--ink); border-radius: 99px; padding: 0 10px; font-size: 12px; font-weight: 900; }
.order__img { width: 194px; height: 180px; margin: 0 auto; }
.order__text { margin: 4px 0 0; font-weight: 900; font-size: 16px; }
.intro__tip { margin: 0; padding: 8px 10px; background: var(--pink-light); border: 3px dashed var(--ink-sub); border-radius: 14px; font-size: 14px; font-weight: 700; }

.judge { padding: 14px 16px 16px; }
.judge__head { display: flex; align-items: center; justify-content: center; gap: 14px; }
.judge__match { margin: 0; font-size: 46px; line-height: 1; font-weight: 900; }
.judge__match small { font-size: 22px; }
.stars { display: flex; gap: 6px; }
.stars i { width: 36px; height: 36px; background: #ddd5e6; clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.stars i.on { background: var(--gold); animation: pop2 .4s cubic-bezier(.34, 1.56, .64, 1) both; }
.stars i.on:nth-child(2) { animation-delay: .15s; } .stars i.on:nth-child(3) { animation-delay: .3s; }
@keyframes pop2 { from { transform: scale(0); } }
.judge__say { margin: 8px 0; text-align: center; font-weight: 900; font-size: 16px; }
.judge__stats { list-style: none; margin: 0; padding: 6px 10px; background: #f3effb; border: 3px solid var(--ink); border-radius: 14px; font-size: 13px; }
.judge__stats li { display: flex; justify-content: space-between; gap: 8px; }
.judge__stats b { font-family: var(--font-num); }
.judge__stats .is-total { border-top: 2px dashed var(--ink-sub); margin-top: 2px; padding-top: 2px; font-weight: 900; font-size: 15px; }
.judge .card__actions { margin-top: 10px; }

.day { text-align: center; }
.day__label { margin: 0; font-weight: 900; font-size: 18px; }
.day__total { margin: 0; font-size: 52px; line-height: 1.1; font-weight: 900; color: var(--pink); -webkit-text-stroke: 6px var(--ink); paint-order: stroke fill; }
.day__total small { font-size: 22px; color: var(--ink); -webkit-text-stroke: 0; }
.day__rank { margin: 4px 0 0; display: inline-block; padding: 2px 14px; background: var(--gold); border: 3px solid var(--ink); border-radius: 99px; font-weight: 900; }
.day__best { margin: 6px 0 8px; font-size: 13px; font-weight: 800; color: var(--ink-sub); }
.day__best.is-new { color: var(--pink-deep); }
.day__gallery { width: 100%; height: 150px; margin: 0 0 8px; border: 3px solid var(--ink); border-radius: 12px; background: #e9f6ff; }
.day__list { list-style: none; margin: 0; padding: 6px 10px; background: #f3effb; border: 3px solid var(--ink); border-radius: 14px; font-size: 13px; text-align: left; }
.day__list li { display: flex; align-items: center; gap: 6px; }
.day__list .nm { flex: 1; font-weight: 800; }
.day__list .st { color: var(--gold); -webkit-text-stroke: .6px var(--ink); letter-spacing: 1px; }
.day__list .st .off { color: #d8d0e4; }
.day__list b { font-family: var(--font-num); min-width: 3.2em; text-align: right; }

.rotate { position: absolute; inset: 0; z-index: 50; display: none; place-items: center; background: var(--night); font-weight: 900; font-size: 22px; }
.rotate p { background: var(--paper); border: 4px solid var(--ink); border-radius: 20px; padding: 16px 24px; }
@media (orientation: landscape) and (max-height: 500px) { .rotate { display: grid; } }

.toast { position: absolute; left: 50%; bottom: calc(24px + var(--safe-bottom)); transform: translateX(-50%); z-index: 60; background: var(--ink); color: #fff; padding: 8px 16px; border-radius: 99px; font-weight: 800; font-size: 14px; max-width: 90%; text-align: center; }

@media (max-height: 680px) {
  .order__img { height: 140px; }
  .judge__match { font-size: 38px; }
  .day__gallery { height: 112px; }
  .day__total { font-size: 40px; }
  .tools { height: 58px; } .tool, .btn--done { height: 52px; min-height: 52px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
