/* Game shell: page frame, header, toolbar, How to play, Settings and win screen.
   Shared by every game. Game-specific styles live next to each game. */

/* Portrait / narrow: bar, buttons, message, play area stacked.
   Landscape: buttons move to a column on the right so the play area gets the height. */
body.game {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto auto minmax(0, 1fr);
  grid-template-areas: "bar" "tools" "msg" "board";
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
@media (orientation: landscape) and (min-width: 820px) {
  body.game {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas: "bar bar" "msg msg" "board tools";
  }
  .toolbar { flex-direction: column; flex-wrap: nowrap; padding: 0 16px 12px 0; overflow-y: auto; }
  .toolbar .btn { min-width: 8.5em; }
}

.game-bar {
  grid-area: bar;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
  padding: 10px 16px 4px;
}
.game-title { flex: 1 1 14rem; min-width: 0; }
.game-title h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.6rem;
  line-height: 1.2;
  color: var(--heading);
}
.status { display: flex; flex-wrap: wrap; gap: 0 1.1rem; font-size: 1.05rem; font-weight: 700; color: var(--ink-soft); }
.status .daily-tag { color: var(--accent); }
html.high-contrast .status .daily-tag { color: var(--ink); }

.toolbar { grid-area: tools; display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 4px 16px; }

.msg-area { grid-area: msg; }
.message {
  min-height: 1.6em;
  margin: 2px 16px 6px;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
}

.btn-feedback svg { width: 1.3em; height: 1.3em; flex: none; }
.btn-help { min-width: 64px; padding: 0 0.5em; font-size: max(30px, 1.7rem); font-family: Georgia, "Times New Roman", serif; }

/* How to play */
.help-box { max-width: 40rem; text-align: left; }
.help-box h2 { text-align: center; }
.steps { list-style: none; margin: 0 0 1.25rem; padding: 0; display: grid; gap: 1rem; counter-reset: step; }
.steps li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1.25rem; counter-increment: step; }
.steps p { flex: 1 1 12rem; margin: 0; font-size: 1.35rem; font-weight: 700; line-height: 1.35; }
.steps p::before { content: counter(step) ". "; color: var(--accent); }
html.high-contrast .steps p::before { color: var(--ink); }
.step-pic { flex: none; width: 196px; display: flex; gap: 8px; justify-content: center; align-items: center; padding-top: 6px; }
.mark {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font: 700 17px/26px Arial, sans-serif;
  text-align: center;
  color: #fff;
}
.mark.yes { background: #15803d; }
.mark.no { background: #b91c1c; }
.fake-btn {
  padding: 0.3em 0.7em;
  font-weight: 700;
  border: 3px solid var(--wood-dark);
  border-radius: 12px;
  background: var(--card);
}

/* Choices and settings */
.choice-list { display: grid; gap: 0.75rem; margin-bottom: 1rem; }
.btn-choice { flex-direction: column; gap: 0.1em; padding: 0.6em 1em; }
.btn-choice strong { font-size: 1.3em; }
.btn-choice span { font-weight: 400; font-size: 0.85em; }
.btn-choice.daily { border-color: var(--accent); }

.setting { margin-bottom: 1rem; }
.setting h3 { margin: 0 0 0.4rem; font-size: 1.2rem; }
.seg { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; }
.seg .btn { flex: 1 1 0; min-width: 6.5em; }

/* Win screen */
.win-art { display: flex; justify-content: center; gap: 8px; margin-bottom: 0.5rem; }
.win-art:empty { display: none; }
.win-art .mini-tile { width: 58px; height: 74px; }
.win-box h2 { font-size: 2.4rem; color: var(--accent); }
html.high-contrast .win-box h2 { color: var(--ink); }
.win-box .win-detail { font-weight: 700; color: var(--ink-soft); }
.win-box .win-detail:empty { display: none; }

@media (orientation: portrait), (max-width: 819px) {
  .toolbar { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
  .toolbar .btn { padding-left: 0.3em; padding-right: 0.3em; }
}
@media (max-width: 640px) {
  .toolbar { grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  /* Row 1: Home ... Feedback ?   Row 2: title and status */
  .game-bar { gap: 0.4rem 0.6rem; }
  .game-title { order: 3; flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.8rem; }
  .game-title h1 { font-size: 1.4rem; }
  .wide-only { display: none; }
  .btn-feedback { margin-left: auto; min-width: 56px; padding: 0 0.5em; }
  .btn-feedback span { display: none; }
  .feedback-off .btn-help { margin-left: auto; }
  .status { font-size: 0.95rem; gap: 0 0.7rem; }
}

/* A gentle note under the message when the pieces are small on this screen (Mahjong tiles, Spider cards) */
.size-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 0.75rem;
  margin: 0 12px 8px;
  padding: 0.5rem 0.75rem;
  background: var(--card);
  border: 3px solid var(--wood);
  border-radius: 14px;
  font-weight: 700;
  text-align: center;
}
.size-note[hidden] { display: none; }
