:root{
  /* ベース */
  --bg: transparent;
  --ink: #ffffff;
  --shadow-strong: #000000;
  --shadow: #000000;
  --shadow-soft: #000000;

  /* ブランドカラー */
  --brand-red: #e60012;
  --brand-red-dark: #c0000f;
  --brand-yellow: #ffd400;

  /* 表示用 */
  --panel-gray: rgba(74, 74, 74, 0.7);
  --panel-gray-dark: rgba(53, 53, 53, 0.7);
  --stroke-strong: var(--shadow-strong);
  --stroke-soft: var(--shadow-soft);
  --news-red: #d91f2a;
  --news-red-dark: #a51219;

  /* 設定UI用 */
  --ui-bg: #0b0c0f;
  --ui-card: #14161b;
  --ui-line: var(--panel-gray);
  --ui-accent: #e83b45;
  --ui-primary: #2f7dff;

  /* フォント */
  --font-ui: "Noto Sans JP", system-ui, -apple-system, "Segoe UI",
             "Hiragino Kaku Gothic ProN", "Hiragino Sans",
             "Yu Gothic", Meiryo, sans-serif;

  --font-clock: "Noto Sans JP", system-ui, -apple-system, "Segoe UI",
                "Hiragino Kaku Gothic ProN", "Hiragino Sans",
                "Lilita One", "Yu Gothic", Meiryo, sans-serif;

  --font-clock-sub: "Kosugi Maru", system-ui, -apple-system, "Segoe UI",
                    "Hiragino Kaku Gothic ProN", "Hiragino Sans",
                    "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;
}

*{ box-sizing: border-box; }

html, body{
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: auto;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);

  /* フォント差のズレ軽減 */
  font-synthesis: none;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#hud{
  position: relative;
  width: 100%;
  height: 100%;
}

/* =========================================================
   時計
   ========================================================= */

.clock{
  position: absolute;
  left: 16px;
  top: 10px;
  display: flex;
  flex-direction: column;
  gap: 0;
  user-select: none;
}

.clock__time{
  font-family: var(--font-clock);
  font-size: 92px;
  font-weight: 800;
  line-height: 0.95;
  color: var(--ink);
  -webkit-text-stroke: 10px var(--stroke-strong);
  paint-order: stroke fill;
}

.clock__date{
  margin-top: -6px;
  font-family: var(--font-clock-sub);
  font-size: 24px;
  font-weight: 900;
  color: var(--ink);
  -webkit-text-stroke: 7px var(--stroke-strong);
  paint-order: stroke fill;
}

/* =========================================================
   地震速報
   ========================================================= */

.quake{
  position: absolute;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  display: none;
  user-select: none;
}
.quake.is-show{ display: block; }

.quake__panel{
  width: min(760px, calc(100vw - 40px));
}

.quake__top{
  background: var(--brand-red);
  padding: 10px 18px 8px;
}

.quake__title{
  text-align: center;
  font-size: 46px;
  font-weight: 900;
  color: var(--ink);
  -webkit-text-stroke: 10px var(--stroke-strong);
  paint-order: stroke fill;
  letter-spacing: 0.5px;
}

.quake__body{
  background: var(--panel-gray);
  padding: 10px 18px 16px;
}

.quake__headline{
  font-size: 44px;
  font-weight: 900;
  color: var(--brand-yellow);
  -webkit-text-stroke: 10px var(--stroke-strong);
  paint-order: stroke fill;
  margin-bottom: 6px;
}

.quake__detail{
  font-size: 48px;
  font-weight: 900;
  color: var(--ink);
  -webkit-text-stroke: 10px var(--stroke-strong);
  paint-order: stroke fill;
  line-height: 1.05;
  white-space: pre-wrap;
}

/* =========================================================
   ニュース
   ========================================================= */

.ticker{
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 86px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px 0 0;
  background: #ffffff;
  border-bottom: 10px solid var(--brand-red);
}

.ticker__label{
  width: 104px;
  height: 100%;
  background: var(--news-red);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 26px;
  letter-spacing: 0.5px;
}

.ticker__viewport{
  overflow: hidden;
  flex: 1;
  height: 100%;
  display: flex;
  align-items: center;
}

.ticker__track{
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  will-change: transform;
  animation: tickerMove linear infinite;
  /* animation-duration: 40s; */
  /* ※animation-duration は JS で設定 */
}

.ticker__content,
.ticker__spacer{
  font-size: 48px;
  font-weight: 900;
  color: #111111;
}

.ticker__spacer{
  padding: 0 30px;
}

@keyframes tickerMove{
  from{ transform: translateX(0); }
  to{ transform: translateX(-50%); }
}

/* =========================================================
   デバッグ時の表示
   ========================================================= */

.status{
  position: absolute;
  right: 10px;
  top: 10px;
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(0,0,0,.45);
  color: #fff;
  max-width: 55vw;
  display: none;
}

.test-mode{
  position: absolute;
  right: 10px;
  bottom: 100px;
  padding: 10px 14px;
  background: var(--brand-red);
  color: #fff;
  font-weight: 900;
  font-size: 60px;
  -webkit-text-stroke: 6px var(--stroke-strong);
  paint-order: stroke fill;
  display: none;
}

/* =========================================================
   Settings UI
   ========================================================= */

.settings{
  min-height: 100vh;
  position: relative;
  isolation: isolate;
  background:
    radial-gradient(1200px 800px at 18% -10%, rgba(230,0,18,.22), rgba(230,0,18,0) 62%),
    radial-gradient(900px 640px at 88% 12%, rgba(255,212,0,.08), rgba(255,212,0,0) 55%),
    linear-gradient(180deg, rgba(255,255,255,.035), rgba(0,0,0,.20) 35%, rgba(0,0,0,.40));
  background-color: var(--ui-bg);
  background-attachment: fixed;
  padding: 18px;
  color: var(--ink);
}

.settings::before{
  content:"";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.055) 0 1px, transparent 1px 84px),
    repeating-linear-gradient(90deg, rgba(255,255,255,.05) 0 1px, transparent 1px 84px),
    repeating-linear-gradient(135deg, rgba(230,0,18,.09) 0 2px, transparent 2px 26px);
  opacity: .22;
}

.settings::after{
  content:"";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    repeating-linear-gradient(180deg, rgba(255,255,255,.03) 0 1px, transparent 1px 6px),
    repeating-linear-gradient(135deg, rgba(255,212,0,.06) 0 10px, transparent 10px 22px);
  opacity: .18;
}

.settings > *{
  position: relative;
  z-index: 1;
}

.settings__header{
  max-width: 920px;
  margin: 0 auto 14px;
}

.settings__title{
  margin: 0;
  font-size: 35px;
  font-weight: 900;
}

.settings__sub{
  margin-top: 6px;
  opacity: .8;
  font-weight: 700;
}

.card{
  max-width: 920px;
  margin: 12px auto;
  background: var(--ui-card);
  border: 1px solid var(--ui-line);
  border-radius: 14px;
  overflow: hidden;
}

.card__head{
  display:flex;
  justify-content: space-between;
  align-items:center;
  padding: 16px 16px;
}

.card__title{
  font-size: 22px;
  font-weight: 900;
}

.card__body{
  padding: 14px 16px 16px;
  border-top: 1px solid var(--ui-line);
}

.row{
  display:flex;
  gap: 12px;
  align-items:center;
  flex-wrap: wrap;
}

.grid2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 720px){
  .grid2{ grid-template-columns: 1fr; }
}

.field{ display:block; }
.field__label{
  display:block;
  font-size: 15px;
  font-weight: 800;
  opacity: .9;
  margin-bottom: 6px;
}

.input{
  width: 100%;
  font-size: 18px;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
  color: var(--ink);
  outline: none;
}
textarea.input{ resize: vertical; }

select.input option{
  color: #111;
  background: #fff;
}

.chk{
  font-size: 18px;
  font-weight: 800;
  display:flex;
  gap: 8px;
  align-items:center;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 12px;
  background: rgba(255,255,255,.05);
}

.divider{
  height: 1px;
  background: var(--ui-line);
  margin: 14px 0;
}

/* Switch */
.switch{
  position: relative;
  display: inline-flex;
  align-items: center;
}
.switch input{ display:none; }
.switch__ui{
  width: 72px;
  height: 40px;
  background: rgba(255,255,255,.18);
  border-radius: 999px;
  position: relative;
  border: 1px solid rgba(255,255,255,.22);
}
.switch__ui::after{
  content:"";
  position:absolute;
  top: 4px;
  left: 4px;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: #ffffff;
  transition: transform .18s ease;
}
.switch input:checked + .switch__ui{
  background: rgba(47,125,255,.55);
}
.switch input:checked + .switch__ui::after{
  transform: translateX(32px);
}

/* Pref list */
.pref-actions{
  display:flex;
  align-items:center;
  gap: 10px;
  margin: 10px 0 12px;
}
.pref-list{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
@media (max-width: 900px){
  .pref-list{ grid-template-columns: repeat(2, 1fr); }
}
.pref-item{
  display:flex;
  gap: 10px;
  align-items:center;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.05);
  font-size: 18px;
  font-weight: 850;
}

.muted{
  opacity: .75;
  font-weight: 700;
}

.warn{
  flex: 1;
  font-weight: 800;
  color: #ffd1d4;
  background: rgba(217,31,42,.18);
  border: 1px solid rgba(217,31,42,.35);
  border-radius: 12px;
  padding: 10px 12px;
}

/* Buttons */
.actions{
  max-width: 920px;
  margin: 12px auto;
}

.btn{
  font-size: 18px;
  font-weight: 900;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.08);
  color: var(--ink);
  cursor: pointer;
}
.btn:hover{ filter: brightness(1.08); }

.btn--primary{
  background: rgba(47,125,255,.65);
  border-color: rgba(47,125,255,.9);
  width: 100%;
  padding: 16px 14px;
  font-size: 20px;
}

.btn--danger{
  background: rgba(217,31,42,.65);
  border-color: rgba(217,31,42,.9);
}

.btn--ghost{
  background: transparent;
}

.btn--wide{
  width: 100%;
  padding: 14px 14px;
}

/* Details */
.details-wrap{
  max-width: 920px;
  margin: 0 auto;
}

.toast{
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: rgba(0,0,0,.75);
  border: 1px solid rgba(255,255,255,.25);
  padding: 10px 14px;
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
  font-weight: 800;
}
.toast.is-show{ opacity: 1; }