/* ==========================================================
   コレクター購入評議会 — 秘密評議会トイボックス UI v2
   ビンテージ・アメリカントイ売り場：クリーム地にチェリーレッド、
   ターコイズ、マスタード。チャンキーな縁取りとティントイ風の影。
   8bit審議ステージだけは筐体らしく暗いまま。
   ========================================================== */

:root {
  --bg: #f3e9d2;
  --bg-deep: #ead9b8;
  --panel: #fdf7e7;
  --panel-2: #f7efdb;
  --line: #ddcda6;
  --outline: #46392a;
  --ink: #332b1f;
  --muted: #7c6f58;
  --faint: #a4957a;
  --red: #cf5240;
  --red-deep: #a83e2f;
  --teal: #2e8f85;
  --teal-deep: #1f6b62;
  --mustard: #dda63e;
  --mustard-deep: #b7862c;
  --navy: #2d4166;
  --navy-deep: #22334f;
  --purple: #7a63b0;
  --green: #4f9d63;
  --blue: #4a6fa8;
  --orange: #e07b3f;
  --cream: #fdf7e7;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --radius: 12px;
  --radius-small: 8px;
  --shadow: 0 10px 26px rgba(90, 70, 40, 0.16);
  --shadow-soft: 0 6px 16px rgba(90, 70, 40, 0.12);
  --shadow-toy: 3px 3px 0 rgba(70, 57, 42, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 90% -160px, rgba(46, 143, 133, 0.14), transparent 60%),
    radial-gradient(760px 380px at -120px 200px, rgba(207, 82, 64, 0.1), transparent 58%),
    repeating-linear-gradient(90deg, rgba(70, 57, 42, 0.025) 0 2px, transparent 2px 56px),
    var(--bg);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

/* ---------- ヘッダー：売り場のマーキーサイン ---------- */

.app-header {
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px 20px 6px;
}

.terminal-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 2px solid var(--outline);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--navy), var(--navy-deep));
  box-shadow: var(--shadow-toy);
  padding: 6px 14px;
  color: #cdd8ec;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
}

.terminal-dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--mustard);
  box-shadow: 0 0 8px rgba(221, 166, 62, 0.9);
  animation: terminalPulse 2.4s ease-in-out infinite;
}

.terminal-code {
  flex: 1 1 auto;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.terminal-badge {
  flex: 0 0 auto;
  border: 1px solid rgba(253, 247, 231, 0.5);
  border-radius: 4px;
  padding: 1px 7px;
  color: var(--mustard);
  letter-spacing: 0.18em;
}

.app-header-main {
  padding: 14px 4px 0;
}

.app-header h1 {
  margin-bottom: 4px;
  font-size: clamp(1.3rem, 4.2vw, 1.7rem);
  letter-spacing: 0.04em;
  line-height: 1.25;
}

.header-copy {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

@keyframes terminalPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

/* ---------- レイアウト ---------- */

.page-shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px 64px;
}

.tab-panel {
  display: block;
}

/* ---------- タブ：ブリキの切り替えスイッチ ---------- */

.tab-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 6px;
  margin: 12px 0 20px;
  padding: 6px;
  border: 2px solid var(--outline);
  border-radius: 14px;
  background: rgba(253, 247, 231, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: var(--shadow-toy);
}

.tab-button {
  display: grid;
  gap: 1px;
  justify-items: center;
  align-content: center;
  flex: 1 1 0;
  min-height: 52px;
  border: 2px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  padding: 6px 8px;
}

.tab-button .tab-en {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.16em;
}

.tab-button .tab-ja {
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.tab-button:hover,
.tab-button:focus-visible {
  outline: none;
  border-color: var(--line);
  color: var(--ink);
}

.tab-button.active {
  border-color: var(--outline);
  background: linear-gradient(180deg, #de6a58, var(--red) 55%, var(--red-deep));
  color: var(--cream);
  box-shadow: inset 0 1px 0 rgba(255, 235, 220, 0.4), 2px 2px 0 rgba(70, 57, 42, 0.16);
}

.tab-button.active .tab-en {
  color: rgba(253, 247, 231, 0.75);
}

/* ---------- 受付端末（ホームのヒーロー）：ブリキ看板 ---------- */

.hero-terminal {
  overflow: hidden;
  border: 2px solid var(--outline);
  border-radius: var(--radius);
  background:
    radial-gradient(520px 260px at 85% -80px, rgba(46, 143, 133, 0.12), transparent 62%),
    var(--panel);
  box-shadow: var(--shadow-soft), var(--shadow-toy);
  color: var(--ink);
}

.terminal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 2px solid var(--outline);
  background:
    repeating-linear-gradient(-45deg, rgba(207, 82, 64, 0.85) 0 14px, rgba(253, 247, 231, 0.14) 14px 28px),
    var(--red-deep);
  padding: 8px 16px;
  color: var(--cream);
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-shadow: 0 1px 2px rgba(50, 20, 10, 0.5);
}

.terminal-head .terminal-dot {
  background: var(--cream);
  box-shadow: 0 0 8px rgba(253, 247, 231, 0.9);
}

.terminal-head-label {
  flex: 1 1 auto;
}

.terminal-head-note {
  letter-spacing: 0.1em;
}

.hero-body {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 18px;
  padding: 20px;
}

.hero-main-stat {
  display: grid;
  gap: 8px;
  align-content: start;
}

.stat-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.stat-label em {
  margin-left: 8px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.62rem;
  font-style: normal;
  letter-spacing: 0.16em;
}

.stat-value {
  color: var(--red-deep);
  font-family: var(--mono);
  font-size: clamp(2rem, 8vw, 2.9rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
  text-shadow: 1px 2px 0 rgba(70, 57, 42, 0.14);
}

.budget-gauge {
  height: 12px;
  overflow: hidden;
  border: 2px solid var(--outline);
  border-radius: 999px;
  background:
    repeating-linear-gradient(90deg, rgba(70, 57, 42, 0.06) 0 6px, transparent 6px 12px),
    #efe4c8;
}

.budget-gauge-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal-deep), var(--teal));
  box-shadow: 0 0 10px rgba(46, 143, 133, 0.6);
  transition: width 0.5s ease;
}

.budget-gauge-fill.gauge-over {
  background: linear-gradient(90deg, var(--red-deep), var(--red));
  box-shadow: 0 0 10px rgba(207, 82, 64, 0.6);
}

.hero-period {
  display: flex;
  gap: 10px;
  align-items: baseline;
  margin: 2px 0 0;
  font-size: 0.8rem;
}

.hero-period span {
  color: var(--faint);
}

.hero-period strong {
  color: var(--muted);
  font-family: var(--mono);
  font-weight: 600;
}

.hero-substats {
  display: grid;
  gap: 10px;
  align-content: start;
}

.substat {
  border: 2px solid var(--outline);
  border-radius: var(--radius-small);
  background: var(--cream);
  box-shadow: 2px 2px 0 rgba(70, 57, 42, 0.14);
  color: var(--ink);
  padding: 10px 14px;
}

.substat span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
}

.substat strong {
  display: block;
  font-family: var(--mono);
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
}

.heart-vault {
  background:
    radial-gradient(120px 60px at 90% 0%, rgba(122, 99, 176, 0.2), transparent 70%),
    var(--cream);
}

.heart-vault strong {
  color: var(--purple);
}

.heart-vault small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.55;
}

/* ---------- ステータスチップ ---------- */

.chip-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.chip-strip-label {
  flex: 0 0 auto;
  min-width: 64px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.chip-row {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 8px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--cream);
  box-shadow: 2px 2px 0 rgba(70, 57, 42, 0.08);
  padding: 5px 12px;
  font-size: 0.78rem;
}

.status-chip span {
  color: var(--muted);
}

.status-chip strong {
  color: var(--ink);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.status-chip.chip-good {
  border-color: rgba(79, 157, 99, 0.55);
}

.status-chip.chip-good strong {
  color: var(--green);
}

.status-chip.chip-warn {
  border-color: rgba(224, 123, 63, 0.6);
}

.status-chip.chip-warn strong {
  color: var(--orange);
}

/* ---------- パネル共通 ---------- */

.panel,
.items-section {
  margin-top: 18px;
}

.panel {
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-soft);
  padding: 20px;
}

.panel-eyebrow {
  margin: 0 0 2px;
  color: var(--red);
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin-bottom: 16px;
}

.section-title h2 {
  margin-bottom: 0;
  font-size: 1.15rem;
  letter-spacing: 0.03em;
}

.section-title p {
  max-width: 480px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

/* ---------- コレクター属性モニター ---------- */

.attribute-meter {
  display: flex;
  gap: 3px;
  height: 16px;
  margin-bottom: 14px;
  overflow: hidden;
  border: 2px solid var(--outline);
  border-radius: 999px;
  background:
    repeating-linear-gradient(90deg, rgba(70, 57, 42, 0.06) 0 8px, transparent 8px 16px),
    #efe4c8;
  padding: 3px;
}

.meter-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px;
  transition: width 0.6s ease;
}

.meter-light {
  background: linear-gradient(90deg, var(--teal-deep), var(--teal));
}

.meter-dark {
  margin-left: auto;
  background: linear-gradient(90deg, var(--purple), #5d4894);
}

.collector-balance-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.collector-balance-grid div,
.collector-balance-title {
  border: 2px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--cream);
  padding: 12px 14px;
}

.collector-balance-grid span,
.collector-balance-title span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
}

.collector-balance-grid strong,
.collector-balance-title strong {
  display: block;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.collector-balance-grid .attr-light {
  border-color: rgba(46, 143, 133, 0.5);
}

.collector-balance-grid .attr-light strong {
  color: var(--teal-deep);
}

.collector-balance-grid .attr-dark {
  border-color: rgba(122, 99, 176, 0.5);
}

.collector-balance-grid .attr-dark strong {
  color: var(--purple);
}

.collector-balance-title {
  margin-top: 10px;
  border: 2px solid var(--outline);
  background:
    radial-gradient(200px 60px at 12% 0%, rgba(221, 166, 62, 0.28), transparent 70%),
    var(--cream);
  box-shadow: var(--shadow-toy);
}

.collector-balance-title strong {
  color: var(--red-deep);
  font-family: inherit;
}

.collector-balance-description {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.8;
}

/* ダークサイド優勢時：収蔵庫の照明が落ちる */

.collector-balance-panel.dark-dominant {
  border-color: #4a3f68;
  background: linear-gradient(180deg, #322b49, #272138);
  color: #ece7f7;
}

.collector-balance-panel.dark-dominant .panel-eyebrow {
  color: #b7a4ea;
}

.collector-balance-panel.dark-dominant .section-title p,
.collector-balance-panel.dark-dominant .collector-balance-description {
  color: #aaa0c8;
}

.collector-balance-panel.dark-dominant .attribute-meter {
  border-color: #4a3f68;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 8px, transparent 8px 16px),
    #1d1930;
}

.collector-balance-panel.dark-dominant .collector-balance-grid div,
.collector-balance-panel.dark-dominant .collector-balance-title {
  border-color: #4a3f68;
  background: rgba(22, 18, 36, 0.55);
}

.collector-balance-panel.dark-dominant .collector-balance-grid span,
.collector-balance-panel.dark-dominant .collector-balance-title span {
  color: #8f86ad;
}

.collector-balance-panel.dark-dominant .collector-balance-grid strong {
  color: #ece7f7;
}

.collector-balance-panel.dark-dominant .collector-balance-grid .attr-light strong {
  color: var(--teal);
}

.collector-balance-panel.dark-dominant .collector-balance-grid .attr-dark strong {
  color: #b7a4ea;
}

.collector-balance-panel.dark-dominant .collector-balance-title {
  border-color: #6d5aa8;
  background:
    radial-gradient(200px 60px at 12% 0%, rgba(122, 99, 176, 0.4), transparent 70%),
    rgba(22, 18, 36, 0.55);
  box-shadow: 2px 2px 0 rgba(12, 9, 20, 0.6);
}

.collector-balance-panel.dark-dominant .collector-balance-title strong {
  color: #e3c86e;
}

/* ---------- 審議ログ ---------- */

.recent-history-list {
  display: grid;
  gap: 8px;
}

.recent-history-item {
  display: grid;
  gap: 2px;
  border: 2px solid var(--line);
  border-left: 5px solid var(--mustard);
  border-radius: var(--radius-small);
  background: var(--cream);
  padding: 10px 14px;
}

.recent-history-item span,
.recent-history-item small {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
}

.recent-history-item strong {
  font-size: 0.88rem;
  font-weight: 700;
}

/* ---------- 絞り込みスイッチ ---------- */

.sub-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.sub-filter-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--cream);
  color: var(--muted);
  padding: 8px 14px;
  font-size: 0.84rem;
  font-weight: 700;
}

.sub-filter-button strong {
  min-width: 26px;
  border-radius: 999px;
  background: #efe4c8;
  color: var(--muted);
  padding: 1px 8px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.sub-filter-button:hover,
.sub-filter-button:focus-visible {
  outline: none;
  border-color: var(--outline);
  color: var(--ink);
}

.sub-filter-button.active {
  border-color: var(--outline);
  background: linear-gradient(180deg, #3aa093, var(--teal) 55%, var(--teal-deep));
  color: var(--cream);
  box-shadow: 2px 2px 0 rgba(70, 57, 42, 0.16);
}

.sub-filter-button.active strong {
  background: var(--cream);
  color: var(--teal-deep);
}

/* ---------- 商品カード：収蔵ケース ---------- */

.items-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 14px;
}

.item-card {
  position: relative;
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.item-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  background: repeating-linear-gradient(-45deg, var(--line) 0 8px, transparent 8px 16px);
}

.item-card.card-judgment-buy::before,
.item-card.card-status-purchased::before {
  background: repeating-linear-gradient(-45deg, var(--green) 0 8px, rgba(79, 157, 99, 0.25) 8px 16px);
}

.item-card.card-judgment-hold::before {
  background: repeating-linear-gradient(-45deg, var(--blue) 0 8px, rgba(74, 111, 168, 0.25) 8px 16px);
}

.item-card.card-judgment-skip::before,
.item-card.card-status-skipped::before {
  background: repeating-linear-gradient(-45deg, var(--faint) 0 8px, rgba(164, 149, 122, 0.25) 8px 16px);
}

.item-card.card-judgment-danger::before {
  background: repeating-linear-gradient(-45deg, var(--red) 0 8px, rgba(207, 82, 64, 0.25) 8px 16px);
}

.item-card.card-status-considering::before {
  background: repeating-linear-gradient(-45deg, var(--mustard) 0 8px, rgba(221, 166, 62, 0.25) 8px 16px);
}

.item-card-summary {
  display: grid;
  gap: 10px;
  cursor: pointer;
  list-style: none;
  padding: 12px 14px 12px 20px;
  -webkit-tap-highlight-color: transparent;
}

.item-card-summary::-webkit-details-marker {
  display: none;
}

.item-card-summary:hover h3 {
  color: var(--red-deep);
}

.item-card-summary:focus-visible {
  outline: 3px solid rgba(46, 143, 133, 0.35);
  outline-offset: -3px;
  border-radius: var(--radius);
}

.item-card-headline {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 32px;
}

.item-card-heading {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

.item-card h3 {
  margin: 0 0 2px;
  font-size: 1rem;
  letter-spacing: 0.02em;
  line-height: 1.4;
}

.item-card-subline {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.item-card-quickstats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.item-card-quickstats div {
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--cream);
  padding: 6px 9px;
}

.item-card-quickstats span {
  display: block;
  color: var(--faint);
  font-size: 0.64rem;
}

.item-card-quickstats strong {
  font-family: var(--mono);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.item-card-quickstats .quickstat-wide {
  grid-column: 1 / -1;
}

.item-card-quickstats .quickstat-wide strong {
  color: var(--red-deep);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.55;
}

.item-card-caret {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  margin: -4px 2px 0;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.2s ease, margin 0.2s ease;
}

.item-card-details[open] .item-card-caret {
  margin: 4px 2px 0;
  transform: rotate(225deg);
}

.item-card-body {
  display: grid;
  gap: 12px;
  border-top: 2px dashed var(--line);
  padding: 12px 14px 16px 20px;
}

.item-card-details:not([open]) > .item-card-body {
  display: none;
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f2e8ce;
  color: var(--muted);
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.5;
}

/* ---------- 判定バッジ ---------- */

.badge {
  align-self: start;
  flex: 0 0 auto;
  white-space: nowrap;
  border: 2px solid var(--outline);
  border-radius: 7px;
  background: #efe4c8;
  box-shadow: 2px 2px 0 rgba(70, 57, 42, 0.14);
  color: var(--muted);
  padding: 5px 10px;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.judgment-buy {
  background: #dff0e0;
  color: #2c6e42;
}

.judgment-hold {
  background: #e2eaf7;
  color: #35507e;
}

.judgment-skip {
  background: #ece5d5;
  color: #6d5f47;
}

.judgment-danger {
  background: #f9ddd6;
  color: var(--red-deep);
}

.status-purchased {
  background: #dff0e0;
  color: #2c6e42;
}

.status-skipped {
  background: #ece5d5;
  color: #6d5f47;
}

.status-considering {
  background: #f7e9c8;
  color: var(--mustard-deep);
}

/* ---------- カード内の価格・スコア表示 ---------- */

.price-grid,
.score-result {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 6px;
}

.price-grid div,
.score-result div {
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--cream);
  padding: 8px 10px;
}

.price-grid span,
.score-result span {
  display: block;
  color: var(--faint);
  font-size: 0.68rem;
}

.price-grid strong,
.score-result strong {
  font-family: var(--mono);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.score-result div:nth-child(1) strong {
  color: var(--teal-deep);
}

.score-result div:nth-child(2) strong {
  color: var(--orange);
}

.score-result div:nth-child(3) strong {
  color: var(--red-deep);
  font-family: inherit;
}

/* ---------- 評議会コメント ---------- */

.comment-box {
  border: 1px solid rgba(183, 134, 44, 0.45);
  border-left: 4px solid var(--mustard);
  border-radius: var(--radius-small);
  background: #fbf1d7;
  color: var(--ink);
  padding: 12px 14px;
  font-size: 0.9rem;
  line-height: 1.75;
  white-space: pre-line;
}

.memo {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

/* ---------- 審議履歴（カード内） ---------- */

.history-box {
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--cream);
  padding: 10px 12px;
}

.history-box summary {
  cursor: pointer;
  color: var(--teal-deep);
  font-size: 0.82rem;
  font-weight: 800;
}

.history-box ul {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.history-box li {
  display: grid;
  gap: 2px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.history-box li span {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.68rem;
}

.history-box li strong {
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.6;
}

/* ---------- AI相場調査の最新結果 ---------- */

.market-research-card-summary {
  display: grid;
  gap: 10px;
  min-width: 0;
  border: 2px solid rgba(46, 143, 133, 0.42);
  border-radius: var(--radius-small);
  background: #eef7ed;
  padding: 12px;
}

.market-research-card-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.market-research-card-heading span {
  color: var(--teal-deep);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.market-research-card-heading strong {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
}

.market-research-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.market-research-card-grid div {
  min-width: 0;
  border: 1px solid rgba(46, 143, 133, 0.3);
  border-radius: 7px;
  background: rgba(255, 253, 244, 0.8);
  padding: 8px 9px;
}

.market-research-card-grid span {
  display: block;
  color: var(--faint);
  font-size: 0.66rem;
}

.market-research-card-grid strong {
  display: block;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.5;
}

.market-research-card-summary > p {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.65;
}

.market-research-diff-box {
  min-width: 0;
  border: 1px solid rgba(46, 143, 133, 0.38);
  border-radius: 8px;
  background: rgba(255, 253, 244, 0.84);
  padding: 10px;
}

.market-research-diff-box > summary {
  cursor: pointer;
  color: var(--teal-deep);
  font-size: 0.78rem;
  font-weight: 900;
}

.market-research-diff-content {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.market-research-diff-dates {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
}

.market-research-diff-dates div {
  min-width: 0;
  border: 1px solid rgba(46, 143, 133, 0.22);
  border-radius: 7px;
  background: #eef7ed;
  padding: 7px 8px;
}

.market-research-diff-dates dt {
  color: var(--faint);
  font-size: 0.65rem;
}

.market-research-diff-dates dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 800;
}

.market-research-diff-content section h4 {
  margin: 0 0 6px;
  color: var(--teal-deep);
  font-size: 0.74rem;
}

.market-research-diff-content section ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.market-research-diff-content section li {
  display: grid;
  gap: 2px;
  min-width: 0;
  border-top: 1px solid rgba(46, 143, 133, 0.18);
  padding-top: 6px;
}

.market-research-diff-content section li span {
  color: var(--faint);
  font-size: 0.66rem;
}

.market-research-diff-content section li strong {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.73rem;
  font-weight: 700;
  line-height: 1.55;
}

.market-research-diff-advice {
  border-left: 4px solid var(--mustard);
  border-radius: 6px;
  background: #fbf1d7;
  padding: 10px 11px;
}

.market-research-diff-advice strong {
  color: var(--red-deep);
  font-size: 0.72rem;
}

.market-research-diff-advice p {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: 0.78rem;
  line-height: 1.7;
}

.market-research-history-box {
  border-top: 1px dashed rgba(46, 143, 133, 0.4);
  padding-top: 8px;
}

.market-research-history-box summary {
  cursor: pointer;
  color: var(--teal-deep);
  font-size: 0.76rem;
  font-weight: 800;
}

.market-research-history-box ul {
  display: grid;
  gap: 6px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.market-research-history-box li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 8px;
  border-top: 1px solid rgba(46, 143, 133, 0.22);
  padding-top: 6px;
}

.market-research-history-box li span,
.market-research-history-box li small {
  color: var(--faint);
  font-size: 0.68rem;
}

.market-research-history-box li strong {
  font-family: var(--mono);
  font-size: 0.74rem;
}

.market-research-history-box li small {
  grid-column: 1 / -1;
  overflow-wrap: anywhere;
}

/* ---------- 相場をしらべる（AI偵察 / 登録URL / 通販検索） ---------- */

.shop-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

/* カードを閉じても、相場調査の導線は常に表示する。 */
.item-card > .shop-links {
  margin: 0 14px 14px 20px;
  padding-top: 12px;
  border-top: 2px dashed var(--line);
}

.shop-search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.pr-chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #efe4c8;
  color: var(--faint);
  padding: 1px 6px;
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.shop-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 2px solid var(--line);
  border-radius: 9px;
  background: var(--cream);
  color: var(--ink);
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 2px 0 rgba(70, 57, 42, 0.3);
}

.shop-link-button:hover,
.shop-link-button:focus-visible {
  outline: none;
  border-color: var(--outline);
}

.shop-link-button:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 rgba(70, 57, 42, 0.3);
}

.shop-amazon {
  border-color: rgba(224, 123, 63, 0.55);
  color: #a05a1d;
}

.shop-rakuten {
  border-color: rgba(191, 55, 42, 0.45);
  color: #a83e2f;
}

.shop-kakaku {
  border-color: rgba(74, 111, 168, 0.5);
  color: #3d5f96;
}

.shop-product-page {
  width: 100%;
  border-color: rgba(46, 143, 133, 0.55);
  color: var(--teal-deep);
}

/* AIで相場を偵察：この行の主役。フル幅・ターコイズ */
.shop-ai {
  width: 100%;
  min-height: 46px;
  border-color: var(--outline);
  background: linear-gradient(180deg, #3aa093, var(--teal) 55%, var(--teal-deep));
  color: var(--cream);
  font-size: 0.9rem;
  box-shadow: 0 3px 0 var(--outline), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  text-shadow: 0 1px 1px rgba(20, 60, 55, 0.35);
}

.shop-ai:hover,
.shop-ai:focus-visible {
  outline: none;
  filter: brightness(1.06);
}

.shop-ai:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--outline), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.shop-market-import {
  width: 100%;
  border-color: rgba(183, 134, 44, 0.65);
  background: #fbf1d7;
  color: #74571b;
}

.shop-market-import:hover,
.shop-market-import:focus-visible {
  border-color: var(--mustard-deep);
  background: #fff5d7;
}

/* ---------- AI偵察 確認モーダル ---------- */

.ai-research-note {
  margin-bottom: 4px;
  border: 2px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--cream);
  padding: 14px 16px;
}

.ai-research-note p {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.7;
}

.ai-research-note ul {
  margin: 0 0 10px;
  padding-left: 1.2em;
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.75;
}

.ai-research-note li {
  margin-bottom: 6px;
}

.ai-research-note-sub {
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 0.82rem;
}

.ai-research-memo-option {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 12px;
  font-size: 0.86rem;
  font-weight: 700;
}

.ai-research-memo-option input {
  width: 20px;
  height: 20px;
  margin: 0;
}

.ai-research-preview-label {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.ai-research-preview {
  width: 100%;
  min-height: 190px;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 0.76rem;
  line-height: 1.6;
  resize: vertical;
}

.ai-research-dialog .form-actions button {
  flex: 1 1 190px;
}

/* ---------- AI相場調査JSON取り込み ---------- */

.market-research-import-dialog {
  width: min(820px, 100%);
}

.market-research-import-dialog [hidden] {
  display: none !important;
}

.market-research-import-dialog .section-title strong {
  overflow-wrap: anywhere;
}

.market-research-import-label {
  margin-top: 12px;
}

.market-research-import-label small {
  line-height: 1.6;
}

.market-research-import-textarea {
  min-height: 250px;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 0.76rem;
  line-height: 1.6;
  resize: vertical;
}

.market-research-import-errors,
.market-research-import-warnings {
  margin-top: 12px;
  overflow-wrap: anywhere;
  border: 2px solid;
  border-radius: var(--radius-small);
  padding: 10px 12px;
  font-size: 0.8rem;
  line-height: 1.65;
}

.market-research-import-errors {
  border-color: rgba(207, 82, 64, 0.55);
  background: #fbeae4;
  color: var(--red-deep);
}

.market-research-import-warnings {
  border-color: rgba(183, 134, 44, 0.55);
  background: #fbf1d7;
  color: #6c511a;
}

.market-research-import-errors ul,
.market-research-import-warnings ul {
  margin: 0;
  padding-left: 1.3em;
}

.market-research-import-actions button {
  flex: 1 1 180px;
}

.market-research-preview-title {
  margin: 14px 0 8px;
  color: var(--teal-deep);
  font-size: 1rem;
}

.market-research-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.market-research-preview-grid div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--cream);
  padding: 9px 10px;
}

.market-research-preview-grid dt {
  color: var(--faint);
  font-size: 0.68rem;
}

.market-research-preview-grid dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.55;
}

.market-research-preview-section {
  min-width: 0;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: #fffdf4;
  padding: 10px 12px;
}

.market-research-preview-section h4,
.market-research-preview-section summary {
  margin: 0;
  color: var(--teal-deep);
  font-size: 0.78rem;
  font-weight: 800;
}

.market-research-preview-section p,
.market-research-preview-section ul {
  margin: 6px 0 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.7;
}

.market-research-preview-section ul {
  padding-left: 1.3em;
}

.market-research-source-preview summary {
  cursor: pointer;
}

/* ---------- AI偵察トースト ---------- */

.ai-toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 60;
  max-width: min(440px, calc(100vw - 32px));
  border: 2px solid var(--outline);
  border-radius: var(--radius);
  background: var(--cream);
  box-shadow: 0 10px 28px rgba(60, 45, 25, 0.3), var(--shadow-toy);
  padding: 12px 16px;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.6;
  text-align: center;
  transform: translateX(-50%) translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.ai-toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ---------- ボタン：トイボタン ---------- */

.form-actions,
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.primary-button,
.secondary-button,
.danger-button {
  min-height: 44px;
  border-radius: 9px;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.primary-button {
  border: 2px solid var(--outline);
  background: linear-gradient(180deg, #de6a58, var(--red) 55%, var(--red-deep));
  color: var(--cream);
  box-shadow: 0 3px 0 var(--outline), inset 0 1px 0 rgba(255, 235, 220, 0.45);
  text-shadow: 0 1px 1px rgba(90, 30, 20, 0.35);
}

.primary-button:hover,
.primary-button:focus-visible {
  outline: none;
  filter: brightness(1.06);
}

.primary-button:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--outline), inset 0 1px 0 rgba(255, 235, 220, 0.45);
}

.secondary-button {
  border: 2px solid var(--outline);
  background: var(--cream);
  color: var(--ink);
  box-shadow: 0 3px 0 rgba(70, 57, 42, 0.55);
}

.secondary-button:hover,
.secondary-button:focus-visible {
  outline: none;
  background: #fffdf4;
  color: var(--teal-deep);
}

.secondary-button:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(70, 57, 42, 0.55);
}

.secondary-button:disabled {
  transform: none;
  box-shadow: 0 3px 0 rgba(70, 57, 42, 0.25);
  border-color: var(--line);
  color: var(--faint);
  cursor: default;
}

.danger-button {
  border: 2px solid rgba(207, 82, 64, 0.7);
  background: #fbeae4;
  color: var(--red-deep);
  box-shadow: 0 3px 0 rgba(168, 62, 47, 0.4);
}

.danger-button:hover,
.danger-button:focus-visible {
  outline: none;
  background: #f9ddd6;
}

.ghost-button {
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--teal-deep);
  padding: 8px 10px;
  font-size: 0.82rem;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ghost-button:hover,
.ghost-button:focus-visible {
  outline: none;
  color: var(--red-deep);
}

.save-action-highlight {
  box-shadow: 0 0 0 4px rgba(221, 166, 62, 0.55), 0 3px 0 var(--outline);
}

/* ---------- フォーム ---------- */

.form-grid,
.score-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

label span {
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
}

label small {
  color: var(--muted);
  font-size: 0.74rem;
}

input,
select,
textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: 2px solid var(--line);
  border-radius: 9px;
  background: #fffdf4;
  color: var(--ink);
  padding: 11px 12px;
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

input[type="date"] {
  display: block;
  inline-size: 100%;
  max-inline-size: 100%;
  min-inline-size: 0;
  -webkit-appearance: none;
  appearance: none;
}

input[type="date"]::-webkit-date-and-time-value {
  min-height: 1.6em;
  text-align: left;
}

input::placeholder,
textarea::placeholder {
  color: var(--faint);
}

input:disabled {
  border-color: var(--line);
  background: #f2ead6;
  color: var(--faint);
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(46, 143, 133, 0.25);
  border-color: var(--teal);
}

.field-muted {
  opacity: 0.6;
}

.price-status-preview {
  display: grid;
  gap: 4px;
  align-content: center;
  min-height: 78px;
  border: 2px dashed var(--line);
  border-radius: 9px;
  background: #f7efdb;
  color: var(--muted);
  padding: 10px 12px;
  font-size: 0.82rem;
}

.price-status-preview span,
.price-status-preview small {
  color: var(--faint);
  font-size: 0.72rem;
}

.price-status-preview strong {
  color: var(--teal-deep);
  font-size: 0.95rem;
}

.wide-label,
.score-section,
.form-actions {
  margin-top: 16px;
}

.score-section {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.score-section h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 0.95rem;
}

.score-grid label {
  grid-template-columns: 1fr auto;
  align-items: center;
  border: 2px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--cream);
  padding: 12px;
}

.score-grid label span,
.score-grid label small,
.score-grid input {
  grid-column: 1 / -1;
}

.score-grid label small {
  line-height: 1.5;
}

.score-grid strong {
  justify-self: end;
  min-width: 34px;
  border: 2px solid var(--outline);
  border-radius: 6px;
  background: var(--mustard);
  color: #3a2c10;
  font-family: var(--mono);
  text-align: center;
}

input[type="range"] {
  height: auto;
  border: 0;
  background: transparent;
  padding: 6px 0;
  -webkit-appearance: none;
  appearance: none;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #efe4c8;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px;
  height: 26px;
  margin-top: -10px;
  border: 2px solid var(--outline);
  border-radius: 999px;
  background: radial-gradient(circle at 35% 30%, #e98a77, var(--red) 60%, var(--red-deep));
  box-shadow: 2px 2px 0 rgba(70, 57, 42, 0.2);
}

input[type="range"]:focus {
  outline: none;
}

input[type="range"]:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 5px rgba(207, 82, 64, 0.3);
}

/* ---------- 案内係（アキネーター風の対話UI） ---------- */

.usher-console {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.usher-avatar {
  position: relative;
  flex: 0 0 auto;
  width: 64px;
  height: 68px;
  filter: drop-shadow(2px 2px 0 rgba(70, 57, 42, 0.18));
}

/* 執事ネコ本体はインラインSVG（viewBox 0 0 64 68）で描画する。
   全パーツがSVG座標系で一体化しているため、表示サイズを変えても
   iPhone / PCブラウザで顔のパーツがズレない。 */
.usher-cat {
  display: block;
  width: 100%;
  height: 100%;
}

.usher-cat-eye {
  transform-box: fill-box;
  transform-origin: center;
  animation: usherBlink 4.5s ease-in-out infinite;
}

@keyframes usherBlink {
  0%,
  90%,
  100% {
    transform: scaleY(1);
  }
  94% {
    transform: scaleY(0.15);
  }
}

.usher-sparkle {
  position: absolute;
  right: -7px;
  top: -8px;
  width: 18px;
  height: 18px;
  background: var(--mustard);
  clip-path: polygon(50% 0%, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0% 50%, 38% 38%);
  animation: usherTwinkle 1.8s ease-in-out infinite;
}

@keyframes usherTwinkle {
  0%,
  100% {
    opacity: 0.4;
    transform: scale(0.85) rotate(0deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.1) rotate(18deg);
  }
}

.usher-bubble {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  border: 2px solid var(--outline);
  border-radius: 12px;
  background: #fffdf4;
  box-shadow: var(--shadow-toy);
  padding: 10px 14px;
}

.usher-bubble::before {
  content: "";
  position: absolute;
  left: -9px;
  top: 24px;
  width: 14px;
  height: 14px;
  border-left: 2px solid var(--outline);
  border-bottom: 2px solid var(--outline);
  background: #fffdf4;
  transform: rotate(45deg);
}

.usher-name {
  margin: 0 0 2px;
  color: var(--red);
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.18em;
}

#wizardQuestionText {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.7;
}

.wizard-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.wizard-progress {
  display: flex;
  align-items: center;
  gap: 6px;
}

.wizard-progress-dot {
  width: 10px;
  height: 10px;
  border: 2px solid var(--outline);
  border-radius: 999px;
  background: transparent;
}

.wizard-progress-dot.done {
  border-color: var(--teal-deep);
  background: var(--teal);
}

.wizard-progress-dot.current {
  background: var(--red);
  transform: scale(1.3);
}

.wizard-progress-label {
  margin-left: 6px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
}

fieldset.wizard-step {
  min-width: 0;
  margin: 0 0 14px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  padding: 14px 16px 16px;
}

.market-draft-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.market-draft-choice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 10px;
  min-width: 0;
  border: 2px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--cream);
  padding: 14px;
}

.market-draft-choice-ai {
  border-color: rgba(46, 143, 133, 0.55);
  background: #eef7ed;
}

.market-draft-choice-icon {
  grid-row: 1 / span 2;
  margin: 0;
  font-size: 1.45rem;
}

.market-draft-choice h3 {
  margin: 0 0 5px;
  color: var(--teal-deep);
  font-size: 0.92rem;
}

.market-draft-choice p:not(.market-draft-choice-icon),
.market-draft-choice small {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.65;
}

.market-draft-choice small {
  display: block;
  margin-top: 5px;
}

.market-draft-choice button {
  grid-column: 1 / -1;
  width: 100%;
  margin-top: 4px;
}

.market-draft-ai-panel {
  margin-top: 14px;
  min-width: 0;
  border: 2px solid rgba(46, 143, 133, 0.48);
  border-radius: var(--radius);
  background: #f2f8ee;
  padding: 14px;
}

.market-draft-ai-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.market-draft-ai-heading h3 {
  margin: 0;
  color: var(--teal-deep);
  font-size: 1rem;
}

.market-draft-ai-panel > p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.7;
}

.market-draft-pending-badge {
  flex: 0 0 auto;
  border: 1px solid var(--teal-deep);
  border-radius: 999px;
  background: #dff0e0;
  color: var(--teal-deep);
  padding: 4px 8px;
  font-size: 0.68rem;
  font-weight: 800;
}

.market-draft-textarea {
  min-height: 190px;
}

.market-draft-prompt-actions,
.market-draft-review-actions,
.market-draft-apply-actions {
  margin-top: 12px;
}

.market-draft-preview {
  margin-top: 14px;
  border-top: 2px dashed rgba(46, 143, 133, 0.42);
  padding-top: 4px;
}

.market-draft-edit-notice {
  border: 2px dashed var(--line);
  border-radius: var(--radius-small);
  background: #f7efdb;
  padding: 14px;
}

.market-draft-edit-notice strong {
  color: var(--red-deep);
  font-size: 0.86rem;
}

.market-draft-edit-notice p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.65;
}

.wizard-step-hidden {
  display: none;
}

.wizard-step-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  font-size: 0.92rem;
  font-weight: 800;
}

.wizard-step-tag {
  border: 2px solid var(--outline);
  border-radius: 6px;
  background: var(--red);
  color: var(--cream);
  padding: 0 8px;
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.7;
}

.wizard-step-tag.accel-tag {
  background: var(--teal);
}

.wizard-step-tag.brake-tag {
  background: var(--orange);
}

.wizard-final-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.wizard-nav {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
}

.wizard-nav .primary-button {
  flex: 1 1 auto;
}

.item-form-actions {
  margin-top: 4px;
}

/* ---------- 設定 ---------- */

.settings-tools {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 2px dashed var(--line);
}

.settings-block-title {
  margin: 0 0 8px;
  color: var(--red-deep);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
}

.settings-tools p,
.settings-tools small {
  color: var(--muted);
}

.settings-tools p {
  margin-bottom: 12px;
  font-size: 0.86rem;
}

.settings-tools small {
  display: block;
  margin-top: 10px;
  color: var(--faint);
  font-size: 0.76rem;
}

.backup-guide {
  margin-top: 16px;
  border: 2px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--cream);
  padding: 14px 16px;
}

.backup-guide h4 {
  margin: 0 0 8px;
  color: var(--teal-deep);
  font-size: 0.88rem;
}

.backup-guide p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.75;
}

.backup-guide ul {
  margin: 10px 0 0;
  padding-left: 1.2em;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.7;
}

.data-management-status {
  display: grid;
  gap: 4px;
  margin-top: 12px;
}

.data-management-status small {
  margin-top: 0;
  font-family: var(--mono);
  font-size: 0.72rem;
}

.danger-zone {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 2px solid rgba(207, 82, 64, 0.45);
}

.danger-zone h4 {
  margin: 0 0 8px;
  color: var(--red-deep);
  font-size: 0.88rem;
}

.danger-zone p {
  margin-bottom: 10px;
}

.danger-zone .danger-button {
  display: block;
  width: 100%;
  max-width: 320px;
}

/* ---------- サイトへの戻り線 ---------- */

.app-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px calc(28px + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 0.76rem;
}

.app-footer a {
  color: inherit;
  text-decoration-color: var(--line);
  text-underline-offset: 3px;
}

.app-footer a:hover,
.app-footer a:focus-visible {
  color: var(--teal-deep);
}

/* ---------- 追加完了パネル ---------- */

.completion-panel {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 35;
  display: grid;
  gap: 12px;
  width: min(620px, calc(100vw - 40px));
  border: 2px solid var(--outline);
  border-radius: var(--radius);
  background: var(--cream);
  box-shadow: 0 18px 48px rgba(60, 45, 25, 0.35), var(--shadow-toy);
  padding: 16px;
  transform: translateX(-50%);
}

.completion-panel p {
  margin-bottom: 0;
  font-weight: 800;
}

.completion-panel strong {
  color: var(--red-deep);
}

/* ---------- 空状態 ---------- */

.empty-state {
  margin-top: 0;
  padding: 30px 20px;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(253, 247, 231, 0.65);
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
}

/* ---------- ダイアログ共通 ---------- */

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(51, 38, 20, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

#reviewPresentationDialog {
  z-index: 40;
}

#modeDialog {
  z-index: 30;
}

#purchaseDialog {
  z-index: 20;
}

.mode-dialog {
  width: min(760px, 100%);
  max-height: min(720px, 92vh);
  overflow: auto;
  border: 2px solid var(--outline);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(40, 28, 12, 0.5);
  padding: 22px;
}

.mode-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.mode-option-button {
  min-height: 54px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--cream);
  color: var(--ink);
  padding: 12px 14px;
  text-align: left;
  font-weight: 700;
}

.mode-option-button:hover,
.mode-option-button:focus-visible {
  outline: none;
  border-color: var(--outline);
  color: var(--teal-deep);
}

.mode-option-button.selected {
  border-color: var(--outline);
  background: linear-gradient(180deg, #3aa093, var(--teal) 55%, var(--teal-deep));
  color: var(--cream);
  box-shadow: 2px 2px 0 rgba(70, 57, 42, 0.16);
}

.purchase-verdict {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.unsaved-notice {
  margin: 14px 0 0;
  border: 2px solid rgba(224, 123, 63, 0.65);
  border-radius: var(--radius-small);
  background: #fdeedd;
  color: #9c5320;
  padding: 11px 13px;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.6;
}

/* ---------- 8bit審議ステージ：アーケード筐体 ---------- */

.review-presentation-dialog {
  width: min(720px, 100%);
  max-height: min(92vh, 820px);
  overflow: auto;
  border: 2px solid var(--outline);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #3a3126, #241e15);
  box-shadow: 0 24px 70px rgba(20, 14, 6, 0.65);
  color: #f4ead2;
  padding: 18px;
}

.review-presentation-header {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
}

.review-presentation-header .eyebrow {
  color: var(--mustard);
}

.review-presentation-header h2 {
  margin-bottom: 0;
  font-size: 1.2rem;
}

.council-stage {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 3px solid var(--mustard-deep);
  border-radius: var(--radius-small);
  background: #14100a;
  isolation: isolate;
}

.council-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.14) 0 2px, transparent 2px 4px);
  mix-blend-mode: multiply;
}

.council-stage-image {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  animation: councilImageIn 0.4s ease forwards;
}

.council-image-fallback {
  position: absolute;
  inset: 12px;
  z-index: 1;
  display: grid;
  place-items: center;
  gap: 8px;
  border: 2px solid rgba(221, 166, 62, 0.7);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    #171208;
  background-size: 16px 16px;
  color: #f2dfae;
  text-align: center;
}

.council-image-fallback strong {
  font-family: var(--mono);
  font-size: 1rem;
  letter-spacing: 0.12em;
}

.council-image-fallback span {
  color: #c9b586;
  font-size: 0.86rem;
}

.council-effect-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.stage-glow,
.stage-particle,
.stage-sweat,
.stage-mode-effect {
  position: absolute;
  pointer-events: none;
}

.stage-glow {
  left: 40%;
  top: 50%;
  width: 26%;
  aspect-ratio: 1;
  border-radius: 999px;
  background: rgba(255, 224, 134, 0.18);
  filter: blur(18px);
  animation: councilGlow 1.5s ease-in-out infinite;
}

.stage-sweat {
  right: 30%;
  top: 30%;
  width: 10px;
  height: 16px;
  border-radius: 999px;
  background: rgba(139, 218, 255, 0.78);
  box-shadow: 0 0 10px rgba(139, 218, 255, 0.55);
  animation: councilSweat 0.75s steps(2, end) infinite;
}

.stage-particle {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 247, 232, 0.65);
  animation: councilParticle 1.6s ease-in-out infinite;
}

.particle-one {
  left: 22%;
  top: 24%;
}

.particle-two {
  right: 18%;
  bottom: 28%;
  animation-delay: 0.45s;
}

.stage-mode-effect {
  inset: 0;
}

.effect-normal .stage-mode-effect {
  background: radial-gradient(circle at 26% 18%, rgba(255, 184, 76, 0.18), transparent 12%);
  animation: candleFlicker 1.1s ease-in-out infinite;
}

.effect-finance .stage-mode-effect {
  background: repeating-linear-gradient(115deg, transparent 0 18px, rgba(176, 68, 68, 0.18) 18px 20px);
  animation: pressureLines 1.2s linear infinite;
}

.effect-sweet .stage-mode-effect {
  background:
    radial-gradient(circle at 28% 26%, rgba(255, 135, 181, 0.24), transparent 7%),
    radial-gradient(circle at 70% 22%, rgba(255, 235, 137, 0.2), transparent 7%);
  animation: softSparkle 1.4s ease-in-out infinite;
}

.effect-otaku .stage-mode-effect {
  background:
    linear-gradient(90deg, transparent 0 18%, rgba(73, 205, 255, 0.16) 18% 20%, transparent 20% 78%, rgba(91, 255, 166, 0.15) 78% 80%, transparent 80%);
  animation: penlightBlink 0.9s steps(2, end) infinite;
}

.effect-future .stage-mode-effect {
  background: radial-gradient(circle at 50% 46%, transparent 20%, rgba(93, 181, 255, 0.16) 28%, transparent 38%);
  animation: portalPulse 1.5s ease-in-out infinite;
}

.effect-secret .stage-mode-effect {
  background:
    linear-gradient(90deg, transparent 42%, rgba(177, 91, 255, 0.18) 48% 52%, transparent 58%),
    radial-gradient(circle at 50% 70%, rgba(177, 91, 255, 0.16), transparent 24%);
  animation: secretGlow 1.4s ease-in-out infinite;
}

.effect-knight .stage-mode-effect {
  background: linear-gradient(180deg, transparent 0 45%, rgba(129, 255, 231, 0.14) 48%, transparent 52% 100%);
  animation: hologramWaver 1.2s ease-in-out infinite;
}

.effect-absurd .stage-mode-effect {
  box-shadow: inset 0 0 90px rgba(62, 23, 23, 0.42);
  animation: pressureVignette 1.1s ease-in-out infinite;
}

.council-stage-text {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 4;
  margin: 0;
  border: 2px solid rgba(221, 166, 62, 0.75);
  border-radius: 6px;
  background: rgba(15, 11, 4, 0.85);
  color: #f2dfae;
  padding: 9px 11px;
  font-size: 0.94rem;
  font-weight: 800;
  text-align: center;
}

.review-skip-button {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4;
  min-height: 42px;
  border: 2px solid rgba(221, 166, 62, 0.65);
  border-radius: 7px;
  background: rgba(15, 11, 4, 0.72);
  color: #f2dfae;
  padding: 8px 12px;
  font-size: 0.84rem;
  font-weight: 800;
  backdrop-filter: blur(4px);
}

.review-skip-button:hover,
.review-skip-button:focus-visible {
  outline: 3px solid rgba(221, 166, 62, 0.35);
}

.review-presentation-result {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 4;
  display: grid;
  gap: 8px;
  max-height: 42%;
  overflow: auto;
  border: 2px solid rgba(221, 166, 62, 0.7);
  border-radius: var(--radius-small);
  background: rgba(15, 11, 4, 0.88);
  color: #f4ead2;
  padding: 12px;
  overflow-wrap: anywhere;
  white-space: normal;
  backdrop-filter: blur(5px);
}

.review-verdict-label {
  margin-bottom: 0;
  font-weight: 900;
}

.review-verdict-label strong {
  color: var(--mustard);
}

.review-presentation-result > strong {
  color: #c9b586;
  font-size: 0.8rem;
}

.review-presentation-result p {
  margin: 0;
  font-size: 0.9rem;
  white-space: pre-line;
}

.review-presentation-result .memo {
  color: #c9b586;
}

.review-presentation-actions {
  margin-top: 14px;
}

/* ---------- キーフレーム ---------- */

@keyframes councilImageIn {
  from {
    opacity: 0;
    filter: saturate(0.8);
  }
  to {
    opacity: 1;
    filter: saturate(1);
  }
}

@keyframes councilGlow {
  0%,
  100% {
    opacity: 0.45;
    transform: scale(0.96);
  }
  50% {
    opacity: 0.78;
    transform: scale(1.08);
  }
}

@keyframes councilSweat {
  0%,
  100% {
    opacity: 0.2;
  }
  50% {
    opacity: 1;
  }
}

@keyframes councilParticle {
  0%,
  100% {
    opacity: 0.2;
    transform: translateY(0);
  }
  50% {
    opacity: 0.8;
    transform: translateY(-8px);
  }
}

@keyframes candleFlicker {
  0%,
  100% {
    opacity: 0.4;
  }
  50% {
    opacity: 0.76;
  }
}

@keyframes pressureLines {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 28px 0;
  }
}

@keyframes softSparkle {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 0.9;
  }
}

@keyframes penlightBlink {
  0%,
  100% {
    opacity: 0.36;
  }
  50% {
    opacity: 0.78;
  }
}

@keyframes portalPulse {
  0%,
  100% {
    opacity: 0.38;
    transform: scale(0.98);
  }
  50% {
    opacity: 0.72;
    transform: scale(1.02);
  }
}

@keyframes secretGlow {
  0%,
  100% {
    opacity: 0.38;
  }
  50% {
    opacity: 0.75;
  }
}

@keyframes hologramWaver {
  0%,
  100% {
    opacity: 0.32;
    transform: translateY(-2px);
  }
  50% {
    opacity: 0.7;
    transform: translateY(2px);
  }
}

@keyframes pressureVignette {
  0%,
  100% {
    opacity: 0.62;
  }
  50% {
    opacity: 0.9;
  }
}

/* ---------- ユーティリティ ---------- */

.hidden {
  display: none !important;
}

/* ---------- レスポンシブ ---------- */

@media (max-width: 860px) {
  .section-title {
    display: grid;
    gap: 6px;
    align-items: start;
  }

  .hero-body {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .hero-substats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-substats .heart-vault {
    grid-column: 1 / -1;
  }

  .collector-balance-grid,
  .form-grid,
  .score-grid,
  .items-list {
    grid-template-columns: 1fr;
  }

  .mode-options {
    grid-template-columns: 1fr;
  }

  .chip-strip {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
}

@media (max-width: 520px) {
  .app-header,
  .page-shell,
  .app-footer {
    padding-left: 12px;
    padding-right: 12px;
  }

  .page-shell {
    padding-bottom: calc(88px + env(safe-area-inset-bottom));
  }

  .app-header {
    padding-top: max(12px, env(safe-area-inset-top));
  }

  .panel {
    padding: 14px;
  }

  .item-card-summary {
    padding: 12px 12px 12px 18px;
  }

  .item-card-body {
    padding: 12px 12px 14px 18px;
  }

  .hero-body {
    padding: 16px 14px;
  }

  .hero-substats {
    grid-template-columns: 1fr;
  }

  .tab-nav {
    margin-left: -12px;
    margin-right: -12px;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  .tab-button {
    flex: 0 0 auto;
    min-width: 84px;
  }

  .sub-filter-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sub-filter-button {
    width: 100%;
  }

  .price-grid,
  .score-result {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card-actions .primary-button,
  .card-actions .secondary-button,
  .card-actions .danger-button {
    flex: 1 1 calc(50% - 8px);
  }

  .shop-link-button {
    flex: 1 1 auto;
  }

  .item-card > .shop-links {
    margin: 0 12px 14px 18px;
  }

  .shop-search-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .shop-search-row .pr-chip {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .shop-search-row .shop-link-button {
    width: 100%;
    min-width: 0;
  }

  .shop-search-row .shop-kakaku {
    grid-column: 1 / -1;
  }

  .usher-console {
    gap: 10px;
  }

  .usher-avatar {
    width: 52px;
    height: 55px;
  }

  .wizard-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .wizard-toolbar .ghost-button {
    justify-self: start;
    text-align: left;
    padding-left: 0;
  }

  .wizard-nav {
    display: grid;
    grid-template-columns: 1fr 1.6fr;
  }

  .market-draft-choice-grid,
  .market-research-preview-grid {
    grid-template-columns: 1fr;
  }

  .market-research-diff-dates {
    grid-template-columns: 1fr;
  }

  .market-draft-ai-panel {
    padding: 12px;
  }

  .market-draft-ai-heading {
    display: grid;
  }

  .market-draft-pending-badge {
    justify-self: start;
  }

  .market-draft-prompt-actions,
  .market-draft-review-actions,
  .market-draft-apply-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .market-draft-prompt-actions button,
  .market-draft-review-actions button,
  .market-draft-apply-actions button {
    width: 100%;
  }

  .review-presentation-dialog {
    padding: 14px;
  }

  .review-presentation-result {
    left: 8px;
    right: 8px;
    bottom: 8px;
    max-height: 48%;
    padding: 10px;
  }

  .review-presentation-header h2 {
    font-size: 1.05rem;
  }

  .council-stage-text {
    font-size: 0.86rem;
  }

  .purchase-dialog {
    padding-bottom: calc(30px + env(safe-area-inset-bottom));
  }

  .purchase-dialog .form-actions {
    display: grid;
    grid-template-columns: 1fr;
    margin-bottom: max(10px, env(safe-area-inset-bottom));
  }

  .purchase-dialog .primary-button,
  .purchase-dialog .secondary-button {
    width: 100%;
  }

  .ai-research-dialog .form-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .ai-research-dialog .form-actions button {
    width: 100%;
  }

  .market-research-import-dialog {
    padding: 16px;
  }

  .market-research-import-textarea {
    min-height: 220px;
  }

  .market-research-import-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .market-research-import-actions button {
    width: 100%;
  }

  .collector-balance-grid strong,
  .collector-balance-title strong {
    font-size: 1.05rem;
  }

  .completion-panel {
    left: 10px;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    width: auto;
    padding: 14px;
    transform: none;
  }

  .completion-panel .form-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .completion-panel .primary-button,
  .completion-panel .secondary-button {
    width: 100%;
    min-height: 46px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .council-stage-image,
  .stage-glow,
  .stage-particle,
  .stage-sweat,
  .stage-mode-effect,
  .terminal-dot,
  .usher-sparkle,
  .usher-cat-eye {
    animation: none !important;
  }

  .council-stage-image {
    opacity: 1;
  }

  .budget-gauge-fill,
  .meter-fill {
    transition: none;
  }
}
