/* ============================================================
   天理の方角 見た目
   落ち着いた紺色の地に、金色の針。朝夕の参拝で目に優しい配色です。
   色を変えたいときは :root をまとめて調整してください。
   ============================================================ */

:root {
  --bg-top: #0e1a2b;
  --bg-bottom: #162a45;
  --text: #eef1f6;
  --muted: #9fb0c8;
  --gold: #e3bf6a;
  --gold-soft: rgba(227, 191, 106, .35);
  --ok: #7ad6a2;
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  background-attachment: fixed;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

.hidden { display: none !important; }

.screen {
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  padding: calc(20px + env(safe-area-inset-top)) 24px calc(28px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.title { font-size: 15px; font-weight: 500; color: var(--muted); letter-spacing: .12em; margin: 0 0 6px; }

/* 方角の大きな文字 */
.direction-name { font-size: 44px; font-weight: 700; margin: 0; letter-spacing: .06em; color: var(--gold); line-height: 1.2; }
.direction-detail { font-size: 14px; color: var(--muted); margin: 4px 0 14px; min-height: 22px; }

/* コンパス */
.compass-wrap {
  position: relative;
  width: min(78vw, 320px);
  height: min(78vw, 320px);
  margin: 8px 0 14px;
}
.dial {
  width: 100%; height: 100%;
  /* 回転はJSが transform で行います */
  will-change: transform;
}
.dial-svg { width: 100%; height: 100%; display: block; }
.ring { fill: rgba(255,255,255,.04); stroke: rgba(255,255,255,.28); stroke-width: 1.5; }
.tick { stroke: rgba(255,255,255,.35); stroke-width: 1; }
.tick.major { stroke: rgba(255,255,255,.7); stroke-width: 1.6; }
.cardinal { fill: var(--text); font-size: 15px; font-weight: 700; text-anchor: middle; dominant-baseline: middle; }
.cardinal.north { fill: #ff8a80; }
.needle { fill: var(--gold); filter: drop-shadow(0 0 4px var(--gold-soft)); }

/* 画面の「前」を示す印（スマホの上方向） */
.front-mark {
  position: absolute; top: -10px; left: 50%;
  width: 0; height: 0; transform: translateX(-50%);
  border-left: 9px solid transparent; border-right: 9px solid transparent;
  border-top: 14px solid var(--text);
  opacity: .9;
}
.center-dot {
  position: absolute; top: 50%; left: 50%;
  width: 10px; height: 10px; margin: -5px 0 0 -5px;
  border-radius: 50%; background: rgba(255,255,255,.8);
}

/* 天理の方角にぴったり向いたとき */
.compass-wrap.aligned .needle { fill: var(--ok); filter: drop-shadow(0 0 10px var(--ok)); }
.compass-wrap.aligned .ring { stroke: var(--ok); }
.compass-wrap.aligned .front-mark { border-top-color: var(--ok); }

.status { font-size: 13px; color: var(--muted); margin: 0 0 14px; min-height: 40px; }
.status.warn { color: #ffcf8a; }
.status.ok { color: var(--ok); font-weight: 700; font-size: 15px; }

/* ボタン */
.primary-btn, .secondary-btn {
  width: 100%; padding: 16px; font-size: 17px; font-weight: 700;
  border-radius: var(--radius); cursor: pointer; margin-bottom: 10px;
}
.primary-btn { color: #14233a; background: linear-gradient(135deg, #f1d99a, var(--gold)); border: none; box-shadow: 0 4px 18px var(--gold-soft); }
.secondary-btn { color: var(--text); background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.3); }
.primary-btn:active, .secondary-btn:active { transform: scale(.98); }

/* 補助 */
.help { width: 100%; margin-top: 8px; text-align: left; font-size: 13px; color: var(--muted); }
.help summary { cursor: pointer; padding: 8px 0; text-align: center; }
.help-body { background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.12); border-radius: var(--radius); padding: 12px 16px; }
.help-body p { margin: 4px 0; }
.help-small { font-size: 12px; }
.help-row { display: flex; align-items: center; justify-content: space-between; margin: 10px 0; color: var(--text); }
.stepper { display: flex; align-items: center; gap: 12px; }
.step-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.08); color: var(--text); font-size: 20px; cursor: pointer; }
.step-value { min-width: 36px; text-align: center; font-size: 18px; font-weight: 700; }
.toggle { width: 52px; height: 30px; border-radius: 15px; border: none; background: rgba(255,255,255,.18); position: relative; cursor: pointer; transition: background .2s; }
.toggle .knob { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: left .2s; }
.toggle.on { background: #4a7bd0; }
.toggle.on .knob { left: 25px; }

.foot { font-size: 11px; color: var(--muted); margin-top: auto; padding-top: 18px; }
