/* Full-screen game panels. The surrounding shell sets the available height. */
.turn-panel {
  --sheet: #f5ebd4;
  --sheet-light: #fff6e1;
  --sheet-ink: #2e271b;
  --sheet-muted: #665238;
  --sheet-line: #b79a66;
  --sheet-forest: #233c30;
  --sheet-gold: #d9b376;
  --inner-gap: clamp(6px, 1.3vmin, 16px);
  position: relative;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: var(--inner-gap);
  min-inline-size: 0;
  min-block-size: 0;
  width: min(100%, 1080px);
  height: 100%;
  justify-self: center;
  padding: clamp(9px, 2vmin, 24px);
  color: var(--sheet-ink);
  background:
    radial-gradient(ellipse at 35% 12%, #fff9e7 2%, #fff9e700 70%),
    linear-gradient(150deg, #f7edd7, #ecdfbd);
  border: 1px solid #976d38;
  border-radius: 12px;
  box-shadow: inset 0 0 0 3px #f8ebd3, inset 0 0 0 4px #b39154a8, 0 9px 28px #15140850;
}
.turn-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 8px;
  min-width: 0;
}
.turn-top > .eyebrow {
  color: #6e4d25;
  font-size: clamp(9px, 1.5vmin, 11px);
  letter-spacing: .13em;
}
.turn-title {
  display: block;
  min-width: 0;
  margin: 0;
  color: var(--sheet-ink);
  font: 600 clamp(23px, 5vmin, 54px)/.98 Crimson, Georgia, serif;
  letter-spacing: -.035em;
  text-wrap: balance;
}
.turn-title h2,
.turn-title h3 {
  font: inherit;
  margin: 0;
}
.turn-body {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: var(--inner-gap);
  min-width: 0;
  min-height: 0;
}
.turn-card {
  --image-ratio: 1fr;
  display: grid;
  grid-template-columns: minmax(0, var(--image-ratio)) minmax(0, 1fr);
  min-inline-size: 0;
  min-block-size: 0;
  width: 100%;
  border: 1px solid var(--sheet-line);
  border-radius: 8px;
  background: #fbf0d8;
  box-shadow: 0 4px 12px #59421f24;
}
.turn-art {
  display: grid;
  min-width: 0;
  min-height: 0;
  isolation: isolate;
  position: relative;
  border-radius: 7px 0 0 7px;
  background: var(--sheet-forest);
  overflow: hidden;
}
.turn-art::after {
  content: "";
  position: absolute;
  inset: 5px;
  z-index: 1;
  border: 1px solid #ffe1a488;
  border-radius: 4px;
  pointer-events: none;
}
.turn-art img {
  position: absolute;
  display: block;
  width: 100%;
  height: 100%;
  inset: 0;
  object-fit: cover;
  object-position: center 41%;
}
[data-screen="picker"] .turn-art img,
[data-screen="move"] .turn-art img {
  object-position: center 23%;
}
.turn-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(4px, 1.3vmin, 14px);
  min-inline-size: 0;
  min-block-size: 0;
  padding: clamp(8px, 2vmin, 24px);
}
.turn-copy h3 {
  margin: 0;
  font: 600 clamp(20px, 4vmin, 42px)/1 Crimson, Georgia, serif;
  letter-spacing: -.03em;
}
.turn-copy p, .turn-panel > p, .turn-body p {
  font-size: clamp(12px, 2vmin, 16px);
  line-height: 1.32;
  margin: 0;
  color: var(--sheet-muted);
}
.turn-copy .stat-chips {
  margin: 0;
  padding-top: .35em;
  gap: 3px;
}
.turn-copy .stat-chips > span {
  padding: 1px 4px;
  color: #4d3c22;
  white-space: normal;
}
.turn-bottom {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: clamp(4px, 1.4vmin, 12px);
  min-width: 0;
}
.turn-pager, .turn-actions, .party-mini {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(4px, 1.1vmin, 10px);
  min-width: 0;
}
.turn-pager {
  font-variant-numeric: tabular-nums;
  text-align: center;
  flex: none;
}
.turn-pager > span,
.turn-pager > strong {
  min-width: 2.5em;
  color: #5a4329;
  font-size: 12px;
}
.turn-actions { justify-content: flex-end; }
.turn-btn,
.turn-panel .primary-btn {
  display: inline-grid;
  place-items: center;
  text-align: center;
  min-inline-size: 0;
  min-block-size: 38px;
  padding: 5px clamp(8px, 1.6vmin, 15px);
  border: 1px solid #a27f4c;
  border-radius: 5px;
  color: #4f3a22;
  background: #fff4d9;
  font: 700 clamp(10px, 1.8vmin, 13px)/1.12 Inter, Arial, sans-serif;
  box-shadow: inset 0 0 0 1px #f1ddad, 0 1px 2px #4a38262b;
}
.turn-panel .primary-btn {
  background: linear-gradient(#963f38, #76312b);
  box-shadow: inset 0 0 0 1px #d68b6069, 0 2px 3px #4a38262b;
  color: #fff4d8;
}
.turn-panel button:not(:disabled):hover { filter: brightness(1.07); }
.turn-panel button:disabled { opacity: .58; cursor: default; }
.turn-panel button:focus-visible { outline: 2px solid #6b3c19; outline-offset: 2px; }
.party-mini {
  justify-content: flex-start;
  font-size: clamp(10px, 1.7vmin, 13px);
}
.party-mini img {
  width: 2.4em;
  height: 2.4em;
  object-fit: cover;
  object-position: center 24%;
  border-radius: 50%;
  border: 1px solid #ae8b52;
}
.party-mini button:not(.turn-btn) {
  border: 1px solid #b4935e;
  border-radius: 4px;
  color: #5a3b26;
  background: #f0dfb9;
  font-size: 11px;
}
.meter-list {
  display: grid;
  gap: 3px;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
.meter-list .skill-meter {
  min-width: 0;
  font-size: clamp(10px, 1.6vmin, 13px);
}
.meter-list .skill-meter > span { display: flex; justify-content: space-between; gap: 5px; }
.meter-list .skill-meter b { white-space: nowrap; }
.recap-card {
  display: grid;
  align-content: center;
  gap: clamp(4px, 1.2vmin, 12px);
  min-width: 0;
  min-height: 0;
  padding: clamp(6px, 1.2vmin, 14px);
  border: 1px solid var(--sheet-line);
  border-radius: 6px;
  background: #fff5db;
}
.score-stage {
  display: grid;
  align-content: center;
  gap: var(--inner-gap);
  min-width: 0;
  min-height: 0;
}
.turn-dialog {
  width: min(calc(100% - 14px), 760px);
  height: min(calc(100dvh - 14px), 630px);
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #30271c;
  overflow: clip;
  box-shadow: 0 14px 75px #15130978;
}
.turn-dialog::backdrop { background: #14231deb; }
.turn-dialog > .turn-panel { width: 100%; }
.turn-dialog form { margin: 0; }

@media (max-width: 620px) and (orientation: portrait) {
  .turn-card {
    grid-template: minmax(0, 1fr) auto / minmax(0, 1fr);
  }
  .turn-art { border-radius: 7px 7px 0 0; }
  [data-screen="picker"] .turn-art img,
  [data-screen="move"] .turn-art img { object-position: center 30%; }
  .turn-copy { padding: 7px 9px; }
  .turn-bottom { flex-wrap: wrap; }
  .turn-actions { flex: auto; }
}
@media (max-height: 399px) {
  .turn-panel { --inner-gap: 4px; padding: 7px 8px; border-radius: 8px; }
  .turn-title { font-size: 24px; }
  .turn-copy { gap: 3px; padding: 5px 8px; }
  .turn-copy h3 { font-size: 18px; }
  .turn-copy p, .turn-body p { font-size: 11px; line-height: 1.2; }
   .turn-btn, .turn-panel .primary-btn { min-height: 29px; padding-block: 3px; }
  .turn-art::after { inset: 3px; }
}

.turn-list {
  display: grid;
  align-content: center;
  gap: 3px;
  margin: 0;
  padding: 0;
  min-width: 0;
  list-style: none;
  font-size: clamp(11px, 1.8vmin, 14px);
  line-height: 1.25;
}
.turn-panel select {
  max-width: 100%;
  border: 1px solid #a27f4c;
  border-radius: 4px;
  color: var(--sheet-ink);
  background: var(--sheet-light);
  font: inherit;
}
.turn-panel[data-screen="scenario"] {
  background: radial-gradient(ellipse at 80% 3%,#385248,#20372d 58%,#1a2c25);
  box-shadow: inset 0 0 0 3px #243930, inset 0 0 0 4px #b39154a8, 0 9px 28px #15140850;
}
.turn-panel[data-screen="scenario"] .turn-title,
.turn-panel[data-screen="scenario"] .turn-top > .eyebrow,
.turn-panel[data-screen="scenario"] .turn-pager > span,
.turn-panel[data-screen="scenario"] .turn-pager > strong { color: #f0d6a2; }
.turn-panel[data-screen="scenario"] .turn-card { --image-ratio: 1.65fr; }
.turn-panel[data-screen="approach"] .turn-card { --image-ratio: 1.18fr; }
.turn-panel[data-screen="reveal"] .turn-card { --image-ratio: .9fr; }
.turn-panel .turn-copy .risk { margin: 0; line-height: 1.2; }
.turn-panel .turn-actions > * { flex: 0 1 auto; }

@media (min-width: 621px) and (min-height: 650px) {
  .turn-panel {
    padding-inline: clamp(20px, 3vw, 36px);
  }
  .turn-art::after {
    inset: 8px;
    border-width: 2px;
  }
  .turn-btn, .turn-panel .primary-btn {
    min-height: 44px;
  }
}

.turn-tools {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.turn-pager > [data-id="prev"], .turn-pager > [data-id="next"] {
  width: 38px;
  flex: none;
  padding-inline: 0;
  font-size: 16px;
}
.turn-pager > span { white-space: nowrap; }
.turn-panel[data-screen="picker"] .turn-bottom,
.turn-panel[data-screen="move"] .turn-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
}
.party-mini button:not(.turn-btn), .empty-party-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 0 1 auto;
  min-width: 0;
  padding: 2px 4px;
}
.empty-party-slot {
  min-height: 25px;
  padding-inline: 8px;
  border: 1px dashed #9f875e;
  border-radius: 4px;
  color: #69512f;
  white-space: nowrap;
}
.party-mini button img { width: 25px; height: 25px; }
.turn-caption,.turn-forecast,.turn-notice {
  align-self: center;
  font-size: clamp(10px, 1.65vmin, 13px);
  line-height: 1.2;
}
.turn-caption,.turn-forecast { color: #3f5b3c; }
.turn-notice { color: #7b3c2d; }
.turn-panel .move-reason {
  color: #753e31;
  margin: 0;
  font-size: clamp(10px, 1.55vmin, 13px);
  line-height: 1.15;
}
.turn-skill {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: clamp(10px, 1.75vmin, 13px);
}
.turn-risk {
  color: #733b2e;
  font-size: clamp(10px, 1.65vmin, 14px);
  font-weight: 700;
}
.meter-list .skill-meter > i {
  display: block;
  height: 4px;
  overflow: hidden;
  border-radius: 5px;
  background: #d7c8a7;
}
.meter-list .skill-meter > i > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #637755;
}
.meter-list .skill-meter > i > .short { background: #a06943; }
.turn-list > div {
  display: grid;
  gap: 2px;
  padding: clamp(5px, 1.15vmin, 14px);
  border: 1px solid #b096656b;
  border-radius: 5px;
  background: #fff5dc;
}
.turn-list dt {
  color: #523823;
  font: 600 clamp(16px, 3vmin, 25px)/1 Crimson, Georgia, serif;
}
.turn-list dd { margin: 0; color: #493e30; }
.recap-card {
  justify-items: center;
  text-align: center;
  background: radial-gradient(ellipse at center, #395441, #20352b);
  color: #e9d3a5;
}
.recap-card p { color: #eadfca; }
.recap-party { display: flex; justify-content: center; gap: clamp(10px, 4vw, 35px); }
.recap-party > div { display: grid; justify-items: center; gap: 2px; }
.recap-party img {
  width: clamp(42px, 14vmin, 100px);
  height: clamp(42px, 14vmin, 100px);
  object-fit: cover;
  border: 2px solid #c6a56a;
  border-radius: 50%;
}
.recap-total {
  color: #734233;
  font: 700 clamp(21px, 5vmin, 46px)/1 Crimson, Georgia, serif;
}
.recap-card .recap-total { color: #f0ca7e; }

@media(max-width: 620px) and (orientation: portrait) {
  .turn-panel[data-screen="picker"] .turn-bottom,
  .turn-panel[data-screen="move"] .turn-bottom {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .turn-panel .party-mini,.turn-panel .turn-forecast,.turn-panel .turn-notice {
    grid-column: 1 / -1;
  }
  .turn-bottom .turn-pager { justify-content: flex-start; }
  .turn-panel[data-screen="approach"] .turn-copy {
    gap: 4px;
  }
}
@media(max-height: 399px) {
  .turn-pager > [data-id="prev"], .turn-pager > [data-id="next"] { width: 28px; }
  .turn-pager > span { font-size: 10px; }
  .turn-list > div { padding: 5px 7px; }
  .party-mini button img { width: 20px; height: 20px; }
}
.deal-intro {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: clamp(10px, 3vmin, 24px);
  padding: 11px;
  color: #f6e4bc;
  background: linear-gradient(#192a21dd, #192a21ec), url(assets/table.webp) center/cover;
  border: 1px solid #b39763;
  border-radius: inherit;
}
.deal-fan {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(5px, 2vmin, 18px);
}
.deal-mini {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: min(26vw, 24vh, 170px);
  max-height: 49vh;
  margin: 0;
  padding: 4px;
  border: 3px double #a98247;
  border-radius: 5px;
  color: #573a21;
  background: #f7eacd;
  box-shadow: 0 5px 16px #120e08a8;
}
.deal-mini .portrait {
  width: 100%;
  aspect-ratio: 4/5;
  object-fit: cover;
  object-position: 50% 24%;
}
.deal-name {
  font: 700 clamp(12px,3vmin,21px)/1 Crimson, Georgia, serif;
}

.turn-art { touch-action: pan-y; }
.roster-jumps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  align-content: center;
  grid-template-columns: repeat(4,minmax(0,1fr));
  gap: clamp(4px,1.7vmin,14px);
  min-height: 0;
}
.roster-jump {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 4px;
  min-width: 0;
  padding: 5px 3px;
  border: 1px solid var(--sheet-line);
  border-radius: 4px;
  background: var(--sheet-light);
  color: var(--sheet-ink);
  font: 600 clamp(11px,2vmin,18px)/1 Crimson, Georgia, serif;
}
.roster-jump .portrait {
  width: min(100%,60px);
  aspect-ratio: 1;
  object-fit: cover;
  object-position: center 22%;
  border-radius: 50%;
}
.turn-pager > button:not([data-id="next"]):not([data-id="prev"]) {
  padding-inline: 4px;
}
@media(min-width: 820px) and (min-height: 540px) {
  .turn-panel[data-screen="picker"] .turn-copy {
    padding-inline: clamp(23px,4vw,57px);
    gap: 13px;
  }
  .turn-panel[data-screen="picker"] .turn-copy h3 {
    font-size: clamp(42px,6vw,80px);
  }
  .turn-panel[data-screen="picker"] .turn-copy p {
    font-size: clamp(16px,1.7vw,23px);
  }
  .turn-panel[data-screen="picker"] .stat-chips {
    padding-top: 14px;
    gap: 8px;
  }
  .turn-panel[data-screen="picker"] .stat-chips > span {
    display: flex;
    align-items: center;
    gap: .6em;
    padding: .45em .65em;
    font-size: 13px;
    background: #f2e2be;
  }
  .turn-panel[data-screen="picker"] .stat-chips b {
    color: #2c4d38;
    font-size: 1.45em;
  }
  .turn-panel[data-screen="picker"] .turn-copy > .turn-btn {
    align-self: flex-start;
  }
}
@media(max-height:399px) {
  .roster-jump .portrait { width: min(100%,42px); }
}
@media(max-height:399px) {
  .turn-panel[data-screen="approach"] .turn-card { --image-ratio: .8fr; }
  .turn-panel[data-screen="approach"] .turn-copy { gap: 2px; }
  .turn-panel[data-screen="approach"] .skill-meter > span { line-height: 1.15; }
  .turn-panel[data-screen="approach"] .meter-list { gap: 2px; }
}
.deal-power {
  text-align: center;
  font-size: clamp(9px,1.65vmin,13px);
  line-height: 1.12;
  color: #654630;
}
