/* ========================================================================== */
/* Phase2M: 設定2タブ / オート1枠＋手動20枠 / セーブ一覧                    */
/* ========================================================================== */
body.game-page .config-tab-bar {
  display: flex;
  flex: 0 0 auto;
  gap: 0;
  margin: 8px 12px 0;
  overflow: hidden;
  border: 1px solid rgba(197, 140, 61, 0.34);
  border-radius: 7px;
  background: var(--menu-page, #130905);
  box-shadow: none;
}

body.game-page .config-tab-button {
  flex: 1 1 50%;
  min-width: 0;
  min-height: 40px;
  border: 0;
  border-right: 1px solid rgba(232, 178, 91, 0.12);
  border-radius: 0;
  color: #9e8f7d;
  background: linear-gradient(180deg, #1a120c 0%, #090503 100%);
  font: inherit;
  font-weight: 700;
  text-shadow: none;
  box-shadow: none;
}

body.game-page .config-tab-button:last-child {
  border-right: 0;
}

body.game-page .config-tab-button.is-active,
body.game-page .config-tab-button[aria-selected="true"] {
  color: #160c04;
  background: linear-gradient(180deg, #ffe56a 0%, #ffd217 55%, #c78e18 100%);
  font-weight: 800;
}

body.game-page .config-save-guide {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid rgba(197, 140, 61, 0.34);
  border-radius: 8px;
  color: #cfb894;
  background: linear-gradient(180deg, #25150b 0%, #150a05 100%);
  font-size: 11px;
  line-height: 1.55;
}

body.game-page .config-save-guide-title {
  color: #ffd700;
  font-size: 14px;
  font-weight: 700;
}

body.game-page .config-save-actions {
  display: grid;
  gap: 9px;
}

body.game-page .config-save-action {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  min-height: 54px;
  padding: 9px 12px;
  text-align: left;
  background:
    linear-gradient(180deg, rgba(255, 236, 185, 0.07), transparent 44%),
    linear-gradient(180deg, #59371d 0%, #261307 100%);
}

body.game-page .config-save-action-title {
  color: #f8e5bf;
  font-size: 14px;
  font-weight: 700;
}

body.game-page .config-save-action-desc {
  margin-top: 3px;
  color: #c7aa7e;
  font-size: 10px;
  font-weight: 400;
}

.save-slot-overlay {
  --save-page: #130905;
  --save-panel: #1b0f08;
  --save-panel-deep: #100703;
  --save-card-top: #382214;
  --save-card-bottom: #1d0f07;
  --save-header-top: #65401f;
  --save-header-bottom: #2b1609;
  --save-line: rgba(232, 178, 91, 0.42);
  --save-line-soft: rgba(232, 178, 91, 0.24);
  --save-text: #f5dfb8;
  --save-muted: #b99e77;
  inset: 0;
  z-index: 1000005;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding:
    calc(8px + env(safe-area-inset-top, 0px))
    calc(8px + env(safe-area-inset-right, 0px))
    calc(8px + env(safe-area-inset-bottom, 0px))
    calc(8px + env(safe-area-inset-left, 0px));
  background: rgba(0, 0, 0, 0.82);
}

.save-slot-prompt-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 16px;
  background: rgba(0, 0, 0, 0.76);
}

.save-slot-prompt {
  width: min(100%, 330px);
  overflow: hidden;
  border: 1px solid rgba(239, 190, 105, 0.74);
  border-radius: 10px;
  color: var(--save-text);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 229, 168, 0.06), transparent 38%),
    linear-gradient(180deg, #2b190d 0%, #130905 100%);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.75);
}

.save-slot-prompt-message {
  padding: 20px 18px;
  font-size: 13px;
  line-height: 1.7;
  text-align: center;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.save-slot-prompt-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  padding: 10px 14px 14px;
  border-top: 1px solid var(--save-line-soft);
  background: var(--save-page);
}

.save-slot-prompt-actions .btn {
  width: min(44%, 130px);
  min-height: 42px;
}

.save-slot-overlay.is-title {
  position: fixed;
}

.save-slot-overlay.is-game {
  position: absolute;
}

.save-slot-dialog {
  display: flex;
  flex-direction: column;
  width: min(100%, 520px);
  height: min(92svh, 690px);
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(239, 190, 105, 0.74);
  border-radius: 10px;
  color: var(--save-text);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 229, 168, 0.055), transparent 36%),
    linear-gradient(180deg, #25150b 0%, var(--save-page) 42%, #0f0703 100%);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.72);
}

.save-slot-overlay.is-game .save-slot-dialog {
  width: min(100%, 420px);
  height: 100%;
}

.save-slot-header {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 11px;
  border-bottom: 1px solid var(--save-line);
  background:
    linear-gradient(180deg, rgba(255, 229, 168, 0.07), transparent 46%),
    linear-gradient(180deg, var(--save-header-top) 0%, var(--save-header-bottom) 100%);
}

.save-slot-title {
  color: #ffd700;
  font-size: 17px;
  font-weight: 700;
}

.save-slot-subtitle {
  margin-top: 2px;
  color: var(--save-muted);
  font-size: 10px;
}

.save-slot-close {
  flex: 0 0 auto;
}

.save-slot-notice {
  flex: 0 0 auto;
  padding: 8px 11px;
  border-bottom: 1px solid var(--save-line-soft);
  color: #d8c29d;
  background: #1a0e07;
  font-size: 10px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.save-slot-notice:empty {
  display: none;
}

.save-slot-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px;
  background: var(--save-page);
  -webkit-overflow-scrolling: touch;
}

.save-slot-loading {
  padding: 28px 10px;
  color: var(--save-muted);
  text-align: center;
  font-size: 12px;
}

.save-slot-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  width: 100%;
  min-height: 76px;
  margin: 0 0 7px;
  padding: 7px 8px;
  overflow: hidden;
  border: 1px solid rgba(232, 178, 91, 0.34);
  border-radius: 8px;
  color: var(--save-text);
  background:
    linear-gradient(180deg, rgba(255, 235, 185, 0.035), transparent 42%),
    linear-gradient(135deg, var(--save-card-top) 0%, var(--save-card-bottom) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 239, 188, 0.04);
  font: inherit;
  text-align: left;
}

.save-slot-card:last-child {
  margin-bottom: 0;
}

.save-slot-card:not(:disabled):hover,
.save-slot-card:not(:disabled):focus-visible {
  border-color: #e7b953;
  background:
    linear-gradient(180deg, rgba(255, 235, 185, 0.07), transparent 42%),
    linear-gradient(135deg, #49301a 0%, #251309 100%);
  outline: none;
}

.save-slot-card.is-auto {
  border-color: rgba(232, 178, 91, 0.58);
  background:
    linear-gradient(180deg, rgba(255, 231, 170, 0.055), transparent 42%),
    linear-gradient(135deg, #432a16 0%, #201006 100%);
}

.save-slot-card.is-empty {
  color: #8f785d;
  background: #160b06;
}

.save-slot-card.is-corrupt {
  border-color: #9d493c;
  color: #ffb9ac;
  background: #2a130d;
}

.save-slot-card:disabled {
  cursor: default;
  opacity: 0.76;
}

.save-slot-info {
  display: grid;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  min-width: 0;
  padding-right: 7px;
}

.save-slot-line {
  display: flex;
  align-items: center;
  min-width: 0;
  line-height: 1.2;
}

.save-slot-line-primary {
  justify-content: space-between;
  gap: 6px;
}

.save-slot-number {
  flex: 0 0 auto;
  color: #ffd700;
  font-size: 12px;
  font-weight: 700;
}

.save-slot-date {
  min-width: 0;
  overflow: hidden;
  color: #b49a76;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.save-slot-line-hero {
  overflow: hidden;
  color: #f8e8c8;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.save-slot-line-location {
  justify-content: space-between;
  gap: 7px;
  color: #bfa580;
  font-size: 9px;
}

.save-slot-area {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.save-slot-playtime {
  flex: 0 0 auto;
  min-width: 10ch;
  color: #e2cda8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  text-align: right;
  white-space: nowrap;
}

.save-slot-party-faces {
  display: grid;
  grid-template-columns: repeat(4, 38px);
  align-items: center;
  gap: 3px;
  min-width: 0;
}

.save-slot-face {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 58px;
  overflow: hidden;
  border: 1px solid rgba(232, 178, 91, 0.34);
  border-radius: 5px;
  background: #170c06;
}

.save-slot-face img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.save-slot-face.is-empty::after {
  content: '―';
  color: #6f5a43;
  font-size: 13px;
}

.save-slot-footer {
  display: flex;
  flex: 0 0 auto;
  justify-content: center;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--save-line-soft);
  background: linear-gradient(180deg, #24150b 0%, #130905 100%);
}

.save-slot-footer .btn {
  width: min(100%, 220px);
}

.save-data-dialog {
  width: min(100%, 440px);
  height: auto;
  max-height: min(100%, 620px);
}

.save-data-overlay.is-game .save-data-dialog {
  width: min(100%, 400px);
  height: auto;
}

.save-data-body {
  display: grid;
  flex: 1 1 auto;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
  background: var(--save-page);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.save-slot-overlay .btn.save-ui-button.save-data-action {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  min-height: 58px;
  padding: 10px 12px;
  text-align: left;
  border: 1px solid rgba(232, 178, 91, 0.44);
  background:
    linear-gradient(180deg, rgba(255, 236, 185, 0.07), transparent 44%),
    linear-gradient(180deg, #59371d 0%, #261307 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 239, 188, 0.08),
    0 4px 10px rgba(0, 0, 0, 0.20);
}

.save-data-action-title {
  color: #f8e5bf;
  font-size: 14px;
  font-weight: 700;
}

.save-data-action-desc {
  margin-top: 4px;
  color: #c9ad84;
  font-size: 10px;
  line-height: 1.4;
}

.save-slot-overlay .btn.save-ui-button.save-data-action:disabled {
  border-color: rgba(145, 107, 66, 0.30);
  color: #806f5b;
  background: linear-gradient(180deg, #281810 0%, #160b06 100%);
  opacity: 0.72;
}

.save-slot-overlay .btn.save-ui-button.save-data-action:disabled .save-data-action-title,
.save-slot-overlay .btn.save-ui-button.save-data-action:disabled .save-data-action-desc {
  color: #806f5b;
}

.save-data-status {
  display: none;
  flex: 0 0 auto;
  padding: 8px 12px;
  border-top: 1px solid var(--save-line-soft);
  color: #d8c29d;
  background: #1a0e07;
  font-size: 10px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.save-data-status:not(:empty) {
  display: block;
}

/* Save/load/data modal buttons own their brown RPG surface. */
.save-slot-overlay .btn.save-ui-button {
  border: 1px solid rgba(244, 199, 112, 0.62);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 236, 185, 0.08), transparent 44%),
    linear-gradient(180deg, #5f3a1c 0%, #281409 100%);
  color: #f8e5bf;
  box-shadow:
    inset 0 1px 0 rgba(255, 239, 188, 0.11),
    inset 0 -1px 0 rgba(0, 0, 0, 0.42),
    0 4px 10px rgba(0, 0, 0, 0.22);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.58);
}

.save-slot-overlay .btn.save-ui-button:not(:disabled):active,
.save-slot-overlay .btn.save-ui-button.is-pressing:not(:disabled) {
  transform: translateY(1px) scale(0.99);
  filter: brightness(1.10);
  border-color: rgba(255, 218, 145, 0.82);
  box-shadow:
    inset 0 2px 5px rgba(0, 0, 0, 0.30),
    0 2px 5px rgba(0, 0, 0, 0.20);
}

.save-slot-overlay .btn.save-ui-button:disabled {
  border-color: rgba(145, 107, 66, 0.30);
  background: linear-gradient(180deg, #281810 0%, #160b06 100%);
  color: #806f5b;
  box-shadow: inset 0 1px 0 rgba(255, 239, 188, 0.025);
  text-shadow: none;
}

@media (max-width: 390px) {
  .save-slot-overlay {
    padding-left: 4px;
    padding-right: 4px;
  }

  .save-slot-card {
    min-height: 70px;
    padding: 6px;
  }

  .save-slot-party-faces {
    grid-template-columns: repeat(4, 32px);
    gap: 2px;
  }

  .save-slot-face {
    width: 32px;
    height: 52px;
  }

  .save-slot-line-hero,
  .save-slot-number {
    font-size: 11px;
  }

  .save-slot-date,
  .save-slot-line-location {
    font-size: 8px;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .save-slot-dialog,
  .save-slot-overlay.is-game .save-slot-dialog {
    width: min(100%, 680px);
    height: 100%;
  }

  .save-slot-header {
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .save-slot-notice {
    padding-top: 5px;
    padding-bottom: 5px;
  }

  .save-slot-card {
    min-height: 64px;
  }

  .save-slot-face {
    height: 48px;
  }
}

/* Config radio state is owned here; do not rely on inline colors against .list-item !important. */
body.game-page #sub-screen-config .config-radio-row {
  border: 1px solid rgba(169, 112, 45, 0.46);
  border-radius: 6px;
  background: linear-gradient(180deg, #2b1a0f 0%, #150904 100%);
  color: #f5dfb8;
}

body.game-page #sub-screen-config .config-radio-row.is-selected {
  border-color: #ffd700;
  background: linear-gradient(180deg, #3d2b12 0%, #1c0f06 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 215, 0, 0.10);
}



.save-data-body .save-data-action-desc a {
  color: #b8d8ff;
  text-decoration: underline;
  text-underline-offset: 2px;
}
