/* ==========================================================================
   デザイントークン
   夜明け前の空（濃紺黒）＋ ナトリウム街灯のアンバー。
   冷たい外気温 → 暖かい走行時体感、という温度変換を配色そのものに担わせる。
   ========================================================================== */

:root {
  --ink:        #0B1017;  /* 背景：夜明け前 */
  --ink-raised: #141C26;  /* カード面 */
  --ink-line:   #212C3A;  /* 罫線 */
  --paper:      #E8EDF2;  /* 主テキスト */
  --haze:       #7D8B9C;  /* 副テキスト */
  --frost:      #5EC8E5;  /* 冷（外気温） */
  --sodium:     #FFA93B;  /* 暖（走行時体感）＝主役 */
  --warn:       #FF7A6B;  /* NG */

  --display: "Barlow Condensed", "Zen Kaku Gothic New", sans-serif;
  --util:    "Barlow", "Zen Kaku Gothic New", sans-serif;
  --body:    "Zen Kaku Gothic New", system-ui, sans-serif;

  --gap: 20px;
  --radius: 14px;
}

/* ========================================================================== */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
}

body {
  background-image: radial-gradient(120% 60% at 50% 0%, #16202C 0%, var(--ink) 62%);
  background-attachment: fixed;
  min-height: 100dvh;
}

.shell {
  max-width: 560px;
  margin: 0 auto;
  padding: 14px var(--gap) 64px;
}

/* --- 現在地バー ----------------------------------------------------------- */

.locbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0 18px;
}

.locbar__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sodium);
  box-shadow: 0 0 0 0 rgba(255, 169, 59, .5);
  animation: pulse 2.4s ease-out infinite;
  flex: none;
}

@keyframes pulse {
  70%  { box-shadow: 0 0 0 9px rgba(255, 169, 59, 0); }
  100% { box-shadow: 0 0 0 0  rgba(255, 169, 59, 0); }
}

.locbar__name {
  font-family: var(--util);
  font-size: .88rem;
  font-weight: 500;
  color: var(--haze);
  letter-spacing: .02em;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.locbar__settings {
  flex: none;
  background: none;
  border: 1px solid var(--ink-line);
  border-radius: 999px;
  color: var(--haze);
  font-family: var(--body);
  font-size: .78rem;
  padding: 6px 13px;
  cursor: pointer;
  transition: border-color .16s, color .16s;
}

.locbar__settings:hover { border-color: var(--sodium); color: var(--paper); }

/* --- ヒーロー：温度変換 ---------------------------------------------------
   このページの「署名」。冷たい小さな数字から、暖かい巨大な数字へ落ちる。   */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 0 26px;
}

.hero__from {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--frost);
}

.hero__fromLabel {
  font-family: var(--body);
  font-size: .74rem;
  letter-spacing: .16em;
  color: var(--haze);
}

.hero__fromValue {
  font-family: var(--display);
  font-size: 2.4rem;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.hero__fromUnit {
  font-family: var(--display);
  font-size: 1.3rem;
  margin-left: -6px;
}

/* 冷から暖へ渡す縦のライン */
.hero__link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  margin: 10px 0 4px;
}

.hero__linkLine {
  width: 1px;
  height: 22px;
  background: linear-gradient(180deg, var(--frost), var(--sodium));
}

.hero__linkWord {
  font-family: var(--body);
  font-size: .72rem;
  letter-spacing: .18em;
  color: var(--haze);
}

.hero__to {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0;
  position: relative;
}

.hero__toValue {
  font-family: var(--display);
  font-size: clamp(7rem, 34vw, 11rem);
  font-weight: 700;
  line-height: .84;
  color: var(--sodium);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
  text-shadow: 0 0 62px rgba(255, 169, 59, .28);
}

.hero__toUnit {
  font-family: var(--display);
  font-size: clamp(2.2rem, 10vw, 3.4rem);
  font-weight: 500;
  color: var(--sodium);
  line-height: 1;
  margin-top: .1em;   /* 数字の頭（キャップハイト）に揃える */
  margin-left: 3px;
}

.hero__toLabel {
  flex-basis: 100%;
  text-align: center;
  margin-top: 12px;
  font-size: .8rem;
  letter-spacing: .2em;
  color: var(--haze);
}

/* --- 気象メトリクス ------------------------------------------------------- */

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  list-style: none;
  margin: 0 0 26px;
  padding: 15px 0;
  border-top: 1px solid var(--ink-line);
  border-bottom: 1px solid var(--ink-line);
}

.metrics__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.metrics__item + .metrics__item { border-left: 1px solid var(--ink-line); }

.metrics__label {
  font-size: .7rem;
  letter-spacing: .14em;
  color: var(--haze);
}

.metrics__value {
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* --- 暑さ指数の警告 -------------------------------------------------------
   段階が上がるほど彩度と主張を強める。安全側の情報なので遠慮しない。       */

.risk {
  margin: 0 0 14px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border-left: 3px solid var(--haze);
  background: rgba(125, 139, 156, .08);
}

.risk__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.risk__label {
  font-size: .92rem;
  font-weight: 700;
  letter-spacing: .04em;
}

.risk__index {
  font-family: var(--util);
  font-size: .72rem;
  color: var(--haze);
  letter-spacing: .06em;
  white-space: nowrap;
}

.risk__index b {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--paper);
}

.risk__text {
  margin: 0;
  font-size: .86rem;
  line-height: 1.75;
  color: var(--paper);
}

.risk.is-watch   { border-left-color: var(--frost);  background: rgba(94, 200, 229, .07); }
.risk.is-watch   .risk__label { color: var(--frost); }

.risk.is-caution { border-left-color: var(--sodium); background: rgba(255, 169, 59, .09); }
.risk.is-caution .risk__label { color: var(--sodium); }

.risk.is-severe  { border-left-color: var(--warn);   background: rgba(255, 122, 107, .11); }
.risk.is-severe  .risk__label { color: var(--warn); }

.risk.is-danger {
  border-left-color: var(--warn);
  border: 1px solid rgba(255, 122, 107, .5);
  border-left-width: 3px;
  background: rgba(255, 122, 107, .15);
}
.risk.is-danger .risk__label { color: var(--warn); }

/* --- カード --------------------------------------------------------------- */

.card {
  background: var(--ink-raised);
  border: 1px solid var(--ink-line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
}

.card__title {
  margin: 0 0 14px;
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .2em;
  color: var(--haze);
}

.card__headline {
  margin: 0 0 12px;
  font-size: 1.06rem;
  font-weight: 700;
  line-height: 1.55;
  color: var(--sodium);
}

.card__body {
  margin: 0;
  font-size: .93rem;
  line-height: 1.9;
  color: var(--paper);
}

.card__tip {
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px dashed var(--ink-line);
  font-size: .85rem;
  line-height: 1.7;
  color: var(--haze);
}

.card--warn .card__title { color: var(--warn); }

.nglist {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nglist li {
  position: relative;
  padding: 0 0 0 20px;
  font-size: .9rem;
  line-height: 1.75;
}

.nglist li + li { margin-top: 11px; }

.nglist li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: .72em;
  width: 7px;
  height: 1.5px;
  background: var(--warn);
}

.gearslot { min-height: 74px; display: grid; place-items: center; }

.placeholder {
  margin: 0;
  font-size: .82rem;
  color: var(--haze);
  border: 1px dashed var(--ink-line);
  border-radius: 10px;
  padding: 18px 14px;
  width: 100%;
  text-align: center;
}

/* --- 状態表示 ------------------------------------------------------------- */

.status {
  margin: 22px 0 0;
  text-align: center;
  font-size: .84rem;
  line-height: 1.7;
  color: var(--haze);
}

.retry {
  display: block;
  margin: 14px auto 0;
  background: none;
  border: 1px solid var(--sodium);
  color: var(--sodium);
  border-radius: 999px;
  padding: 10px 24px;
  font-family: var(--body);
  font-size: .86rem;
  cursor: pointer;
}

.mockflag {
  margin: 26px 0 0;
  text-align: center;
  font-family: var(--util);
  font-size: .7rem;
  letter-spacing: .18em;
  color: var(--ink-line);
}

/* --- 設定モーダル --------------------------------------------------------- */

.modal {
  border: none;
  border-radius: 18px 18px 0 0;
  background: var(--ink-raised);
  color: var(--paper);
  padding: 0;
  width: 100%;
  max-width: 520px;
  margin: auto auto 0;
}

.modal::backdrop { background: rgba(4, 8, 12, .72); }

.modal__inner { padding: 24px 20px calc(24px + env(safe-area-inset-bottom)); }

.modal__title {
  margin: 0 0 22px;
  font-size: .78rem;
  letter-spacing: .2em;
  color: var(--haze);
  font-weight: 700;
}

.opt { border: none; margin: 0 0 22px; padding: 0; }

.opt__legend {
  font-size: .8rem;
  color: var(--haze);
  margin-bottom: 10px;
  padding: 0;
}

.opt__row { display: flex; flex-wrap: wrap; gap: 8px; }

.chip { position: relative; }

.chip input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.chip span {
  display: block;
  padding: 10px 17px;
  border: 1px solid var(--ink-line);
  border-radius: 999px;
  font-size: .88rem;
  color: var(--haze);
  transition: all .16s;
}

.chip input:checked + span {
  border-color: var(--sodium);
  background: rgba(255, 169, 59, .1);
  color: var(--sodium);
}

.chip input:focus-visible + span { outline: 2px solid var(--frost); outline-offset: 2px; }

.modal__actions { display: flex; gap: 10px; margin-top: 26px; }

.btn {
  flex: 1;
  padding: 14px;
  border-radius: 11px;
  font-family: var(--body);
  font-size: .93rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
}

.btn--ghost { background: none; border-color: var(--ink-line); color: var(--haze); }
.btn--main  { background: var(--sodium); color: #14100A; font-weight: 700; }

/* --- 共通 ----------------------------------------------------------------- */

:focus-visible { outline: 2px solid var(--frost); outline-offset: 3px; }

[hidden] { display: none !important; }

.is-loading .hero__toValue { opacity: .28; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
