:root {
  color-scheme: light;
  font-family: "Yu Gothic UI", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  color: #102f4d;
  background: #edf5fb;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 14% 0%, rgba(255, 255, 255, .98), transparent 34rem),
    linear-gradient(180deg, #f6fbff 0, #e6f1f9 100%);
}

button, select { font: inherit; }

.simulator-shell {
  width: min(680px, 100%);
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 16px max(36px, env(safe-area-inset-bottom));
}

.page-header { margin-bottom: 18px; }
.page-header h1 { margin: 4px 0 0; font-size: clamp(1.7rem, 5vw, 2.25rem); letter-spacing: .03em; }
.local-label { margin: 0; color: #39729c; font-size: .72rem; font-weight: 800; letter-spacing: .14em; }
.intro-copy { margin: 8px 0 6px; color: #274f70; font-size: clamp(1rem, 2.8vw, 1.15rem); font-weight: 800; line-height: 1.65; }

.selector-card, .result-card {
  border: 2px solid #85acd0;
  border-radius: 18px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 10px 28px rgba(36, 77, 112, .10);
}

.selector-card { padding: 16px; }
.result-card { min-height: 104px; margin-bottom: 18px; padding: 18px; }
.result-history { display: grid; gap: 18px; margin-bottom: 18px; }
.result-history[hidden] { display: none; }
.result-history .result-card { margin-bottom: 0; }
.history-buttons { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.history-button {
  min-height: 44px;
  border: 2px solid #91b2ce;
  border-radius: 11px;
  color: #174a73;
  background: #f7fbfe;
  font-weight: 900;
  cursor: pointer;
}
.history-button.is-active { border-color: #16669d; color: #fff; background: #16669d; }
.history-button:focus-visible { outline: 3px solid #f4b83f; outline-offset: 2px; }

.category-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.category-button {
  min-height: 46px;
  border: 2px solid #91b2ce;
  border-radius: 12px;
  color: #174a73;
  background: #f7fbfe;
  font-weight: 800;
  cursor: pointer;
}

.category-button.is-active {
  border-color: #16669d;
  color: #fff;
  background: #16669d;
}

.field { display: grid; gap: 7px; margin-top: 14px; }
.field span { font-weight: 800; }
.field select {
  width: 100%;
  min-height: 48px;
  padding: 0 42px 0 13px;
  border: 2px solid #9eb7cb;
  border-radius: 11px;
  color: #142f47;
  background: #fff;
}

.equipment-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 50px;
  gap: 8px;
}

.favorite-button {
  min-width: 50px;
  min-height: 48px;
  border: 2px solid #9eb7cb;
  border-radius: 11px;
  color: #577087;
  background: #fff;
  font-size: 1.65rem;
  line-height: 1;
  cursor: pointer;
}

.favorite-button.is-favorite {
  border-color: #d39a16;
  color: #e0a600;
  background: #fff9df;
}

.enhance-button {
  width: 100%;
  min-height: 54px;
  margin-top: 18px;
  border: 0;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(180deg, #1686d2, #0d5f9f);
  box-shadow: 0 5px 0 #084979;
  font-size: 1.15rem;
  font-weight: 900;
  cursor: pointer;
}

.enhance-button:active { transform: translateY(3px); box-shadow: 0 2px 0 #084979; }
.enhance-button:disabled { color: #d9e4ec; background: #778b9c; box-shadow: 0 5px 0 #536676; cursor: not-allowed; }
.enhance-button:disabled:active { transform: none; box-shadow: 0 5px 0 #536676; }
.enhance-button:focus-visible, .category-button:focus-visible, .favorite-button:focus-visible, select:focus-visible { outline: 3px solid #f4b83f; outline-offset: 2px; }
.back-nav { margin-top: 18px; text-align: center; }
.back-nav a { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 16px; border: 2px solid #85acd0; border-radius: 12px; color: #145d91; background: rgba(255, 255, 255, .9); font-weight: 900; text-decoration: none; }
.back-nav a:hover { background: #fff; }
.back-nav a:focus-visible { outline: 3px solid #f4b83f; outline-offset: 2px; }

.empty-result { margin: 42px 0; color: #617588; text-align: center; }
.result-caption { margin: 0 0 7px; color: #39729c; font-size: .78rem; font-weight: 900; letter-spacing: .08em; }
.result-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 12px; border-bottom: 2px solid #d6e5f0; }
.result-name { min-width: 0; margin: 0; font-size: clamp(1.35rem, 5vw, 1.8rem); overflow-wrap: anywhere; }
.result-name.source-name { padding-bottom: 12px; border-bottom: 2px solid #d6e5f0; }
.showcase-button { flex: 0 0 auto; min-height: 42px; padding: 7px 11px; border: 2px solid #b07422; border-radius: 10px; color: #70400d; background: #fff4d8; font-size: .82rem; font-weight: 900; cursor: pointer; }
.showcase-button:hover { background: #ffe9b2; }
.showcase-button:disabled { border-color: #9aae9d; color: #52695a; background: #edf5ef; cursor: default; }
.showcase-button:focus-visible { outline: 3px solid #f4b83f; outline-offset: 2px; }
.showcase-message { min-height: 1.5em; margin: 8px 0 0; color: #376047; font-size: .83rem; font-weight: 800; }
.showcase-message:empty { display: none; }
.showcase-message[data-error="true"] { color: #a02b24; }
.showcase-message a { color: #16669d; }
.source-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 14px 0 0; }
.source-detail { display: grid; grid-template-columns: minmax(4.6em, auto) minmax(0, 1fr); gap: 8px; align-items: baseline; padding: 8px 10px; border-radius: 9px; background: #f3f7fa; }
.source-detail dt { color: #60768a; font-size: .8rem; font-weight: 800; white-space: nowrap; }
.source-detail dd { min-width: 0; margin: 0; color: #183a58; font-weight: 900; overflow-wrap: anywhere; }
.enhanced-details .source-detail { background: #eef7fc; }
.option-caption { margin: 16px 0 0; color: #39729c; font-size: .82rem; font-weight: 900; letter-spacing: .06em; }
.option-list {
  display: grid;
  grid-auto-rows: 44px;
  gap: 9px;
  max-height: 256px;
  margin: 15px 0 0;
  padding: 0 6px 0 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: #4d86b2 #dce9f2;
  scrollbar-gutter: stable;
  scrollbar-width: auto;
  list-style: none;
}
.option-list::-webkit-scrollbar { width: 12px; }
.option-list::-webkit-scrollbar-track { border-radius: 8px; background: #dce9f2; }
.option-list::-webkit-scrollbar-thumb { border: 2px solid #dce9f2; border-radius: 8px; background: #4d86b2; }
.option-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: #f3f7fa; font-weight: 800; }
.option-name { min-width: 0; }
.option-item .value { white-space: nowrap; }
.tone-normal { color: #312b3d; }
.tone-deep-green { color: #1e531e; }
.tone-dark-blue { color: #004087; }
.tone-bright-blue { color: #4e60dc; }
.tone-green { color: #167324; }
.simulation-warning { margin: 8px 0 0; color: #7a4b25; font-size: .82rem; font-weight: 700; line-height: 1.6; }
.simulation-warning + .simulation-warning { margin-top: 2px; }

@media (max-width: 420px) {
  .simulator-shell { padding-inline: 10px; }
  .selector-card, .result-card { border-radius: 14px; }
  .category-tabs { gap: 5px; }
  .category-button { min-height: 43px; }
  .source-details { grid-template-columns: 1fr; }
  .option-item { gap: 7px; }
  .result-title-row { align-items: stretch; flex-direction: column; }
  .showcase-button { width: 100%; }
}

@media (prefers-reduced-motion: no-preference) {
  .result-card.has-result { animation: result-in .22s ease-out; }
  @keyframes result-in { from { opacity: .35; transform: translateY(5px); } }
}
