/* スマートフォンのカウンター。ゲームの値は常設せず、伝票にまとめる。 */
:root {
  color-scheme: dark;
  --bg: #16151e;
  --panel: #211e2b;
  --ink: #f5ead5;
  --muted: #b8b1bd;
  --gold: #e6cf9e;
  --line: #49414f;
  --paper: #faf4e5;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  font-size: 16px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: #0e0e15;
  color: var(--ink);
  min-height: 100svh;
  overflow: hidden;
}
button,
a,
input,
select {
  font: inherit;
}
button {
  touch-action: manipulation;
  cursor: pointer;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--ink);
  background: #2c2737;
  font-weight: 700;
  line-height: 1.5;
  font-size: 0.875rem;
}
button:hover:not(:disabled) {
  border-color: var(--gold);
  background: #3b3343;
}
button:active:not(:disabled) {
  transform: translateY(1px);
}
button:disabled {
  cursor: default;
  color: #a59cae;
  background: #25212f;
  opacity: 0.65;
}
button.primary {
  color: #29212d;
  background: var(--gold);
  border-color: var(--gold);
}
button.primary:hover:not(:disabled) {
  background: #f3deb6;
}
button.primary:disabled {
  background: #514652;
  border-color: #514652;
  color: #c5b9cc;
}
button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid #f5d695;
  outline-offset: 3px;
}
a {
  color: var(--gold);
}
h1,
h2,
h3,
h4,
p {
  margin: 0;
}
h1 {
  font-size: 1.65rem;
}
h2 {
  font-size: 1.1rem;
  line-height: 1.5;
}
h3 {
  font-size: 1rem;
}
p {
  line-height: 1.7;
}
small {
  font-size: 0.75rem;
}
#game {
  position: relative;
  width: 100%;
  max-width: 520px;
  min-height: 100svh;
  margin: auto;
  padding: 0 12px calc(146px + env(safe-area-inset-bottom));
  background: var(--bg);
}
.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 52px;
}
.wordmark {
  text-decoration: none;
  font-weight: 800;
  font-size: 0.875rem;
  letter-spacing: 0.06em;
  color: var(--gold);
  white-space: nowrap;
}
#time-left {
  margin-left: auto;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--muted);
}
.icon-button {
  border: 0;
  background: transparent;
  width: 44px;
  height: 44px;
  min-width: 44px;
  padding: 0;
  font-size: 1.4rem;
}
.wallet {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  height: 28px;
  color: var(--muted);
  font-size: 0.75rem;
}
.wallet b {
  color: var(--ink);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}
.wallet i {
  font-style: normal;
  color: var(--gold);
}
.portrait-stage {
  position: relative;
  overflow: hidden;
  min-height: 0;
  background: radial-gradient(ellipse at 50% 10%, #36283e, #13111d 80%);
  border: 1px solid #574451;
  border-radius: 16px 16px 0 0;
}
#portrait {
  position: absolute;
  left: 50%;
  top: -18px;
  transform: translateX(-50%);
  width: min(100%, 380px);
  height: auto;
  aspect-ratio: 1;
  image-rendering: pixelated;
}
.speech {
  position: absolute;
  bottom: 6px;
  left: 10px;
  right: 10px;
  margin: 0;
  text-align: center;
  font-size: 0.875rem;
  line-height: 1.45;
  padding: 6px 10px;
  background: #191520dc;
  border-radius: 8px;
  pointer-events: none;
}
.scene-badge {
  position: absolute;
  top: 7px;
  left: 7px;
  z-index: 1;
  padding: 3px 7px;
  background: #191520e8;
  border: 1px solid #75605a;
  border-radius: 6px;
  font-size: 0.75rem;
  color: var(--gold);
  max-width: 90%;
}
.scene-badge:empty {
  display: none;
}
#portrait-tap {
  position: absolute;
  inset: 0;
  border: 0;
  background: transparent;
  width: 100%;
  height: 100%;
}
#game[data-phase="serving"] #portrait,
#game[data-phase="reaction"] #portrait,
#game[data-phase="refill"] #portrait,
#game[data-phase="nightResult"] #portrait,
#game[data-phase="won"] #portrait {
  width: min(100%, 440px);
  height: auto;
  top: -16px;
}
#interaction {
  padding: 12px 10px 18px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
  scrollbar-color: #806373 transparent;
  background: linear-gradient(#2a2230, #211d2a 140px);
  border: 1px solid #574451;
  border-top: 1px solid #957468;
  border-radius: 0 0 12px 12px;
  scroll-padding: 12px;
}
#board-stage {
  display: none;
  position: relative;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}
#game[data-phase="board"] #board-stage {
  display: block;
  height: 0;
}
.phaser-board-canvas {
  position: absolute;
  inset: 0 12px auto;
  width: calc(100% - 24px);
  height: 220px;
  opacity: 0.22;
  image-rendering: pixelated;
}
#interaction p {
  font-size: 0.875rem;
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.eyebrow {
  font-size: 0.75rem !important;
  color: var(--gold);
  letter-spacing: 0.08em;
  margin-bottom: 3px;
}
.muted,
.ready-note {
  color: var(--muted);
}
.stock-count {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}
.ready-note {
  margin: 12px 0;
  line-height: 1.7;
  text-align: center;
}
.received {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--gold);
  margin-bottom: 10px;
}
.received .pixel-symbol {
  width: 22px;
  height: 22px;
}
.welcome {
  text-align: center;
  padding: 25px 6px;
}
.welcome h1 {
  margin: 5px 0 20px;
  font-family: "Yu Mincho", serif;
}
.welcome p + p {
  margin-top: 20px;
}
.board-wrap {
  position: relative;
  background: #0f0e17;
  border: 1px solid #554351;
  padding: 5px;
  border-radius: 12px;
  box-shadow: inset 0 3px 14px #0007;
}
.board {
  display: grid;
  grid-template-columns: repeat(5, minmax(44px, 1fr));
  gap: 4px;
}
.cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 3px;
  min-height: 65px;
  min-width: 44px;
  padding: 5px 2px;
  border-radius: 7px;
  border-color: #43394b;
  background: linear-gradient(155deg, #302a3b, #231e2e);
  overflow: hidden;
  transition:
    background 0.16s,
    border-color 0.16s;
}
.cell > span:not(.deal-token) {
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  font-size: 0.75rem;
  line-height: 1.35;
  font-weight: 500;
}
.cell small {
  color: #d5be9e;
  font-size: 0.75rem;
  line-height: 1.3;
}
.pixel-symbol {
  width: 27px;
  height: 27px;
  flex-shrink: 0;
  vertical-align: middle;
  image-rendering: pixelated;
}
.empty-symbol {
  color: #655569;
}
.cell:disabled {
  opacity: 1;
  color: var(--ink);
}
.cell.selected {
  outline: 2px solid #98d1c6;
  outline-offset: -2px;
  background: #2e4a47;
}
.cell.combo-cell {
  border-color: #d8b471;
  background: linear-gradient(155deg, #5d4637, #382938);
  box-shadow: inset 0 0 0 1px #c29e6855;
}
.cell.source-cell {
  border-color: #f5dca0;
  box-shadow: inset 0 0 0 1px #e6cf9e;
}
.source-mark {
  position: absolute;
  right: 3px;
  top: 0;
  font-size: 0.65rem;
  color: var(--gold);
}
.cell.unrevealed,
.waiting-cell {
  background: #191622;
  border-color: #292333;
}
.waiting-cell .pixel-symbol {
  opacity: 0.35;
}
.cell.landed .pixel-symbol {
  animation: land 0.28s ease-out;
}
.waiting-board {
  opacity: 0.75;
}
@keyframes land {
  from {
    opacity: 0;
    transform: translateY(-16px) scale(0.8);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.combo-summary {
  padding-top: 10px;
  min-height: 100px;
}
.section-caption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  color: var(--gold);
  margin-bottom: 5px;
}
.section-caption small {
  color: var(--muted);
}
.combo-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 2px 6px;
  scrollbar-width: thin;
  scrollbar-color: #6c5367 transparent;
}
.combo-chip {
  flex-shrink: 0;
  min-height: 44px;
  padding: 7px 10px;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 8px;
}
.combo-chip small {
  margin-left: 5px;
  color: #d6b983;
}
.combo-chip.active {
  background: #47343c;
  border-color: #c7a778;
  color: var(--gold);
}
.combo-chip:disabled {
  opacity: 1;
}
.combo-explanation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 8px;
  border: 0;
  background: transparent;
  padding: 3px 0;
  min-height: 44px;
  text-align: left;
  font-weight: 400;
}
.combo-explanation:hover:not(:disabled) {
  background: transparent;
}
.combo-explanation b {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.6;
}
.combo-explanation small {
  display: block;
  color: var(--muted);
  line-height: 1.6;
}
.detail-label {
  font-size: 0.75rem;
  color: var(--gold);
  flex-shrink: 0;
}
.deal-status {
  display: block;
  text-align: center;
  color: var(--muted);
  padding: 28px 0;
  font-size: 0.875rem;
}
.combo-ingredients {
  font-size: 1rem !important;
  color: var(--gold);
}
.combo-detail p + p {
  margin-top: 14px;
}
.round-equipment {
  border-top: 1px solid var(--line);
  margin-top: 8px;
}
.reserve-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.reserve-list > span {
  font-size: 0.875rem;
  color: var(--muted);
  padding: 6px 8px;
  background: #27222f;
  border-radius: 6px;
}
.inventory {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 12px 0;
}
.inventory button {
  font-size: 0.875rem;
}
.inventory p {
  color: var(--muted);
}
details {
  padding: 5px 0;
}
summary {
  cursor: pointer;
  min-height: 44px;
  line-height: 1.6;
  padding: 9px 0;
  font-size: 0.875rem;
}
details p {
  padding: 4px 0;
}
.notice {
  margin: 6px 0 10px;
  padding: 4px 10px;
  background: #3e2c34;
  border: 1px solid #8c655b;
  border-radius: 9px;
}
.notice summary {
  padding: 6px 0;
  min-height: 36px;
  color: #f0c6ab;
}
.meta-progress {
  color: var(--gold);
  padding: 8px 10px;
  background: #302637;
  border-radius: 8px;
  font-size: 0.875rem;
}
.unlock-list,
.achievement-list {
  display: grid;
  gap: 0.65rem;
}
.unlock-row,
.achievement-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: #211d2a;
}
.unlock-row p,
.achievement-row p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}
.unlock-row small {
  display: block;
  margin-top: 0.25rem;
}
.unlock-row button {
  min-height: 44px;
  white-space: nowrap;
}
.achievement-row {
  grid-template-columns: auto 1fr auto;
}
.achievement-row.complete {
  border-color: var(--gold);
}
.achievement-mark {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: #302637;
  color: var(--gold);
  font-weight: 700;
}
.hand-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.4rem;
  margin: 0.65rem 0;
}
.hand-card {
  display: grid;
  justify-items: center;
  gap: 0.15rem;
  min-height: 76px;
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: #211d2a;
  color: var(--ink);
  font-size: 0.75rem;
}
.hand-card.chosen {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px #a36f4533;
}
.hand-card.placed {
  opacity: 0.45;
}
.cell.placed-now {
  animation: place-pulse 260ms ease-out;
}
@keyframes place-pulse {
  0% { transform: scale(0.88); filter: brightness(1.8); }
  100% { transform: scale(1); filter: brightness(1); }
}
.hand-card small {
  color: var(--muted);
  font-size: 0.65rem;
  text-align: center;
}
.route-list {
  display: grid;
  gap: 0.65rem;
}
.route-card {
  display: grid;
  gap: 0.25rem;
  min-height: 64px;
  padding: 0.85rem;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: #211d2a;
  color: var(--ink);
}
.route-card:hover,
.route-card:focus-visible {
  border-color: var(--gold);
}
.route-card small {
  color: var(--muted);
}
.quota-progress {
  color: var(--gold);
}
#drawer textarea#backup-data {
  display: block;
  width: 100%;
  min-height: 120px;
  margin: 8px 0 10px;
  padding: 8px;
  color: var(--ink);
  background: #15131d;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: 0.75rem/1.45 ui-monospace, Consolas, monospace;
}
.backup-actions {
  grid-template-columns: 1fr 1fr;
  margin-bottom: 10px;
}
#actions {
  position: fixed;
  z-index: 5;
  bottom: calc(58px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, 520px);
  padding: 12px 12px 8px;
  background: linear-gradient(transparent, #16151ef8 18%, var(--bg));
  min-height: 76px;
}
#actions:empty {
  display: none;
}
#actions > button {
  width: 100%;
  min-height: 52px;
  font-size: 1rem;
  box-shadow: 0 4px 20px #0003;
}
.action-pair {
  display: grid;
  grid-template-columns: minmax(72px, 1fr) minmax(0, 3fr);
  gap: 8px;
}
.action-pair > button {
  min-height: 52px;
}
.action-pair > .primary {
  font-size: 0.875rem;
}
.action-pair:has(> button:only-child) {
  grid-template-columns: minmax(0, 1fr);
}
#tools {
  position: fixed;
  z-index: 5;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, 520px);
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 8px;
  padding: 7px 12px calc(7px + env(safe-area-inset-bottom));
  min-height: 58px;
  background: #191620;
  border-top: 1px solid #39313f;
}
#tools:empty {
  display: none;
}
#tools button {
  flex: 1;
  min-height: 44px;
  font-size: 0.875rem;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-weight: 500;
  padding: 8px 4px;
}
#tools button:hover {
  color: var(--gold);
}
#save-status {
  font-size: 0.875rem;
  color: #f3b39b;
  position: relative;
  z-index: 6;
}
#save-status:empty {
  display: none;
}
#save-status p {
  margin: 8px 0;
}
#save-status button {
  width: 100%;
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.cards {
  display: grid;
  gap: 9px;
  margin: 12px 0;
}
.card {
  padding: 13px 14px;
  background: linear-gradient(145deg, #292333, #211d2b);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.card-heading {
  display: flex;
  align-items: center;
  gap: 8px;
}
.item-mark {
  font-size: 1.2rem;
  color: var(--gold);
}
.card p {
  font-size: 0.875rem;
  line-height: 1.65;
  margin: 8px 0;
  color: #d3cad6;
}
.card-purchase {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.price {
  font-size: 0.875rem;
  color: var(--gold);
}
.card-purchase button {
  min-height: 44px;
  padding: 8px 14px;
}
.shop-wallet {
  font-size: 1rem;
  color: var(--gold);
  margin-bottom: 10px;
}
.shop-options {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}
.owned-effects p {
  font-size: 0.875rem;
}
.owned-effects summary {
  color: var(--gold);
}
.bag-item {
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}
.bag-item h3 {
  font-size: 1rem;
}
.bag-item p {
  margin: 7px 0;
}
.bag-item button {
  margin: 3px 4px 3px 0;
}
.bag-item .pixel-symbol {
  width: 24px;
  height: 24px;
  margin-right: 5px;
}
.glass-preview {
  text-align: center;
  padding: 24px 8px 16px;
}
.glass-art {
  display: block;
  width: 92px;
  height: 92px;
  margin: 0 auto 15px;
  border-radius: 50%;
  background: #342b3c;
  border: 1px solid #5e485c;
  display: grid;
  place-items: center;
}
.glass-art .pixel-symbol {
  width: 62px;
  height: 62px;
}
.glass-preview h2 {
  font-size: 1.3rem;
  margin: 7px 0 14px;
}
.motif-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.glass-preview .motif-tags {
  justify-content: center;
}
.motif-tags span {
  font-size: 0.75rem;
  padding: 3px 7px;
  border: 1px solid #625065;
  background: #2c2435;
  border-radius: 5px;
  color: #decbbd;
}
.serving-caption {
  text-align: center;
  padding: 22px 8px;
}
.serving-caption h2 {
  margin: 5px 0 10px;
}
.serving-caption p {
  color: var(--muted);
}
.night-result {
  text-align: center;
  padding: 24px 0;
}
.night-result h2 {
  font-size: 1.35rem;
  margin: 8px 0 18px;
}
.night-result p + p {
  margin-top: 10px;
}
.result-star {
  display: block;
  font-size: 2rem;
  color: var(--gold);
  margin-bottom: 12px;
}
.free-label {
  font-size: 0.75rem;
  color: #b9d5c5;
  border: 1px solid #547761;
  border-radius: 5px;
  padding: 4px 6px;
  white-space: nowrap;
}
.candidate-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}
.candidate {
  padding: 13px 7px;
  min-width: 0;
  min-height: 130px;
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 8px;
  background: #292333;
  border-bottom: 3px solid #67576d;
}
.candidate .pixel-symbol {
  width: 38px;
  height: 38px;
}
.candidate strong {
  font-size: 0.875rem;
  font-weight: 500;
  overflow-wrap: anywhere;
  line-height: 1.5;
}
.candidate small {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: auto;
}
.candidate.uncommon {
  border-bottom-color: #92b8ac;
}
.candidate.rare {
  border-bottom-color: #e7c372;
}
.candidate.chosen {
  border-color: var(--gold);
  background: #4b363e;
  box-shadow: inset 0 0 0 1px var(--gold);
}
.candidate.chosen strong {
  color: var(--gold);
}
.candidate-detail {
  padding: 16px 4px;
  min-height: 135px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}
.candidate-detail h3 {
  margin-bottom: 8px;
}
.candidate-detail p {
  margin: 10px 0 8px;
}
.candidate-detail small {
  color: var(--muted);
}
.reward-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.reward-options button {
  padding: 8px;
  font-size: 0.875rem;
}
.reward-options button:last-child {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 0;
  font-size: 0.875rem;
}
select,
input[type="range"] {
  min-height: 44px;
  max-width: 100%;
  border: 1px solid #63516c;
  border-radius: 7px;
  background: #191521;
  color: var(--ink);
  padding: 8px;
  font-size: 0.875rem;
}
input[type="checkbox"] {
  width: 24px;
  height: 24px;
  accent-color: var(--gold);
}
dialog {
  position: fixed;
  inset: auto 0 0;
  margin: 0 auto;
  width: min(100%, 520px);
  max-width: 100%;
  max-height: calc(100svh - 18px);
  padding: 0;
  border: 1px solid #6d5369;
  border-radius: 18px 18px 0 0;
  color: var(--ink);
  background: #211b2b;
  box-shadow: 0 -15px 70px #0009;
  overflow-y: auto;
  overscroll-behavior: contain;
}
dialog::backdrop {
  background: #08070fc4;
  backdrop-filter: blur(3px);
}
dialog > header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px 8px;
  background: #211b2bf5;
  border-bottom: 1px solid #4d3b52;
}
dialog > header h2 {
  font-size: 1rem;
}
#drawer-body {
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
}
#drawer-body > p {
  font-size: 0.875rem;
  margin-bottom: 12px;
}
#drawer-body > button {
  margin: 5px 5px 5px 0;
}
body:has(dialog[open]) {
  overflow: hidden;
}
/* 任意に開く紙の伝票。酔い・必要値・確率は含めない。 */
dialog[data-kind="receipts"] {
  background: #27212e;
}
dialog[data-kind="receipts"] > header {
  background: #27212ef5;
}
.receipt-picker {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  padding: 0 0 20px;
}
.receipt-picker select {
  display: block;
  width: 100%;
  margin-top: 6px;
  font-size: 0.875rem;
}
.receipt-empty {
  padding: 30px 0;
  text-align: center;
}
.receipt-empty p + p {
  margin-top: 10px;
}
.paper-receipt {
  position: relative;
  max-width: 420px;
  margin: 7px auto 18px;
  padding: 24px 18px 22px;
  background: var(--paper);
  color: #342c2b;
  box-shadow: 0 4px 15px #0006;
  font-family: "Courier New", "Yu Gothic", Meiryo, monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  color-scheme: light;
  font-variant-numeric: tabular-nums;
}
.paper-receipt::before,
.paper-receipt::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 8px;
  background:
    linear-gradient(135deg, var(--paper) 25%, transparent 25%) -4px 0,
    linear-gradient(225deg, var(--paper) 25%, transparent 25%) -4px 0;
  background-size: 8px 8px;
  background-repeat: repeat-x;
}
.paper-receipt::before {
  top: -8px;
  transform: rotate(180deg);
}
.paper-receipt::after {
  bottom: -8px;
}
.receipt-head {
  text-align: center;
  padding-bottom: 16px;
  border-bottom: 1px dashed #8d7d72;
}
.receipt-emblem {
  font-size: 1.6rem;
  color: #7b6253;
}
.receipt-head h3 {
  font-family: "Yu Mincho", serif;
  font-size: 1.2rem;
  letter-spacing: 0.15em;
  margin: 2px 0 6px;
}
.receipt-head p {
  font-size: 0.75rem;
}
.receipt-meta {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-top: 18px;
  font-size: 0.75rem;
}
.receipt-section {
  padding: 16px 0;
  border-bottom: 1px dashed #9a8d80;
}
.receipt-section h4 {
  font-size: 0.875rem;
  font-weight: 700;
  margin-bottom: 10px;
}
.receipt-materials {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.875rem;
}
.receipt-materials th {
  font-weight: 400;
  text-align: left;
}
.receipt-materials th:last-child {
  width: 48px;
  text-align: right;
}
.receipt-materials thead {
  font-size: 0.75rem;
  color: #7a6658;
}
.receipt-materials tbody th,
.receipt-materials tbody td {
  padding: 5px 0;
  vertical-align: top;
}
.receipt-materials td {
  text-align: right;
}
.receipt-materials small {
  display: block;
  color: #76655c;
  line-height: 1.5;
  font-size: 0.75rem;
}
.receipt-recipes {
  padding: 0;
  margin: 0;
  list-style: none;
}
.receipt-recipes li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  font-size: 0.875rem;
}
.receipt-recipes .cancelled {
  color: #947f72;
  text-decoration: line-through;
}
.receipt-glass + .receipt-glass {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dotted #b9aa9c;
}
.receipt-glass-title {
  margin-bottom: 8px;
}
.receipt-glass-title b {
  display: block;
  font-size: 0.875rem;
}
.receipt-glass-title small {
  color: #756355;
  font-size: 0.75rem;
}
.paper-receipt dl {
  margin: 0;
  font-size: 0.875rem;
}
.paper-receipt dl > div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 0;
}
.paper-receipt dt {
  margin: 0;
}
.paper-receipt dd {
  margin: 0;
  text-align: right;
  white-space: nowrap;
}
.receipt-glass-status {
  font-size: 0.75rem !important;
  color: #756355;
  margin-top: 5px;
}
.receipt-payment {
  position: relative;
  padding-bottom: 60px;
}
.receipt-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 2px solid #69584d;
  margin-top: 12px;
  padding-top: 14px;
}
.receipt-total > span {
  font-size: 1rem;
  font-weight: 700;
}
.receipt-total strong {
  font-size: 1.8rem;
  line-height: 1.3;
}
.receipt-total strong small {
  font-size: 0.75rem;
  margin-left: 8px;
  font-weight: 400;
}
.receipt-stamp {
  position: absolute;
  bottom: 15px;
  right: 8px;
  transform: rotate(-8deg);
  border: 2px solid #9d6d4e;
  border-radius: 3px;
  padding: 2px 10px;
  color: #9d6d4e;
  font-family: "Yu Gothic", sans-serif;
  font-size: 0.875rem;
  letter-spacing: 0.2em;
}
.receipt-stamp.paid {
  border-color: #66836b;
  color: #547257;
}
.receipt-foot {
  text-align: center;
  padding-top: 18px;
  font-size: 0.75rem;
  color: #796355;
}
.receipt-foot p {
  font-size: 0.75rem !important;
}
.receipt-barcode {
  height: 25px;
  width: 140px;
  margin: 18px auto 4px;
  background: repeating-linear-gradient(
    90deg,
    #544740 0 2px,
    transparent 2px 4px,
    #544740 4px 5px,
    transparent 5px 8px,
    #544740 8px 11px,
    transparent 11px 14px
  );
}
@media (min-width: 700px) {
  #game {
    border-left: 1px solid #332936;
    border-right: 1px solid #332936;
  }
  .cell {
    min-height: 78px;
  }
  dialog {
    bottom: 20px;
    border-radius: 18px;
    max-height: calc(100svh - 40px);
  }
}
@media (max-width: 350px) {
  #game {
    padding-left: 8px;
    padding-right: 8px;
  }
  .wordmark {
    font-size: 0.75rem;
    letter-spacing: 0;
  }
  .topbar {
    gap: 4px;
  }
  #time-left {
    font-size: 0.75rem;
  }
  .cell {
    min-height: 64px;
  }
  .paper-receipt {
    padding: 22px 14px;
  }
  #drawer-body {
    padding-left: 12px;
    padding-right: 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
/* 操作と補助メニューは一つの下部領域。文字を拡大しても重ならない。 */
#game {
  display: grid;
  grid-template-rows: auto auto clamp(170px, 30svh, 280px) minmax(0, 1fr) auto;
  height: 100svh;
  height: 100dvh;
  min-height: 0;
  padding-bottom: 0;
  padding-top: env(safe-area-inset-top);
}
#game:is(
  [data-phase="serving"],
  [data-phase="reaction"],
  [data-phase="refill"],
  [data-phase="nightResult"],
  [data-phase="won"],
  [data-phase="lost"],
  [data-phase="start"]
) {
  grid-template-rows: auto auto clamp(240px, 48svh, 460px) minmax(0, 1fr) auto;
}
#game[data-phase="board"] {
  grid-template-rows: auto auto clamp(170px, 24svh, 250px) minmax(0, 1fr) auto;
}
/* 完成後はつくしと次の操作だけを置く。説明は右上のメニューへ。 */
#game:is(
  [data-phase="finishing"],
  [data-phase="serving"],
  [data-phase="reaction"],
  [data-phase="refill"]
) {
  grid-template-rows: auto minmax(0, 1fr) auto auto;
}
#game:is(
    [data-phase="finishing"],
    [data-phase="serving"],
    [data-phase="reaction"],
    [data-phase="refill"]
  )
  #cup-hud {
  display: none;
}
#game:is(
    [data-phase="finishing"],
    [data-phase="serving"],
    [data-phase="reaction"],
    [data-phase="refill"]
  )
  .portrait-stage {
  grid-row: 2;
}
#game:is(
    [data-phase="finishing"],
    [data-phase="serving"],
    [data-phase="reaction"],
    [data-phase="refill"]
  )
  #portrait {
  width: min(100%, 440px);
  top: 50%;
  transform: translate(-50%, -50%);
}
#game:is(
    [data-phase="finishing"],
    [data-phase="serving"],
    [data-phase="reaction"],
    [data-phase="refill"]
  )
  #interaction {
  grid-row: 3;
  padding: 10px 12px;
}
#game:is(
    [data-phase="finishing"],
    [data-phase="serving"],
    [data-phase="reaction"],
    [data-phase="refill"]
  )
  .action-dock {
  grid-row: 4;
}
.serve-status,
.spin-status {
  color: var(--muted);
  text-align: center;
  font-size: 0.8125rem;
  line-height: 1.5;
}
#game[data-phase="finishing"] .action-pair > .primary {
  font-size: 1rem;
}
#game[data-phase="finishing"] .speech {
  color: #ffe0a1;
  font-weight: 700;
  background: linear-gradient(90deg, #191520dc, #4a3329e6, #191520dc);
}
#game[data-phase="finishing"] .scene-badge:has(.drink-name) {
  border-color: #e6cf9e;
  box-shadow: 0 0 0 2px #e6cf9e33, 0 4px 18px #0008;
  animation: drink-arrive 0.34s ease-out;
}
@keyframes drink-arrive {
  from {
    opacity: 0.35;
    transform: translateX(-50%) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) scale(1);
  }
}
.spin-status {
  padding: 4px 0;
}
.menu-shortcuts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 14px;
}
.topbar {
  height: auto;
  min-height: 52px;
  flex-wrap: wrap;
}
.action-dock {
  position: relative;
  z-index: 5;
  width: calc(100% + 24px);
  margin-left: -12px;
  background: var(--bg);
}
#actions {
  position: relative;
  left: auto;
  bottom: auto;
  transform: none;
  width: 100%;
  min-height: 0;
  padding: 10px 12px 8px;
}
#tools {
  position: relative;
  left: auto;
  bottom: auto;
  transform: none;
  width: 100%;
  min-height: 58px;
}
#tools:empty {
  display: none;
}
#actions:empty {
  padding: 0;
}
.action-dock {
  padding-bottom: env(safe-area-inset-bottom);
}
#save-status:not(:empty) {
  position: fixed;
  z-index: 8;
  left: 50%;
  bottom: calc(9rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(calc(100% - 24px), 496px);
  padding: 12px 14px;
  border: 1px solid #bd8270;
  border-radius: 10px;
  background: #392934;
  box-shadow: 0 4px 24px #0008;
}
/* 熟度・熟成は角の数字。素材名や行の高さを押し広げない。 */
.cell small {
  position: absolute;
  top: 3px;
  right: 3px;
  padding: 2px 3px;
  border-radius: 3px;
  background: #211a2ce8;
  color: #e6cf9e;
  line-height: 1;
  font-size: 0.75rem;
}
.cell:has(small) .pixel-symbol {
  margin-right: 10px;
}
.source-mark {
  left: 3px;
  right: auto;
}
#game[data-reduced="true"] .cell.landed .pixel-symbol {
  animation: none;
}
#game[data-reduced="true"] .portrait-stage {
  transition: none;
}

.slot-machine {
  padding: 9px 0 0;
}
.slot-rail {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  padding: 0 12px 9px;
}
.slot-rail i {
  height: 4px;
  background: #4f3f51;
  border-radius: 4px;
}
.slot-rail i.stopped {
  background: #e8c17f;
  box-shadow: 0 0 8px #c6915244;
}
.slot-rail i.running {
  background: #9c739b;
}
.slot-machine .board-wrap {
  border: 2px solid #8b6470;
  padding: 6px;
  background: #0e0b17;
  box-shadow:
    inset 0 0 0 1px #302132,
    0 6px 22px #0004;
}
.slot-machine .cell {
  min-height: 56px;
  padding-top: 3px;
  padding-bottom: 3px;
}
.slot-machine .cell > .pixel-symbol {
  width: 27px;
  height: 27px;
}
.slot-machine .cell.unrevealed {
  background: linear-gradient(#1b1423, #36213c 50%, #1b1423);
  border-color: #443049;
}
.cell.unrevealed > span {
  display: none;
}
.cell > .reel-window {
  position: relative;
  width: 100%;
  height: 40px;
  flex-shrink: 0;
  overflow: hidden;
  mask-image: linear-gradient(transparent, #000 18%, #000 82%, transparent);
}
.reel-strip {
  will-change: transform;
}
.reel-token {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.reel-token .pixel-symbol {
  width: 36px;
  height: 36px;
  filter: blur(0.35px);
}
.cell.landed {
  animation: reel-stop 0.32s cubic-bezier(0.18, 0.7, 0.3, 1);
}
.cell.landed .pixel-symbol {
  animation: none;
}
@keyframes reel-stop {
  0% {
    transform: translateY(-7px);
  }
  45% {
    transform: translateY(3px);
    border-color: #ffe2a2;
  }
  75% {
    transform: translateY(-1px);
  }
  100% {
    transform: translateY(0);
  }
}
.slot-foot {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px;
  padding: 9px 3px 0;
  color: var(--muted);
  font-size: 0.75rem;
}
.slot-combo-bar {
  display: flex;
  gap: 6px;
  padding-top: 6px;
}
.slot-combo-bar > button {
  min-width: 0;
  padding: 6px 8px;
  font-size: 0.8125rem;
}
.slot-combo-bar > button:first-child {
  flex: 1;
  text-align: left;
  color: var(--gold);
}
.slot-combo-bar > button:last-child {
  background: transparent;
}
.spin-caption {
  text-align: center;
  padding: 18px 0;
}
.spin-caption b {
  display: block;
  color: var(--gold);
  font-size: 1.05rem;
}
.spin-caption span {
  display: block;
  font-size: 0.875rem;
  margin-top: 6px;
  color: var(--muted);
}
.combo-celebration {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  border-left: 3px solid #edc280;
  padding: 9px 12px;
  background: linear-gradient(90deg, #69472f80, transparent);
  animation: combo-arrive 0.28s ease-out;
}
.combo-celebration b {
  color: #ffe0a1;
  font-size: 1.25rem;
  white-space: nowrap;
}
.combo-celebration span {
  font-weight: 700;
}
@keyframes combo-arrive {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.benefit-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 6px 0;
}
.benefit-tags span {
  font-size: 0.8125rem;
  color: #ead2a2;
  padding: 3px 7px;
  border: 1px solid #87604c;
  border-radius: 4px;
  background: #48322c70;
}
.growth-summary {
  padding: 10px 0 3px;
  font-size: 0.875rem;
  color: #c9dec4;
}
.growth-summary > span {
  display: inline-block;
  margin-right: 8px;
  color: #91ba91;
  font-weight: 700;
}
.growth-summary small {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
}
/* 人物を見たまま、下半分を指で操作する。補助画面は必要な時だけ開く。 */
#interaction > :last-child {
  margin-bottom: 6px;
}
.compact-guide .material-role {
  color: var(--gold);
  font-weight: 700;
}
.effect-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 5px 0;
}
.effect-keyword {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 3px 7px;
  border: 1px solid #75606b;
  border-radius: 999px;
  background: #2d2635;
  color: #e6cf9e;
  font-size: 0.75rem;
  line-height: 1.25;
  font-weight: 600;
}
button.effect-keyword {
  cursor: pointer;
}
button.effect-keyword:hover:not(:disabled),
button.effect-keyword:focus-visible,
span.effect-keyword[data-command]:hover,
span.effect-keyword[data-command]:focus-visible {
  border-color: var(--gold);
  background: #4a3540;
}
.candidate-detail > .effect-keywords {
  margin: 4px 0 2px;
}
.compact-pair {
  margin: 8px 0;
}
.compact-pair b,
.compact-pair span {
  display: block;
  font-weight: 400;
}
.compact-pair span {
  color: var(--muted);
}
.candidate-detail > button {
  padding: 6px 0;
  border: 0;
  background: transparent;
  color: var(--gold);
}
.candidate-detail > small {
  display: block;
  color: var(--muted);
}
.candidate-detail .material-lifetime {
  margin: 6px 0;
}
#game .waiting-board .cell {
  min-height: 52px;
}
#game .section-heading {
  margin-bottom: 6px;
}
#game .slot-machine {
  padding-top: 3px;
}
#game .slot-rail {
  padding-bottom: 5px;
}
#game .ready-note {
  margin: 10px 0 0;
}
dialog[data-kind="shop"] {
  max-height: min(62dvh, calc(100dvh - 180px));
}
dialog[data-kind="shop"]::backdrop {
  background: #08070f55;
  backdrop-filter: none;
}
dialog[data-kind="shop"] #drawer-body {
  padding-top: 10px;
}
dialog[data-kind="shop"] .card {
  padding: 10px 12px;
}
dialog[data-kind="shop"] .shop-wallet {
  margin-bottom: 4px;
}
#game .glass-preview {
  padding-top: 4px;
  padding-bottom: 8px;
}
#game .glass-art {
  width: 44px;
  height: 44px;
}
#game .glass-art .pixel-symbol {
  width: 32px;
  height: 32px;
}
#game .night-result {
  padding: 12px 4px;
}
@media (max-width: 350px) {
  .action-dock {
    width: calc(100% + 16px);
    margin-left: -8px;
  }
  #interaction {
    padding-left: 6px;
    padding-right: 6px;
  }
  .board-wrap,
  .slot-machine .board-wrap {
    padding: 4px;
  }
  .board {
    gap: 3px;
  }
}
@media (max-height: 650px) {
  #game {
    grid-template-rows: auto auto 145px minmax(0, 1fr) auto;
  }
  #game:is(
    [data-phase="serving"],
    [data-phase="reaction"],
    [data-phase="refill"],
    [data-phase="nightResult"],
    [data-phase="won"],
    [data-phase="lost"],
    [data-phase="start"]
  ) {
    grid-template-rows: auto auto minmax(145px, 42dvh) minmax(0, 1fr) auto;
  }
  #portrait {
    width: 240px;
  }
}
.material-heading {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}
.material-heading .pixel-symbol {
  width: 42px;
  height: 42px;
}
.material-heading h3 {
  margin-bottom: 4px;
}
.material-heading p {
  font-size: 0.875rem;
  color: var(--gold);
}
.pair-guide {
  margin: 14px 0 0;
}
.pair-guide > div {
  margin-bottom: 10px;
  padding: 10px 12px;
  background: #17131f;
  border-left: 2px solid #93724e;
  border-radius: 0 7px 7px 0;
}
.pair-guide dt {
  font-size: 0.875rem;
  font-weight: 700;
  color: #f1dbb4;
  line-height: 1.6;
}
.pair-guide dd {
  margin: 4px 0 0;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--ink);
}
.material-lifetime {
  padding-top: 10px;
  font-size: 0.875rem;
  color: #cfc2d0;
}
.guide-note {
  margin-top: 12px;
  font-size: 0.8125rem;
  color: var(--muted);
}
.growth-track {
  display: flex;
  gap: 5px;
  align-items: center;
  margin-top: 10px;
}
.growth-track i {
  width: 27px;
  height: 27px;
  line-height: 27px;
  text-align: center;
  font-size: 0.875rem;
  font-style: normal;
  border-radius: 50%;
  border: 1px solid #697360;
  color: #a4b699;
}
.growth-track i.filled {
  color: #172018;
  background: #bad6ac;
}
.growth-track span {
  margin-left: 5px;
  font-size: 0.8125rem;
  color: #bad6ac;
}
.material-this-round {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.material-this-round h4 {
  margin-bottom: 8px;
  color: var(--gold);
}
.material-this-round p {
  margin-bottom: 8px;
  font-size: 0.875rem;
}
.material-this-round p span {
  display: block;
  color: var(--muted);
}
.candidate-detail {
  min-height: 145px;
}
.candidate-detail:has(.material-guide) {
  padding: 18px 14px;
}
.receipt-payment {
  position: relative;
}
.paper-receipt .receipt-total {
  border-top: 0;
  margin-top: 0;
  padding-top: 0;
}
.receipt-summary {
  font-size: 0.875rem;
  margin: 8px 0 14px;
  text-align: center;
  color: #635547;
}
.paper-receipt .receipt-note {
  font-size: 0.8125rem;
  line-height: 1.7;
  color: #6b6155;
  margin-top: 12px;
}
.receipt-liquid {
  display: flex;
  gap: 28px;
  margin: 8px 0;
}
.receipt-liquid > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.receipt-liquid span {
  font-size: 0.875rem;
  color: #706152;
}
.receipt-liquid b {
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}
.receipt-liquid small {
  margin-left: 3px;
  font-size: 0.8125rem;
  font-weight: 400;
}
.receipt-served {
  font-size: 0.875rem;
}
.paper-receipt .receipt-recipes li {
  display: block;
  padding: 10px 0;
  border-bottom: 1px dotted #c7bca5;
}
.receipt-recipes b {
  font-size: 0.875rem;
}
.receipt-recipes p {
  font-size: 0.875rem;
  margin-top: 4px;
}
.receipt-recipes small {
  display: block;
  font-size: 0.8125rem;
  color: #796b5b;
}
.receipt-recipes .receipt-benefits {
  font-size: 0.8125rem;
  color: #826332;
}
.receipt-material-detail summary {
  color: #51402f;
  padding: 0;
  font-weight: 700;
  font-size: 0.875rem;
}
.receipt-material-detail summary span {
  float: right;
}
.receipt-material-detail[open] summary {
  margin-bottom: 12px;
}
.receipt-material-detail .receipt-note {
  margin-bottom: 12px;
}
#game[data-reduced="true"] .reel-strip,
#game[data-reduced="true"] .cell.landed,
#game[data-reduced="true"] .combo-celebration,
#game[data-reduced="true"] .scene-badge:has(.drink-name),
#game[data-reduced="true"] .slot-banner.combo-found {
  animation: none;
}

/* v0.2: 一杯の進行は画面内、詳細は任意のパネルに置く。 */
:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --face-height: clamp(
    156px,
    calc(100dvh - var(--safe-top) - var(--safe-bottom) - 358px),
    260px
  );
}
[hidden] {
  display: none !important;
}
#game,
#game:is([data-phase]) {
  min-height: 0;
  height: 100dvh;
  padding-top: var(--safe-top);
  padding-bottom: 0;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
}
#game[data-phase]:not([data-phase="board"]):not([data-phase="reward"]):not([data-phase="artifacts"]),
#game[data-phase="serving"],
#game[data-phase="reaction"],
#game[data-phase="refill"],
#game[data-phase="nightResult"],
#game[data-phase="won"] {
  grid-template-rows: auto var(--face-height) minmax(0, 1fr) auto;
}
#game:is([data-phase="board"], [data-phase="reward"]),
#game[data-overlay="shop"] {
  grid-template-rows: auto var(--face-height) minmax(0, 1fr) auto;
}
#game[data-phase="artifacts"] {
  grid-template-rows: auto minmax(0, 1fr) auto;
}
#game[data-phase="artifacts"] #interaction {
  grid-row: 2;
  border-radius: 12px;
}
#game[data-phase="artifacts"] .action-dock {
  grid-row: 3;
}
.topbar {
  min-height: 44px;
  height: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto 44px;
  gap: 8px;
}
#time-left {
  margin: 0;
  font-size: 0.875rem;
  white-space: normal;
}
#game .topbar #cup-hud {
  display: flex;
  height: auto;
  font-size: 0.875rem;
  gap: 0;
  white-space: nowrap;
}
.portrait-stage {
  grid-row: 2;
  border-radius: 12px 12px 0 0;
}
#game[data-phase] #portrait {
  width: var(--portrait-display-width, min(100%, 440px));
  height: auto;
  aspect-ratio: 1;
  /* 平常静止画の頭頂は論理座標22。画面ごとの切替で位置を変えない。 */
  top: calc(8px - var(--portrait-display-width, min(100vw, 440px)) * 22 / 180);
  transform: translate(
    calc(-50% + var(--portrait-grid-x, 0px)),
    var(--portrait-grid-y, 0px)
  );
}
#game .speech {
  font-size: 0.875rem;
  line-height: 1.35;
  bottom: 4px;
  padding: 5px 8px;
}
#game #interaction {
  grid-row: 3;
  padding: 8px;
}
#game #interaction:empty {
  display: none;
}
.action-dock {
  grid-row: 4;
  padding-bottom: var(--safe-bottom);
}
#game #actions {
  padding: 8px 12px;
}
#actions > button {
  width: 100%;
}
#actions .primary {
  min-height: 52px;
  font-size: 1rem;
}
#actions .action-pair {
  gap: 8px;
}
#actions .action-pair:has([data-command="buy-artifact"]) {
  grid-template-columns: 1fr 1fr;
}
#game #tools {
  min-height: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 0 12px 4px;
}
#game #tools:empty {
  display: none;
}
#game #tools button {
  padding: 6px 12px;
  font-size: 0.875rem;
  min-height: 44px;
  background: transparent;
}
.pause-choice {
  justify-content: center;
  padding: 0 0 4px;
  min-height: 44px;
}
.pause-choice input {
  min-width: 24px;
}
.received {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.received .pixel-symbol {
  width: 22px;
  height: 22px;
}
#game .serve-status {
  line-height: 1.35;
  margin: 0;
}
#game .welcome {
  padding: 4px;
}
#game .welcome p {
  margin-top: 4px;
}
#game .welcome .muted {
  display: block;
  line-height: 1.55;
}
#game .night-result {
  padding: 4px;
}
#game .result-star {
  display: none;
}
#game .slot-machine {
  position: relative;
  padding: 2px;
}
#game .slot-rail {
  padding: 2px 4px 5px;
}
#game .board-wrap {
  position: relative;
  padding: 4px;
}
#game .board {
  gap: 4px;
}
#game .cell {
  min-height: 52px;
  padding: 4px 1px;
}
#game .cell > span {
  font-size: 0.75rem;
}
.combo-lines {
  position: absolute;
  inset: 4px;
  width: calc(100% - 8px);
  height: calc(100% - 8px);
  pointer-events: none;
  z-index: 2;
}
.combo-lines line {
  stroke: #ffe4a688;
  stroke-width: 1.5;
}
.slot-banner {
  min-height: 44px;
  padding: 5px 6px;
  text-align: center;
  display: grid;
  align-content: center;
  font-size: 0.875rem;
  line-height: 1.3;
}
.slot-banner b {
  color: var(--gold);
}
.slot-banner span {
  font-size: 0.875rem;
}
.slot-banner.combo-found {
  color: #ffe0a1;
  border: 1px solid #a97950;
  border-radius: 9px;
  background: radial-gradient(circle at 50% 0, #70492f99, #2b202fdd 72%);
  box-shadow: 0 0 18px #d29b4c55;
  animation: combo-banner-arrive 0.36s ease-out;
}
.slot-banner.combo-found b {
  font-size: 1rem;
  text-shadow: 0 1px 8px #e4a95b66;
}
@keyframes combo-banner-arrive {
  from {
    opacity: 0.35;
    transform: translateY(5px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
#game .slot-combo-bar {
  margin: 0;
  gap: 4px;
}
#game .slot-combo-bar button {
  padding: 4px 6px;
  font-size: 0.875rem;
}
.happening-card {
  position: absolute;
  inset: 12px;
  z-index: 3;
  display: grid;
  align-content: center;
  gap: 10px;
  padding: 20px;
  text-align: center;
  border: 1px solid var(--gold);
  border-radius: 12px;
  background: #211a2cf2;
}
.happening-card b {
  font-size: 1.2rem;
  color: var(--gold);
}
#game .section-heading {
  margin: 0 0 6px;
}
#game .section-heading h2 {
  font-size: 1rem;
}
#game .candidate-strip {
  gap: 5px;
}
#game .candidate {
  min-height: 92px;
  padding: 6px 4px;
  gap: 2px;
  justify-content: flex-start;
}
.candidate-title {
  display: block;
  width: 100%;
}
#game .candidate .pixel-symbol {
  width: 22px;
  height: 22px;
  float: left;
  margin: 0 3px 0 0;
}
#game .candidate strong {
  font-size: 0.875rem;
  line-height: 1.3;
}
#game .candidate small {
  font-size: 0.875rem;
  line-height: 1.3;
  margin: auto 0 0;
}
#game .candidate .candidate-life {
  margin: 0;
  color: #dfc99e;
}
#game .candidate-detail {
  min-height: 82px;
  padding: 0;
  margin: 2px 0;
  border-bottom: 0;
}
#game[data-phase="reward"] #actions {
  padding-top: 6px;
  padding-bottom: 6px;
}
.choice-description {
  display: flex;
  align-items: center;
  gap: 4px;
}
.choice-description > div {
  flex: 1;
  min-width: 0;
}
.choice-description b {
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.3;
  display: block;
}
.choice-description small {
  display: block;
  font-size: 0.875rem;
  line-height: 1.3;
  color: var(--gold);
}
.choice-description button {
  padding: 4px 6px;
  min-width: 44px;
  flex-shrink: 0;
}
#game .candidate-detail p {
  margin: 4px 0 0;
  font-size: 0.875rem;
  line-height: 1.35;
}
#game .reward-options {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr;
  gap: 4px;
}
#game .reward-options button {
  padding: 4px;
  font-size: 0.875rem;
  line-height: 1.3;
}
#game .reroll-note {
  margin-top: 3px;
  font-size: 0.875rem;
  line-height: 1.25;
  color: var(--muted);
}
.product-list {
  display: grid;
  gap: 6px;
}
.product-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  min-height: 52px;
  padding: 7px 8px;
  text-align: left;
}
.product-row > span:nth-child(2) {
  min-width: 0;
}
.product-row strong {
  display: block;
  font-size: 0.875rem;
}
.product-row small {
  display: block;
  font-size: 0.875rem;
  line-height: 1.35;
  color: var(--muted);
  white-space: normal;
  overflow-wrap: anywhere;
}
.product-row .effect-keywords {
  margin: 3px 0 0;
  gap: 3px;
}
.product-row .effect-keyword {
  min-height: 24px;
  padding: 2px 5px;
  font-size: 0.6875rem;
  font-weight: 500;
}
.product-row b {
  font-size: 0.875rem;
  white-space: nowrap;
  color: var(--gold);
}
.product-row.chosen {
  border-color: var(--gold);
  background: #47343d;
}
.product-mark {
  color: var(--gold);
  font-size: 1.25rem;
}
.product-detail {
  padding: 4px 0;
  min-height: 64px;
}
.product-detail h3 {
  font-size: 1rem;
  margin-bottom: 4px;
}
.product-detail p {
  font-size: 0.875rem;
  line-height: 1.4;
}
.product-detail .effect-keywords {
  margin: 2px 0 7px;
}
.product-caution {
  color: #f0c6ab;
  border-left: 3px solid #c48765;
  padding-left: 8px;
}
.product-detail small {
  font-size: 0.875rem;
  line-height: 1.35;
  display: block;
  margin-top: 4px;
  color: var(--gold);
}
dialog[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  max-height: calc(100dvh - 16px - var(--safe-top));
}
dialog > header {
  position: relative;
  min-height: 44px;
  padding: 4px 10px;
}
dialog > header h2 {
  margin-right: auto;
}
#drawer-body {
  overflow-y: auto;
  min-height: 0;
  padding: 12px;
}
#drawer-body > p {
  font-size: 0.875rem;
}
#drawer-actions {
  padding: 6px 12px calc(8px + var(--safe-bottom));
  border-top: 1px solid var(--line);
  background: var(--panel);
}
#drawer-actions:empty {
  display: none;
}
#drawer-actions button.primary {
  min-height: 52px;
  font-size: 1rem;
}
#drawer-actions > button {
  width: 100%;
}
dialog[data-kind="shop"] {
  top: calc(var(--safe-top) + 44px + var(--face-height));
  bottom: 0;
  height: calc(100dvh - var(--safe-top) - 44px - var(--face-height));
  max-height: none;
}
dialog[data-kind="shop"]::backdrop {
  backdrop-filter: none;
  background: #08070f44;
}
dialog[data-kind="shop"] #drawer-body {
  padding: 6px 10px;
}
dialog[data-kind="shop"] .shop-wallet {
  font-size: 0.875rem;
  margin-bottom: 6px;
}
.shop-options {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 4px;
  margin-bottom: 5px;
}
.shop-options button {
  padding: 4px;
}
#drawer-actions .action-pair {
  grid-template-columns: 1fr 1fr;
}
.bag-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr 1.6fr;
  gap: 4px;
  position: sticky;
  top: -12px;
  padding: 4px 0;
  background: var(--panel);
  z-index: 1;
}
.bag-tabs button {
  padding: 4px;
}
[aria-pressed="true"] {
  border-color: var(--gold);
}
.bag-group {
  border-bottom: 1px solid var(--line);
  padding: 4px 0;
}
.bag-group summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: 0.875rem;
}
.bag-group .pixel-symbol {
  width: 24px;
  height: 24px;
}
.bag-group > button {
  margin: 4px 4px 6px 0;
}
.bag-instance {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 0;
  font-size: 0.875rem;
}
.tool-owned {
  display: grid;
  gap: 3px;
}
.tool-owned small {
  font-size: 0.875rem;
  color: var(--muted);
}
.menu-shortcuts {
  grid-template-columns: 1fr;
}
.menu-shortcuts button {
  min-height: 48px;
  text-align: left;
}
.tool-inline-options {
  display: flex;
  align-items: center;
  gap: 4px;
}
.tool-inline-options > label {
  padding: 2px 0;
  flex: 1;
  min-width: 0;
  flex-wrap: nowrap;
  gap: 4px;
}
.tool-inline-options select {
  min-width: 0;
  width: 100%;
  padding: 4px;
}
.tool-inline-options label > span {
  flex-shrink: 0;
  white-space: nowrap;
}
.tool-inline-options > button {
  padding: 4px;
}
.tool-verdict {
  font-size: 0.875rem;
  line-height: 1.3;
  margin: 0 0 4px;
}
.tool-target-list {
  display: grid;
  gap: 6px;
}
.tool-target-list button {
  text-align: left;
}
.tool-target-list span {
  display: block;
  font-size: 0.875rem;
  font-weight: 400;
}
#game[data-editing="true"] .cell {
  min-height: 44px;
  padding: 2px 1px;
}
#game[data-editing="true"] .cell .pixel-symbol {
  width: 22px;
  height: 22px;
}
#game[data-editing="true"] .slot-banner {
  min-height: 28px;
  padding: 3px;
}
#game[data-editing="true"] #actions {
  padding-top: 4px;
  padding-bottom: 6px;
}
#save-status:not(:empty) {
  position: absolute;
  bottom: calc(var(--safe-bottom) + 6px);
  left: 50%;
  z-index: 20;
  width: calc(100% - 16px);
  font-size: 0.875rem;
}
@media (max-width: 350px) {
  #game #actions {
    padding-left: 8px;
    padding-right: 8px;
  }
  #game #interaction {
    padding: 6px;
  }
  #game .cell {
    min-height: 48px;
  }
  #game .board {
    gap: 3px;
  }
  #game .candidate {
    min-height: 92px;
  }
}

/* v0.3: 頭頂を固定し、選択・抽選の操作面をコンパクトに保つ。 */
.quiet-receipt {
  border: 0;
  background: transparent;
  padding: 0 4px;
  min-width: 44px;
  min-height: 44px;
  font-size: 0.875rem;
  color: var(--muted);
}
.quiet-receipt:hover {
  background: transparent;
  color: var(--gold);
}
#game .topbar {
  height: 44px;
  padding-top: 0;
  padding-bottom: 0;
  gap: 4px;
}
#game #actions {
  padding: 4px 8px;
}
#game:is([data-phase="board"], [data-phase="reward"]) .speech,
#game[data-overlay="shop"] .speech {
  display: none;
}
#game .cell {
  min-height: 44px;
  height: 44px;
  padding: 1px;
}
#game .cell .pixel-symbol {
  width: 19px;
  height: 19px;
}
#game .cell > span {
  font-size: 0.875rem;
  line-height: 1.05;
}
#game .board {
  gap: 2px;
}
#game .slot-rail {
  padding: 0 2px 3px;
}
#game .board-wrap {
  padding: 2px;
}
#game .slot-banner {
  min-height: 32px;
  padding: 2px;
  line-height: 1.15;
}
#game #interaction {
  padding: 4px;
}
#game .candidate {
  min-height: 92px;
  padding: 2px;
}
#game .candidate-title {
  display: grid;
  justify-items: center;
}
#game .candidate .pixel-symbol {
  float: none;
  margin: 0;
  width: 16px;
  height: 16px;
}
#game .candidate strong {
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: 0.875rem;
  line-height: 1.25;
}
#game .candidate small {
  font-size: 0.875rem;
  margin: 0;
  line-height: 1.15;
}
#game .candidate .candidate-rarity {
  display: flex;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
}
#game .candidate-detail {
  min-height: 78px;
  margin: 0;
}
#game .choice-description b {
  line-height: 1.2;
}
#game .candidate-detail p {
  margin-top: 2px;
  line-height: 1.2;
}
#game .reroll-note {
  margin: 2px 0 0;
  line-height: 1.15;
}
#game .scene-badge:has(.drink-name) {
  max-width: calc(100% - 16px);
  padding: 2px;
}
.drink-name {
  border: 0;
  background: transparent;
  padding: 4px 6px;
  min-height: 44px;
  font-size: 1rem;
  color: var(--gold);
  white-space: normal;
  overflow-wrap: anywhere;
}
.drink-name span {
  font-size: 0.875rem;
  color: var(--muted);
}
.receipt-drink-name {
  font-size: 1rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}
dialog[data-kind="rename"] input {
  width: 100%;
  font-size: 1rem;
  min-height: 44px;
}
@media (max-height: 680px) {
  #game .choice-description small {
    display: none;
  }
}
dialog[data-kind="shop"] .product-detail:has(> p.muted) {
  min-height: 0;
}
dialog[data-kind="shop"] > header {
  height: 44px;
  padding: 0 10px;
}
dialog[data-kind="shop"] .product-detail {
  padding: 2px 0;
}
dialog[data-kind="shop"] .product-detail p {
  line-height: 1.3;
}
@media (max-height: 680px) {
  dialog[data-kind="shop"] .product-row {
    min-height: 44px;
    padding: 4px 8px;
  }
  dialog[data-kind="shop"] .product-row small {
    display: block;
  }
}

#game:is(
    [data-phase="finishing"],
    [data-phase="serving"],
    [data-phase="reaction"],
    [data-phase="refill"]
  )
  .scene-badge {
  top: auto;
  bottom: 58px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}
#game[data-editing="true"] #interaction {
  padding: 0;
}
#game[data-editing="true"] .slot-machine {
  padding: 0;
  margin-bottom: 0;
}
#game[data-editing="true"] .board-wrap {
  padding: 0;
}
#game[data-editing="true"] #actions {
  padding-top: 4px;
  padding-bottom: 4px;
}
#game[data-editing="true"] .tool-verdict {
  line-height: 1.2;
  margin-bottom: 2px;
}
#game[data-editing="true"] .scene-badge {
  padding: 0;
}
#game[data-editing="true"] .scene-badge button {
  border: 0;
  background: transparent;
  padding: 2px 6px;
}
.tool-inline-options:empty {
  display: none;
}
.tool-inline-options > label {
  margin: 0;
  padding: 0;
}
.tool-inline-options select {
  min-height: 44px;
  height: 44px;
}

/* 最終見た目: 枠線付きの丸い部品を増やさず、面と横線でそろえる。 */
button { border-radius: 2px; }
.portrait-stage { border-radius: 6px 6px 0 0; }
#interaction { border-radius: 0 0 6px 6px; }
.board-wrap { border-radius: 4px; }
.cell { border-radius: 2px; }
.card,
.unlock-row,
.achievement-row,
.candidate,
.route-card,
.hand-card,
.notice,
.meta-progress {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.card,
.unlock-row,
.achievement-row,
.candidate,
.hand-card,
.notice {
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}
.route-card {
  border-left: 3px solid #59616d;
  border-bottom: 1px solid var(--line-soft);
}
.candidate.chosen,
.hand-card.chosen,
.hand-card:focus-visible {
  border-top-color: var(--accent);
  border-bottom-color: var(--accent);
  box-shadow: none;
}
.effect-keyword,
.benefit-tags span,
.motif-tags span,
.combo-chip {
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid #8a714d;
  background: transparent;
}
.combo-chip.active {
  border-bottom-color: var(--accent);
  background: #2a2e35;
}
.action-dock { border-top: 1px solid #69707a; }
dialog { border-radius: 6px 6px 0 0; }
@media (min-width: 700px) { dialog { border-radius: 6px; } }

/* v1の見た目。角丸カードを重ねず、面と横線で区切る。 */
:root {
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --surface-0: #12141a;
  --surface-1: #1b1e26;
  --surface-2: #242832;
  --line-soft: #3b414c;
  --accent: #d8b471;
  --accent-cool: #9fc9c0;
}

body { background: var(--surface-0); }
#game { background: var(--surface-1); border-color: #303640; }
.topbar { border-bottom: 1px solid var(--line-soft); }
.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 6px;
  align-items: center;
  min-height: 48px;
  flex-wrap: nowrap;
}
.topbar #time-left { margin-left: 0; }
.topbar #cup-hud { justify-content: center; gap: 10px; height: 32px; border: 0; }
.topbar .quiet-receipt,
.topbar .icon-button { min-width: 40px; width: 40px; height: 40px; }
#time-left { color: var(--accent); }
.wallet { border-bottom: 1px solid var(--line-soft); }
.portrait-stage { background: #171922; border-color: var(--line-soft); border-radius: 6px 6px 0 0; }
.scene-badge,
.speech { border-radius: 2px; background: #171922f2; border-color: #59616d; }
#interaction { background: var(--surface-1); border-color: var(--line-soft); border-top-color: #8f7650; border-radius: 0 0 6px 6px; }
#interaction > * { min-width: 0; }
.section-heading { min-height: 32px; padding-bottom: var(--space-2); border-bottom: 1px solid var(--line-soft); }
button { border-radius: 2px; border-color: var(--line-soft); background: var(--surface-2); box-shadow: none; }
button:hover:not(:disabled) { background: #2c323d; }
button.primary { background: var(--accent); border-color: var(--accent); }
.board-wrap { padding: var(--space-2); border-radius: 4px; background: #101217; box-shadow: inset 0 2px 10px #0008; }
.board { gap: 5px; }
.cell { min-height: 62px; border-radius: 2px; background: #282e39; border-color: #444c58; }
.cell.combo-cell,
.cell.source-cell { box-shadow: inset 0 -2px 0 var(--accent); }
.card,
.unlock-row,
.achievement-row,
.candidate,
.route-card,
.hand-card,
.notice,
.meta-progress { border: 0; border-radius: 0; box-shadow: none; }
.card,
.unlock-row,
.achievement-row,
.candidate,
.hand-card,
.notice { border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.unlock-row,
.achievement-row { padding-inline: 0; }
.candidate { border-bottom: 2px solid #59616d; }
.candidate.chosen { border-top-color: var(--accent); border-bottom-color: var(--accent); }
.route-card { min-height: 72px; border-left: 3px solid #59616d; border-bottom: 1px solid var(--line-soft); background: #20252e; }
.route-card:hover:not(:disabled),
.route-card:focus-visible { border-left-color: var(--accent); }
.hand-card { min-height: 84px; border-top: 2px solid #59616d; }
.hand-card.chosen,
.hand-card:focus-visible { border-top-color: var(--accent); border-bottom-color: var(--accent); }
.effect-keyword,
.benefit-tags span,
.motif-tags span,
.combo-chip { border: 0; border-radius: 0; border-bottom: 1px solid #8a714d; background: transparent; }
.effect-keyword { min-height: 26px; padding-inline: 4px; }
.combo-chip.active { border-bottom-color: var(--accent); background: #2a2e35; }
.action-dock { border-top: 1px solid #69707a; }
dialog { border-radius: 6px 6px 0 0; }
@media (min-width: 700px) { dialog { border-radius: 6px; } }

/* 最後の寸法合わせ。二つ並ぶ操作は同じ幅、説明と価格は同じ基準線に置く。 */
.action-pair {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.action-pair > button,
.card-purchase > button,
.reward-options > button {
  width: 100%;
  white-space: normal;
}

.unlock-row,
.achievement-row {
  min-width: 0;
}

.unlock-row > *,
.achievement-row > * {
  min-width: 0;
}

.card-purchase {
  align-items: stretch;
}

.card-purchase > button {
  flex: 0 0 7.5rem;
}

.reward-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
}

.reward-options > button:last-child {
  grid-column: 1 / -1;
}

.menu-shortcuts {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.menu-shortcuts > button {
  min-width: 0;
  padding-inline: var(--space-2);
}

@media (max-width: 350px) {
  .action-pair,
  .reward-options {
    grid-template-columns: 1fr;
  }

  .reward-options > button:last-child {
    grid-column: auto;
  }

  .card-purchase > button {
    flex-basis: 6.5rem;
  }
}
