/* ===== UV指数メモ : グレー × 警告黄 / ミニマル道具箱 ===== */
:root {
  /* グレー基調 */
  --ink: #2b2d31;
  --ink-soft: #5b5e66;
  --ink-faint: #8b8f98;
  --line: #e2e4e8;
  --line-strong: #cfd2d8;
  --panel: #ffffff;
  --panel-2: #f6f7f9;
  --bench: #eef0f3;

  /* 警告黄アクセント */
  --warn: #f4b400;
  --warn-deep: #d99400;
  --warn-soft: #fff6d9;

  /* UV レベル色（uv-scale-strip.png に合わせる） */
  --uv-low: #5cb85c;
  --uv-moderate: #f4c12e;
  --uv-high: #f08a23;
  --uv-very-high: #e8463f;
  --uv-extreme: #9b59c4;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(33, 36, 42, .06), 0 6px 18px rgba(33, 36, 42, .07);
  --shadow-soft: 0 1px 2px rgba(33, 36, 42, .05);
  --font-base: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic UI", "Meiryo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-num: "SF Mono", "Segoe UI", "Roboto Mono", "Consolas", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-base);
  color: var(--ink);
  line-height: 1.6;
  background-color: var(--bench);
  -webkit-font-smoothing: antialiased;
}

/* 固定の背景レイヤー。background.png を上品に重ね、読み込めなくても grad で破綻しない */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-color: var(--bench);
  background-image:
    radial-gradient(1100px 360px at 88% -8%, rgba(244, 180, 0, .16), transparent 60%),
    radial-gradient(700px 300px at -6% 4%, rgba(244, 180, 0, .10), transparent 60%),
    linear-gradient(180deg, rgba(238, 240, 243, .80), rgba(238, 240, 243, .94)),
    url("assets/background.png");
  background-size: auto, auto, cover, cover;
  background-position: center, center, top center, top center;
  background-repeat: no-repeat;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: #fff;
  padding: 8px 14px;
  border-radius: 0 0 8px 0;
  z-index: 60;
}
.skip-link:focus { left: 0; }

/* ===================== 固定 UV バー ===================== */
.uv-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}
.uv-bar__inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 12px 18px 14px;
}
.uv-bar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand__icon {
  border-radius: 9px;
  box-shadow: var(--shadow-soft);
  flex: none;
}
.brand__title {
  margin: 0;
  font-size: 1.18rem;
  letter-spacing: .02em;
}
.brand__tag {
  margin: 0;
  font-size: .76rem;
  color: var(--ink-faint);
}
.date-input {
  font: inherit;
  font-family: var(--font-num);
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--ink);
}

.uv-bar__strip { margin-top: 12px; }

.slots {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}
.slot {
  position: relative;
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: var(--radius-sm);
  padding: 7px 4px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.slot:hover { transform: translateY(-1px); }
.slot.is-active {
  border-color: var(--warn-deep);
  box-shadow: 0 0 0 2px var(--warn-soft), var(--shadow-soft);
  background: #fff;
}
.slot.is-now::after {
  content: "今";
  position: absolute;
  top: -8px;
  right: -6px;
  font-size: .6rem;
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
  padding: 2px 6px;
}
.slot__name {
  font-size: .72rem;
  color: var(--ink-soft);
  white-space: nowrap;
}
.slot__gauge {
  width: 100%;
  height: 34px;
  border-radius: 6px;
  background: linear-gradient(180deg, #fff, #eef0f3);
  border: 1px solid var(--line);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}
.slot__fill {
  width: 100%;
  background: var(--line-strong);
  transition: height .2s ease, background .2s ease;
}
.slot__val {
  font-family: var(--font-num);
  font-size: .82rem;
  font-weight: 700;
  color: var(--ink);
}
.slot.is-active .slot__name { color: var(--warn-deep); font-weight: 700; }

/* UV レベルの色 */
[data-level="low"]        .slot__fill, .slot__fill[data-level="low"]        { background: var(--uv-low); }
[data-level="moderate"]   .slot__fill, .slot__fill[data-level="moderate"]   { background: var(--uv-moderate); }
[data-level="high"]       .slot__fill, .slot__fill[data-level="high"]       { background: var(--uv-high); }
[data-level="very-high"]  .slot__fill, .slot__fill[data-level="very-high"]  { background: var(--uv-very-high); }
[data-level="extreme"]    .slot__fill, .slot__fill[data-level="extreme"]    { background: var(--uv-extreme); }

.uv-legend {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  margin-top: 8px;
}
.uv-legend__seg {
  font-size: .66rem;
  text-align: center;
  color: #fff;
  border-radius: 5px;
  padding: 3px 2px;
  letter-spacing: .01em;
}
.uv-legend__seg[data-level="low"]       { background: var(--uv-low); }
.uv-legend__seg[data-level="moderate"]  { background: var(--uv-moderate); color: #6b5400; }
.uv-legend__seg[data-level="high"]      { background: var(--uv-high); }
.uv-legend__seg[data-level="very-high"] { background: var(--uv-very-high); }
.uv-legend__seg[data-level="extreme"]   { background: var(--uv-extreme); }

.uv-bar__note {
  margin: 8px 0 0;
  font-size: .7rem;
  color: var(--ink-faint);
}

/* ===================== 作業台 ===================== */
.bench {
  max-width: 1040px;
  margin: 0 auto;
  padding: 20px 18px 40px;
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 16px;
  align-items: start;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 16px 18px;
}
#today-record { grid-column: 1; }
.panel--kit { grid-column: 2; }
.panel--reapply { grid-column: 1 / -1; }
.bench__actions { grid-column: 1 / -1; }
.panel--history { grid-column: 1 / -1; }
.disclaimer { grid-column: 1 / -1; }

.panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--line-strong);
}
.panel__title {
  margin: 0;
  font-size: 1.02rem;
  letter-spacing: .02em;
}
.panel__title::before {
  content: "";
  display: inline-block;
  width: 8px; height: 16px;
  margin-right: 8px;
  vertical-align: -3px;
  background: var(--warn);
  border-radius: 3px;
}
.panel__hint {
  font-size: .76rem;
  color: var(--ink-faint);
  font-family: var(--font-num);
}

/* ===== フォーム ===== */
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
}
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field--wide { grid-column: 1 / -1; }
.field label {
  font-size: .78rem;
  color: var(--ink-soft);
  font-weight: 600;
}
input[type="text"], input[type="time"], input[type="date"], select, textarea {
  font: inherit;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--ink);
  transition: border-color .12s ease, box-shadow .12s ease;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus, .slot:focus-visible, button:focus-visible {
  outline: none;
  border-color: var(--warn-deep);
  box-shadow: 0 0 0 3px var(--warn-soft);
}

.uv-input-row { display: flex; align-items: center; gap: 10px; }
.uv-input-row input[type="range"] {
  flex: 1;
  accent-color: var(--warn-deep);
}
.uv-chip {
  font-family: var(--font-num);
  font-size: .82rem;
  font-weight: 700;
  color: #fff;
  border-radius: 999px;
  padding: 4px 12px;
  white-space: nowrap;
  min-width: 92px;
  text-align: center;
}
.uv-chip[data-level="low"]       { background: var(--uv-low); }
.uv-chip[data-level="moderate"]  { background: var(--uv-moderate); color: #6b5400; }
.uv-chip[data-level="high"]      { background: var(--uv-high); }
.uv-chip[data-level="very-high"] { background: var(--uv-very-high); }
.uv-chip[data-level="extreme"]   { background: var(--uv-extreme); }

/* ===== 対策チェック ===== */
.panel--kit { position: relative; overflow: hidden; }
.kit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
.kit-item {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  cursor: pointer;
  user-select: none;
  transition: border-color .12s ease, background .12s ease, transform .1s ease;
}
.kit-item:active { transform: scale(.98); }
.kit-item.is-on {
  border-color: var(--warn-deep);
  background: var(--warn-soft);
}
.kit-item__box {
  width: 20px; height: 20px;
  border: 2px solid var(--line-strong);
  border-radius: 6px;
  display: grid;
  place-items: center;
  flex: none;
  background: #fff;
  font-size: .8rem;
  color: transparent;
}
.kit-item.is-on .kit-item__box {
  background: var(--warn);
  border-color: var(--warn-deep);
  color: #4a3a00;
}
.kit-item__emoji { font-size: 1.05rem; }
.kit-item__label { font-size: .84rem; }

.kit-figure {
  margin-top: 14px;
  text-align: center;
  opacity: .9;
}
.kit-figure img {
  max-width: 190px;
  width: 60%;
  height: auto;
  filter: drop-shadow(0 8px 14px rgba(33, 36, 42, .12));
}
.kit-figure p {
  margin: 6px 0 0;
  font-size: .74rem;
  color: var(--ink-faint);
}

/* ===== 塗り直しログ ===== */
.panel--reapply {
  position: relative;
}
.panel--reapply::after {
  /* hourly-sun-timeline.png をさりげない背景に */
  content: "";
  position: absolute;
  right: 0; bottom: 0;
  width: min(46%, 380px);
  height: 120px;
  background: url("assets/hourly-sun-timeline.png") no-repeat right bottom;
  background-size: contain;
  opacity: .10;
  pointer-events: none;
  border-bottom-right-radius: var(--radius);
}
.reapply-form { position: relative; z-index: 1; }
.reapply-form__row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}
.reapply-form__row:last-child {
  grid-template-columns: 1fr auto;
  align-items: end;
}
.reapply-form__add { white-space: nowrap; }

.reapply-list {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  z-index: 1;
}
.reapply-row {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--warn);
  background: var(--panel-2);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.reapply-row__time {
  font-family: var(--font-num);
  font-weight: 700;
  font-size: .95rem;
  flex: none;
}
.reapply-row__body { min-width: 0; flex: 1; }
.reapply-row__item { font-size: .86rem; font-weight: 600; }
.reapply-row__meta { font-size: .74rem; color: var(--ink-faint); }
.reapply-row__next {
  font-family: var(--font-num);
  font-size: .76rem;
  color: var(--warn-deep);
  background: var(--warn-soft);
  border-radius: 999px;
  padding: 2px 9px;
  flex: none;
}
.reapply-row__del {
  border: none;
  background: none;
  color: var(--ink-faint);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 6px;
  flex: none;
}
.reapply-row__del:hover { background: #fdecec; color: var(--uv-very-high); }
.reapply-empty {
  margin: 12px 0 0;
  font-size: .8rem;
  color: var(--ink-faint);
  position: relative; z-index: 1;
}

/* ===== アクション ===== */
.bench__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.btn {
  font: inherit;
  font-weight: 700;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  cursor: pointer;
  transition: transform .1s ease, filter .12s ease, background .12s ease;
}
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: var(--warn);
  color: #4a3a00;
  border-color: var(--warn-deep);
  box-shadow: var(--shadow-soft);
}
.btn--primary:hover { filter: brightness(1.04); }
.btn--ghost {
  background: #fff;
  color: var(--ink-soft);
  border-color: var(--line-strong);
}
.btn--ghost:hover { background: var(--panel-2); }
.btn--share {
  background: var(--ink);
  color: #fff;
  margin-left: auto;
}
.btn--share:hover { filter: brightness(1.12); }
.btn--danger {
  background: var(--uv-very-high);
  color: #fff;
}
.btn--danger:hover { filter: brightness(1.05); }
.btn--mini {
  padding: 6px 12px;
  font-size: .76rem;
  background: #fff;
  color: var(--ink-soft);
  border-color: var(--line-strong);
}
.btn--mini:hover { background: var(--panel-2); }

/* ===== 直近履歴 ===== */
.history-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.hist-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.hist-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.hist-card__date {
  font-family: var(--font-num);
  font-weight: 700;
  font-size: .88rem;
}
.hist-card__uv {
  font-family: var(--font-num);
  font-size: .72rem;
  font-weight: 700;
  color: #fff;
  border-radius: 999px;
  padding: 2px 9px;
}
.hist-card__uv[data-level="low"]       { background: var(--uv-low); }
.hist-card__uv[data-level="moderate"]  { background: var(--uv-moderate); color: #6b5400; }
.hist-card__uv[data-level="high"]      { background: var(--uv-high); }
.hist-card__uv[data-level="very-high"] { background: var(--uv-very-high); }
.hist-card__uv[data-level="extreme"]   { background: var(--uv-extreme); }
.hist-card__line { font-size: .78rem; color: var(--ink-soft); }
.hist-card__chips { display: flex; flex-wrap: wrap; gap: 4px; }
.hist-chip {
  font-size: .68rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 8px;
  color: var(--ink-soft);
}
.hist-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
}
.hist-card__btn {
  font: inherit;
  font-size: .72rem;
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: 7px;
  padding: 4px 9px;
  cursor: pointer;
  color: var(--ink-soft);
}
.hist-card__btn:hover { background: var(--panel); }
.hist-card__btn--del:hover { background: #fdecec; color: var(--uv-very-high); border-color: #f3b7b7; }
.history-empty {
  margin: 0;
  font-size: .82rem;
  color: var(--ink-faint);
}

.disclaimer {
  margin: 4px 0 0;
  font-size: .76rem;
  color: var(--ink-faint);
  background: var(--warn-soft);
  border: 1px solid #f1e3ad;
  border-radius: var(--radius-sm);
  padding: 11px 14px;
}
.disclaimer strong { color: var(--warn-deep); }

.site-foot {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 18px 28px;
  font-size: .74rem;
  color: var(--ink-faint);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.site-foot__dot { opacity: .5; }

/* ===================== モーダル ===================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal[hidden] { display: none; }
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(33, 36, 42, .45);
  backdrop-filter: blur(2px);
}
.modal__box {
  position: relative;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
  padding: 22px;
  max-width: 380px;
  width: 100%;
  border-top: 5px solid var(--warn);
  animation: pop .14s ease;
}
@keyframes pop {
  from { transform: scale(.95); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.modal__title { margin: 0 0 8px; font-size: 1.05rem; }
.modal__msg { margin: 0 0 18px; font-size: .9rem; color: var(--ink-soft); }
.modal__actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ===================== トースト ===================== */
.toast-wrap {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: .86rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
  animation: toast-in .2s ease;
  border-left: 4px solid var(--warn);
}
.toast--warn { border-left-color: var(--uv-high); }
.toast.is-out { animation: toast-out .25s ease forwards; }
@keyframes toast-in {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
@keyframes toast-out {
  to { transform: translateY(8px); opacity: 0; }
}

/* ===================== レスポンシブ ===================== */
@media (max-width: 820px) {
  .bench {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  #today-record, .panel--kit, .panel--reapply,
  .panel--history, .bench__actions, .disclaimer { grid-column: 1; }
  .reapply-form__row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .uv-bar__inner { padding: 10px 12px 12px; }
  .bench { padding: 16px 12px 36px; }
  .slots { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .field-grid { grid-template-columns: 1fr; }
  .kit-grid { grid-template-columns: 1fr; }
  .reapply-form__row { grid-template-columns: 1fr; }
  .reapply-form__row:last-child { grid-template-columns: 1fr; }
  .reapply-form__add { width: 100%; }
  .btn--share { margin-left: 0; width: 100%; }
  .bench__actions .btn { flex: 1 1 auto; }
  .brand__title { font-size: 1.05rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
