:root {
  color-scheme:dark;
  font-family:'Yu Gothic',Meiryo,sans-serif;
  background:#101d22;
  color:#f1eee2
}
* {
  box-sizing:border-box
}
body {
  margin:0
}
main {
  max-width:1080px;
  margin:auto;
  padding:28px 22px
}
header {
  display:flex;
  align-items:center;
  justify-content:space-between
}
h1 {
  font-size:32px;
  letter-spacing:.15em;
  margin:0
}
small,.muted {
  color:#a8b9b8
}
header span {
  color:#dec18a
}
#info {
  display:flex;
  gap:12px;
  flex-wrap:wrap;
  margin:22px 0
}
.pill {
  background:#23373c;
  padding:9px 15px;
  border-radius:8px
}
section {
  border:1px solid #3b5354;
  border-radius:16px;
  padding:20px;
  margin:14px 0;
  background:#182d31
}
h2 {
  font-size:16px;
  margin:0 0 14px
}
.row {
  display:flex;
  gap:9px;
  flex-wrap:wrap;
  align-items:center
}
.card {
  width:72px;
  height:100px;
  border:1px solid #d4cbb6;
  background:#fff9e9;
  color:#273439;
  border-radius:9px;
  display:inline-flex;
  flex-direction:column;
  justify-content:center;
  align-items:center;
  font-size:26px;
  font-weight:bold;
  position:relative;
  padding:0;
  box-shadow:0 3px 0 #0003
}
.card.red {
  color:#be4c48
}
.card em {
  font-size:25px;
  font-style:normal
}
.card.dora:after {
  content:'ドラ';
  font-size:10px;
  background:#c49c4c;
  color:#17292d;
  position:absolute;
  bottom:3px;
  border-radius:3px;
  padding:0 4px
}
.card.selected {
  outline:3px solid #f0ca7d;
  transform:translateY(-8px)
}
button.card {
  cursor:pointer
}
.back {
  background:repeating-linear-gradient(45deg,#305456,#305456 5px,#264548 5px,#264548 10px);
  border:3px solid #a1b9af;
  color:#d8c18a
}
.discards {
  min-height:51px;
  margin-top:14px
}
.discards .card {
  width:36px;
  height:49px;
  font-size:15px;
  border-radius:4px
}
.discards .card em {
  font-size:13px
}
.discards .card:after {
  display:none
}
#center {
  text-align:center;
  background:#203e40;
  padding:22px;
  border-radius:14px
}
#message {
  font-size:18px;
  color:#f1d495;
  margin:6px
}
#actions {
  margin-top:20px;
  justify-content:center
}
button:not(.card) {
  border:1px solid #75877b;
  border-radius:8px;
  padding:12px 18px;
  background:#d9bb7c;
  color:#12272c;
  font:inherit;
  font-weight:bold;
  cursor:pointer
}
button:disabled {
  opacity:.3;
  cursor:default
}
#result:empty {
  display:none
}
#result {
  border-color:#b6965f
}
#result p {
  line-height:1.8
}
details {
  margin-top:24px;
  color:#b6c6c2
}
summary {
  cursor:pointer
}
table {
  border-collapse:collapse;
  width:100%;
  font-size:13px
}
td,th {
  padding:9px;
  text-align:left;
  border-bottom:1px solid #3b5354
}
#log {
  line-height:1.8;
  font-size:13px;
  max-height:170px;
  overflow:auto
}
footer {
  font-size:12px;
  color:#8da5a2;
  margin-top:20px
}
@media(max-width:600px) {
  main {
    padding:18px 12px
  }
  .card {
    width:55px;
    height:80px;
    font-size:23px
  }
  section {
    padding:15px
  }
  .pill {
    font-size:12px;
    padding:7px 10px
  }
  button:not(.card) {
    padding:10px;
    font-size:13px
  }
  h1 {
    font-size:26px
  }
}
/* Compact table: keep the hand and controls close together. */
main {
  max-width:880px;
  padding:14px 16px
}
h1 {
  font-size:26px
}
header {
  gap:12px
}
header small {
  font-size:11px
}
.header-tools {
  display:flex;
  align-items:center;
  gap:12px
}
.version {
  font-size:10px
}
#info {
  gap:6px;
  margin:12px 0
}
.pill {
  padding:6px 10px;
  font-size:12px;
  border-radius:6px
}
section {
  padding:12px 14px;
  margin:9px 0;
  border-radius:10px
}
h2 {
  font-size:14px;
  margin-bottom:10px
}
.row {
  gap:7px
}
.card {
  width:58px;
  height:78px;
  font-size:23px;
  border-radius:6px
}
.card em {
  font-size:21px
}
.card.dora:after {
  font-size:9px;
  bottom:2px
}
.card.selected {
  transform:translateY(-5px)
}
:is(#npcHand, [id^="npcHand-"]) .card {
  width:46px;
  height:60px;
  font-size:19px
}
:is(#npcHand, [id^="npcHand-"]) .card em {
  font-size:18px
}
.discards {
  min-height:34px;
  margin-top:9px;
  gap:5px
}
.discards .card {
  width:26px;
  height:35px;
  font-size:12px
}
.discards .card em {
  font-size:10px
}
#center {
  padding:12px;
  border-radius:10px
}
#message {
  font-size:14px;
  min-height:21px;
  margin:4px 0
}
#actions {
  margin-top:10px;
  gap:6px
}
button:not(.card) {
  padding:8px 12px;
  font-size:13px;
  border-radius:6px
}
#result p {
  font-size:13px;
  line-height:1.6;
  margin:10px 0 0
}
details {
  margin-top:12px;
  font-size:12px
}
footer {
  margin-top:12px;
  font-size:10px
}
td,th {
  padding:6px
}
#sound-controls {
  display:flex;
  align-items:center;
  gap:7px
}
#sound-toggle {
  padding:5px 9px;
  font-size:12px;
  background:#293e40;
  color:#f1d495
}
#sound-volume {
  width:65px;
  accent-color:#d9bb7c
}
#sound-controls label {
  font-size:11px;
  color:#a8b9b8
}
@media(max-width:600px) {
  main {
    padding:10px
  }
  header {
    align-items:flex-start
  }
  .header-tools {
    flex-direction:column;
    align-items:flex-end;
    gap:5px
  }
  h1 {
    font-size:24px
  }
  section {
    padding:10px
  }
  .card {
    width:49px;
    height:69px;
    font-size:21px
  }
  .card em {
    font-size:19px
  }
  .pill {
    padding:5px 7px;
    font-size:11px
  }
  #actions {
    gap:5px
  }
  button:not(.card) {
    padding:9px 10px;
    font-size:12px
  }
  #message {
    font-size:13px
  }
  #sound-volume {
    width:54px
  }
}
#hand-heading {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:8px;
  margin-bottom:10px
}
#hand-heading h2 {
  margin:0
}
#hand-heading label {
  font-size:11px;
  color:#b6c6c2
}
#hand-sort {
  font:inherit;
  font-size:12px;
  color:#f1d495;
  background:#293e40;
  border:1px solid #75877b;
  border-radius:5px;
  padding:4px 6px
}
.card.drawn {
  outline:3px solid #75dce8;
  outline-offset:2px
}
.card.drawn.selected {
  outline:3px solid #f0ca7d;
  box-shadow:0 0 0 6px #75dce8
}
.card.role-part {
  border:3px solid var(--group-color);
  box-shadow:inset 0 0 0 1px #182d31
}
.card.role-unused {
  opacity:.45
}
.card .card-note {
  position:absolute;
  top:1px;
  left:2px;
  font-size:9px;
  line-height:1.1;
  color:#153034;
  background:#b9edf0;
  padding:1px 2px;
  border-radius:2px
}
.card .group-note {
  position:absolute;
  bottom:-17px;
  font-size:10px;
  white-space:nowrap;
  color:var(--group-color)
}
.winning-hand {
  padding-bottom:19px;
  padding-top:5px
}
.win-panel:empty {
  display:none
}
.win-panel {
  margin-top:8px;
  font-size:12px
}
.win-panel strong {
  color:#f1d495;
  font-size:17px;
  margin-right:8px
}
.role-tabs {
  display:flex;
  flex-wrap:wrap;
  gap:5px;
  margin:8px 0
}
.role-tabs button {
  padding:4px 8px;
  font-size:11px;
  background:#293e40;
  color:#d8e5dc
}
.role-tabs button[aria-pressed=true] {
  background:#d9bb7c;
  color:#12272c
}
.role-legend {
  line-height:1.8;
  margin:4px 0;
  color:#c8d9d3
}
.role-legend span {
  margin-right:12px
}
.settlement {
  font-size:12px;
  line-height:1.7;
  margin-top:8px
}
.settlement:empty {
  display:none
}
#draw-hint {
  font-size:10px;
  color:#75dce8;
  margin-left:8px
}
:is(#npcHand, [id^="npcHand-"]).winning-hand .card {
  width:58px;
  height:78px;
  font-size:23px
}
:is(#npcHand, [id^="npcHand-"]).winning-hand .card em {
  font-size:21px
}
@media(max-width:600px) {
  :is(#npcHand, [id^="npcHand-"]).winning-hand .card {
    width:49px;
    height:69px;
    font-size:21px
  }
  .card .group-note {
    font-size:9px
  }
}
/* Embedded illustrations retain their aspect ratio inside every card size. */
.card.illustrated {
  isolation:isolate;
  color:#273439;
  --ink:#6d561b
}
.card.illustrated.red {
  --ink:#aa2643
}
.card.illustrated[title^="サファイア"] {
  --ink:#2059a2
}
.card.illustrated[title^="エメラルド"] {
  --ink:#18774f
}
.card .card-art {
  position:absolute;
  inset:22% 7% 8%;
  width:86%;
  height:70%;
  object-fit:contain;
  pointer-events:none;
  user-select:none
}
.card.face-card .card-art {
  inset:2px;
  width:calc(100% - 4px);
  height:calc(100% - 4px);
  border-radius:4px
}
.card .card-number {
  position:absolute;
  top:2px;
  left:3px;
  font-size:19px;
  line-height:1.05;
  color:var(--ink);
  background:#fff9e9ed;
  border-radius:3px;
  padding:0 2px;
  z-index:1;
  font-variant-numeric:tabular-nums
}
.card .face-suit {
  position:absolute;
  top:2px;
  right:2px;
  width:16px;
  height:17px;
  object-fit:contain;
  background:#fff9e9ed;
  border-radius:3px;
  padding:1px;
  pointer-events:none
}
.card .card-note {
  top:auto;
  left:auto;
  bottom:2px;
  right:2px;
  font-size:8px;
  z-index:2
}
.card.dora:after {
  left:2px;
  right:auto;
  bottom:2px;
  font-size:8px;
  z-index:2
}
.discards .card .card-number {
  font-size:10px;
  top:1px;
  left:1px;
  padding:0 1px
}
.discards .card .face-suit {
  width:9px;
  height:10px;
  top:1px;
  right:1px
}
.discards .card .card-art {
  inset:24% 6% 3%;
  width:88%;
  height:73%
}
.discards .card.face-card .card-art {
  inset:1px;
  width:calc(100% - 2px);
  height:calc(100% - 2px)
}
:is(#npcHand, [id^="npcHand-"]):not(.winning-hand) .card-number {
  font-size:15px
}
@media(max-width:600px) {
  .card .card-number {
    font-size:17px
  }
  .card .face-suit {
    width:14px;
    height:15px
  }
}
/* Double the previous frame dimensions. Keep a dedicated number/suit header. */
.card {
  width:116px;
  height:156px;
  flex-shrink:0;
  border-radius:10px;
  --number-size:30px;
  --suit-size:24px
}
:is(#npcHand, [id^="npcHand-"]) .card {
  width:92px;
  height:120px;
  --number-size:24px;
  --suit-size:20px
}
:is(#npcHand, [id^="npcHand-"]).winning-hand .card {
  width:116px;
  height:156px;
  --number-size:30px;
  --suit-size:24px
}
.discards .card {
  width:52px;
  height:70px;
  --number-size:16px;
  --suit-size:13px;
  border-radius:6px
}
.discards {
  min-height:70px
}
.card .card-number,:is(#npcHand, [id^="npcHand-"]):not(.winning-hand) .card-number,.discards .card .card-number {
  top:3px;
  left:4px;
  font-size:var(--number-size);
  line-height:1.05;
  padding:0 2px
}
.card .face-suit,.discards .card .face-suit {
  top:3px;
  right:4px;
  width:var(--suit-size);
  height:var(--suit-size)
}
.card .card-art,.card.face-card .card-art,.discards .card .card-art,.discards .card.face-card .card-art {
  inset:27% 4% 12%;
  width:92%;
  height:61%;
  object-fit:contain
}
.card .card-note {
  bottom:3px;
  right:3px;
  font-size:10px
}
.card.dora:after {
  bottom:3px;
  left:3px;
  font-size:10px
}
@media(max-width:600px) {
  .card,:is(#npcHand, [id^="npcHand-"]).winning-hand .card {
    width:98px;
    height:138px;
    --number-size:26px;
    --suit-size:22px
  }
  .discards .card {
    width:52px;
    height:70px;
    --number-size:16px;
    --suit-size:13px
  }
}
/* Match the table: NPC above, shared information in the middle, player below. */
#center header {
  justify-content:center;
  align-items:center;
  flex-wrap:wrap;
  gap:10px 24px
}
#center h1 {
  font-size:26px
}
#center .header-tools {
  align-items:center
}
#center #info {
  justify-content:center;
  margin:10px 0 8px
}
#center #message {
  margin-bottom:0
}
#player-area {
  display:grid;
  grid-template-columns:minmax(0,1fr) 130px;
  gap:16px;
  align-items:start
}
#player-content {
  min-width:0
}
#player-area #actions {
  display:flex;
  flex-direction:column;
  align-items:stretch;
  justify-content:flex-start;
  margin:0;
  padding-left:12px;
  border-left:1px solid #3b5354;
  gap:7px
}
#player-area #actions button {
  width:100%;
  min-height:36px;
  padding:9px 6px
}
#hand-heading {
  flex-wrap:wrap
}
#playerHand.winning-hand {
  row-gap:24px
}
@media(max-width:600px) {
  #center header {
    align-items:center;
    gap:8px 14px
  }
  #center .header-tools {
    align-items:center
  }
  #player-area {
    grid-template-columns:minmax(0,1fr) 105px;
    gap:10px
  }
  #player-area #actions {
    padding-left:8px;
    gap:6px
  }
  #player-area #actions button {
    font-size:11px;
    padding:9px 3px
  }
  #playerHand {
    gap:7px
  }
}
[hidden] {
  display:none!important
}
.start-card {
  max-width:620px;
  margin:24px auto;
  padding:26px
}
.start-card h1 {
  font-size:42px;
  margin:8px 0
}
.eyebrow {
  color:#d9bb7c;
  font-size:12px;
  letter-spacing:.1em
}
.start-card p {
  font-size:13px;
  line-height:1.9
}
.start-card select {
  display:block;
  width:100%;
  margin:8px 0 14px;
  padding:12px;
  background:#293e40;
  color:#f1eee2;
  border:1px solid #75877b;
  border-radius:6px;
  font:inherit
}
.start-card #start-game {
  width:100%;
  margin:8px 0 16px
}
.registration-row {
  display:flex;
  gap:8px;
  margin-top:6px
}
.registration-row input {
  min-width:0;
  flex:1;
  padding:9px;
  border:1px solid #75877b;
  border-radius:6px;
  background:#101d22;
  color:#f1eee2;
  font:inherit
}
.start-card ul {
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  list-style:none;
  padding:0
}
.start-card li {
  background:#293e40;
  padding:6px 10px;
  border-radius:6px;
  font-size:12px
}
.start-rules {
  color:#a8b9b8
}
#npc-feedback {
  min-height:20px;
  margin:5px 0;
  color:#f1d495
}
#final-screen h2 {
  font-size:22px;
  color:#f1d495
}
#final-table-wrap {
  overflow-x:auto
}
#final-table-wrap table {
  min-width:650px
}
#final-table-wrap td {
  white-space:nowrap
}
#final-winner {
  color:#f1d495;
  font-size:18px
}
#center {
  padding:8px 12px
}
#center #info {
  margin:0;
  justify-content:center
}
#player-status {
  padding:0 4px;
  font-size:12px;
  color:#a8b9b8
}
#player-status #message {
  font-size:13px;
  margin:4px 0
}
#player-status:has(.settlement:not(:empty)) {
  margin-bottom:8px
}
#player-audio {
  display:flex;
  justify-content:flex-end;
  padding:5px 4px 10px
}
#player-audio #sound-controls {
  flex-wrap:wrap
}
.card {
  touch-action:manipulation
}

/* NPCの台詞はNPC枠内に表示し、中央の対局情報とは分離する。 */
:is(#npc-dialogue, [id^="npc-dialogue-"]):empty { display: none; }
:is(#npc-dialogue, [id^="npc-dialogue-"]) {
  background: #243f42;
  border-left: 3px solid #d9bb7c;
  border-radius: 6px;
  color: #f1e3bf;
  padding: 8px 12px;
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}
:is(#npc-dialogue, [id^="npc-dialogue-"]) p { margin: 0; }
:is(#npc-dialogue, [id^="npc-dialogue-"]) p + p { margin-top: 4px; }

/* NPCの手札・台詞の右に顔画像を配置。画像は切り抜かず枠内に収める。 */
:is(#npc-area, [id^="npc-area-"]) { display: grid; grid-template-columns: minmax(0, 1fr) 180px; gap: 16px; align-items: start; }
:is(#npc-content, [id^="npc-content-"]) { min-width: 0; }
:is(#npc-portrait, [id^="npc-portrait-"]) { border-left: 1px solid #3b5354; padding-left: 10px; }
:is(#npc-face, [id^="npc-face-"]) { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 8px; }
:is(#npcHand, [id^="npcHand-"]).winning-hand { row-gap: 24px; }
@media(max-width:600px) {
  :is(#npc-area, [id^="npc-area-"]) { grid-template-columns: minmax(0, 1fr) 92px; gap: 10px; }
  :is(#npc-portrait, [id^="npc-portrait-"]) { padding-left: 6px; }
}

.npc-area.current-npc { border-color: #d9bb7c; }
.share-x {
  display:inline-block;
  padding:10px 16px;
  margin:6px 0;
  border:1px solid #d9bb7c;
  border-radius:8px;
  background:#243f42;
  color:#f1e3bf;
  text-decoration:none;
  font-weight:bold;
}
.share-x:hover { background:#35575a; }
.share-x:focus-visible { outline:3px solid #f1d495; outline-offset:3px; }
.share-note { font-size:13px; line-height:1.7; overflow-wrap:anywhere; }

/* 戦績・GS一覧 */
#progress-panel { margin-block: 1rem; }
.stats-filters { display: flex; flex-wrap: wrap; gap: 1rem; margin-block: 1rem; }
#gs-catalog p { padding-block: .6rem; border-bottom: 1px solid #ffffff26; line-height: 1.6; }

#gs-game { margin: 1rem; padding: 1rem; border: 1px solid #b7a167; border-radius: 12px; overflow-wrap: anywhere; }
#gs-game button, #gs-catalog button { margin: .25rem; }
#gs-game p { line-height: 1.6; }
/* プレイヤーの専用画面 */
.player-menu { display: flex; flex-wrap: wrap; gap: 10px; }
.player-menu button { flex: 1; min-width: 100px; }
.player-screen .start-card { max-width: 960px; }
.player-screen-header { gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.player-screen-header h1 { font-size: clamp(26px, 5vw, 36px); }
.player-screen h2 { margin-top: 28px; color: #dec18a; }
.player-screen .balance-display { font-size: 20px; font-weight: bold; color: #dec18a; }
.skill-grid, .achievement-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 14px; margin-block: 20px; }
.skill-card, .achievement-card { padding: 18px; border: 1px solid #3b5354; border-radius: 12px; background: #102529; overflow-wrap: anywhere; }
.skill-card { display: flex; flex-wrap: wrap; align-content: space-between; }
.skill-card p { width: 100%; }
.achievement-card h3 { margin: 0; font-size: 16px; }
.achievement-card p { margin: 5px 0 0; font-size: 12px; line-height: 1.4; }
.achievement-card.achieved { border-color: #dec18a; }
.achievement-card.achieved p { color: #dec18a; }
#achievements-screen .start-card { padding: 14px 18px; }
#achievements-screen .player-screen-header { margin-bottom: 8px; }
#achievements-screen h2 { margin: 14px 0 4px; font-size: 17px; }
#achievements-screen .start-card > p:not(.balance-display) { margin: 4px 0; font-size: 12px; }
#achievements-screen .achievement-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 205px), 1fr)); gap: 7px; margin: 7px 0 12px; }
#achievements-screen .achievement-card { padding: 9px 11px; border-radius: 8px; }
#achievements-screen .achievement-card h3 { font-size: 13px; line-height: 1.35; }
.stat-grid { display: grid; gap: 10px; }
.stat-grid p { padding: 12px 16px; margin: 0; border-radius: 8px; background: #102529; }
.player-screen .stats-filters label { flex: 1; min-width: 120px; }

.reset-data-controls { margin-top: 28px; padding-top: 18px; border-top: 1px solid #3b5354; }
button.danger-button { color: #ffd6cf; background: #542e2e; border-color: #b76b65; }
button.danger-button:hover { background: #6b3535; }

/* 占い師と種類別のGS売り場 */
.shop-keeper { display: flex; align-items: center; gap: 24px; padding: 16px; margin-block: 20px; border: 1px solid #715d7d; border-radius: 14px; background: linear-gradient(120deg, #30263b, #172c30); }
.shop-keeper-image { display: block; width: 155px; height: 220px; object-fit: contain; flex: 0 0 auto; }
.shop-keeper .shop-greeting { font-size: 17px; color: #f1d8a5; }
.shop-tabs { display: flex; gap: 8px; margin-top: 24px; border-bottom: 1px solid #75877b; padding-bottom: 10px; }
.shop-tabs button { flex: 1; }
.shop-tabs button[aria-selected="true"] { color: #182d31; background: #dec18a; border-color: #dec18a; }
.shop-tabs button:focus-visible { outline: 3px solid #80d8cf; outline-offset: 3px; }
.shop-category-panel { display: grid; grid-template-columns: minmax(160px, 230px) minmax(0, 1fr); gap: 20px; align-items: start; margin-block: 20px; }
.shop-category-character { margin: 0; position: sticky; top: 16px; text-align: center; }
.shop-category-character img { display: block; width: 100%; height: 340px; object-fit: contain; }
.shop-category-character figcaption { color: #dec18a; margin-top: 10px; }
.shop-category-products { min-width: 0; }
.player-screen .shop-category-products h2 { margin-top: 0; }
@media (max-width: 600px) {
  .shop-keeper { gap: 12px; padding: 12px; }
  .shop-keeper-image { width: 95px; height: 160px; }
  .shop-keeper .shop-greeting { font-size: 14px; }
  .shop-category-panel { grid-template-columns: minmax(0, 1fr); }
  .shop-category-character { position: static; }
  .shop-category-character img { height: 240px; }
}

/* GSの必要枠と装備中の占有範囲 */
.equipment-slots { display: grid; gap: 8px; margin: 12px 0 20px; }
.slot-hand { --slot-color: #ffb36b; --slot-fill: #57351f; }
.slot-stock { --slot-color: #80d8ef; --slot-fill: #214b59; }
.slot-wisdom { --slot-color: #c4a3ef; --slot-fill: #403254; }
.equipment-slot-group { min-width: 0; padding: 8px; border: 1px solid var(--slot-color, #52696a); border-radius: 9px; background: #102529; text-align: center; }
.equipment-slot-group.empty { border-style: dashed; color: #a8b9b8; }
.equipment-slot-boxes { display: flex; gap: 6px; }
.equipment-slot { display: flex; flex: 1; height: 32px; align-items: center; justify-content: center; border: 1px solid #52696a; border-radius: 5px; color: #a8b9b8; }
.equipment-slot.filled { border-color: var(--slot-color); background: var(--slot-fill); color: var(--slot-color); font-weight: bold; }
.equipment-slot-label { display: block; font-size: 12px; margin-top: 8px; overflow-wrap: anywhere; }
.skill-slot-badge { display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 12px; font-size: 12px; color: var(--slot-color); }
.slot-squares { display: inline-flex; gap: 4px; }
.slot-square { width: 16px; height: 16px; border: 1px solid #52696a; border-radius: 3px; background: #102529; }
.slot-square.filled { background: var(--slot-color); border-color: var(--slot-color); }
@media (max-width: 420px) { .equipment-slots { gap: 5px; } .equipment-slot-group { padding: 6px 4px; } .equipment-slot-label { font-size: 11px; } }

.owned-skill-list, .equipment-replace-options { display: flex; gap: 8px; flex-wrap: wrap; margin-block: 14px; }
.owned-skill { font-size: 13px; border-color: var(--slot-color); }
.skill-icon { display: inline-grid; width: 1.55em; height: 1.55em; margin-inline-end: .35em; place-items: center; vertical-align: -.12em; border: 1px solid currentColor; border-radius: 5px; font-size: .95em; font-weight: 800; line-height: 1; }
.skill-icon-hand { color: #ffbd83; background: #57351f; }
.skill-icon-stock { color: #9beaff; background: #214b59; }
.skill-icon-wisdom { color: #d4b9f7; background: #403254; }
.gs-effect-details .skill-icon { margin-inline-end: .45em; }
.skill-description::first-letter { color: var(--slot-color); font-weight: 800; }
.owned-skill[aria-pressed="true"] { background: var(--slot-fill); color: var(--slot-color); box-shadow: inset 0 0 0 1px var(--slot-color); }
.equipment-replace-options button[aria-pressed="true"] { border-color: #dec18a; background: #51452b; }
button.equipment-slot-group { font: inherit; cursor: pointer; color: #f1eee2; }
button.equipment-slot-group:hover { background: #243f42; }
button.equipment-slot-group:focus-visible { outline: 3px solid #80d8cf; outline-offset: 3px; }
#start-skill-picker > button, #shop-skill-picker > button { margin: 4px; }

.slot-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-block: 8px; font-size: 12px; }
.slot-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.slot-legend-item::before { content: ''; width: 12px; height: 12px; background: var(--slot-color); border-radius: 3px; }

#shop-keeper-image, #shop-category-image { cursor: zoom-in; }
#shop-keeper-image:focus-visible, #shop-category-image:focus-visible { outline: 3px solid #80d8cf; outline-offset: 4px; border-radius: 8px; }

/* 開始画面・ショップの装備枠は金色の共通ボタンより優先し、明暗差を確保する。 */
:is(#start-equipment-slots, #shop-equipment-slots) button.equipment-slot-group {
  background: #13242b;
  border: 2px solid var(--slot-color, #718593);
  color: #f8fafc;
  padding: 10px 8px;
}
:is(#start-equipment-slots, #shop-equipment-slots) button.equipment-slot-group:hover {
  background: #21343e;
  border-color: var(--slot-color, #a9bac6);
}
:is(#start-equipment-slots, #shop-equipment-slots) .equipment-slot-label {
  color: #f8fafc;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.6;
}
:is(#start-equipment-slots, #shop-equipment-slots) .equipment-slot.filled {
  background: var(--slot-fill);
  color: var(--slot-color);
  border: 2px solid var(--slot-color);
}
:is(#start-equipment-slots, #shop-equipment-slots) button.equipment-slot-group.empty {
  background: #172830;
  border: 2px dashed #718593;
}
:is(#start-equipment-slots, #shop-equipment-slots) button.equipment-slot-group.empty:hover { background: #21343e; }
:is(#start-equipment-slots, #shop-equipment-slots) .empty .equipment-slot {
  background: #172830;
  border-color: #718593;
  color: #cbd5e1;
}
:is(#start-equipment-slots, #shop-equipment-slots) .empty .equipment-slot-label { color: #cbd5e1; }
/* 開始画面は操作と装備を中心にまとめる。 */
#start-screen .start-card { margin-block: 12px; padding: 20px; }
#start-screen #start-setup { margin-top: 0; gap: 16px; }
#start-screen #progress-panel { margin-block: 12px; padding: 14px; }
#start-screen .player-menu { margin-top: 12px; }
#start-screen #equipped-summary { margin-block: 6px; }
#start-screen .reset-data-controls { margin-top: 16px; padding-top: 12px; }
#start-screen #nickname-status:empty, #start-screen #start-equipment-status:empty, #start-screen #reset-status:empty { display: none; }
.shop-header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
#shop-help-dialog { width: min(720px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); box-sizing: border-box; padding: 22px; overflow-y: auto; border: 1px solid #dec18a; border-radius: 14px; background: #14262b; color: #f1eee2; }
#shop-help-dialog::backdrop { background: #071418d9; }
.shop-help-header { gap: 16px; margin-bottom: 18px; }
.shop-help-header h2 { margin: 0; color: #dec18a; font-size: 20px; }
#shop-help-dialog p, #shop-help-dialog li { font-size: 14px; line-height: 1.8; }
#shop-help-dialog ul { list-style: disc; padding-left: 22px; }
#shop-help-dialog li { margin-bottom: 8px; }
#shop-help-dialog h3 { font-size: 16px; margin: 22px 0 10px; color: #dec18a; }
#shop-help-dialog table { width: 100%; }
#shop-help-dialog th, #shop-help-dialog td { padding: 9px 7px; white-space: nowrap; }
@media (max-width: 600px) {
  #start-screen .start-card { padding: 16px; }
  #start-screen #start-setup { gap: 10px; }
  #shop-help-dialog { padding: 16px; }
  .shop-header-actions button { padding: 8px; }
}

/* ショップ上部は占い師と装備操作を並べ、説明はヘルプにまとめる。 */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
#shop-screen { --shop-character-width: 230px; --shop-character-height: 340px; }
#shop-screen .shop-header { justify-content: flex-end; margin-bottom: 12px; }
#shop-screen .shop-keeper { display: grid; grid-template-columns: minmax(0, var(--shop-character-width)) minmax(0, 1fr); gap: 20px; align-items: start; padding: 0; border: 0; background: none; margin-block: 12px 20px; }
#shop-screen .shop-keeper-image, #shop-screen .shop-category-character img { width: 100%; max-width: var(--shop-character-width); height: var(--shop-character-height); object-fit: contain; margin-inline: auto; }
#shop-screen .shop-category-panel { grid-template-columns: minmax(0, var(--shop-character-width)) minmax(0, 1fr); }
.shop-loadout { min-width: 0; }
#shop-screen .shop-loadout .balance-display { margin: 0 0 8px; }
#shop-screen .shop-loadout #shop-equipment { margin: 0 0 8px; font-weight: bold; }
#shop-screen .shop-loadout .slot-legend { gap: 10px; }
#shop-screen .shop-loadout #progress-status:empty { display: none; }
@media (max-width: 600px) {
  #shop-screen { --shop-character-width: clamp(90px, 28vw, 160px); --shop-character-height: 240px; }
  #shop-screen .shop-keeper { gap: 12px; }
  #shop-screen .shop-category-panel { grid-template-columns: minmax(0, 1fr); }
  #shop-screen .shop-loadout .equipment-slots { gap: 4px; }
  #shop-screen .shop-loadout button.equipment-slot-group { padding: 7px 3px; }
  #shop-screen .shop-loadout .equipment-slot-label { font-size: 12px; }
}
