/* ==========================================================
   富良野コンパス  スタイル
   iOSのコンパスアプリの形だけ借りて、あえて白背景（クソアプリ感）
   黒い細い線・赤のアクセント
   ========================================================== */

:root {
  --bg: #fff;
  --fg: #000;
  --dim: #8e8e93;     /* iOSのグレー */
  --accent: #ff3b30;  /* iOSの赤（北の三角の色）→ 富良野の印に使う */
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  /* iOSっぽいフォント。Macやスマホ以外ではそれっぽいゴシックに落ちる */
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  /* スマホでの長押し選択・ダブルタップ拡大を防ぐ */
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overflow: hidden;
}

/* 画面（スタート／コンパス）共通：縦中央寄せ */
.screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: env(safe-area-inset-top) 24px env(safe-area-inset-bottom);
  text-align: center;
}

/* hidden属性を display:flex で上書きしないように */
.screen[hidden] {
  display: none;
}

/* ---------- スタート画面 ---------- */

/* 富良野要素のワンポイント（ラーメンのイラスト） */
.ramen {
  width: 140px;
  height: auto;
  margin-bottom: -12px; /* タイトルに少し寄せる */
}

.title {
  font-size: 40px;
  font-weight: 300;
  letter-spacing: 0.08em;
}

.subtitle {
  color: var(--dim);
  font-size: 15px;
}

.start-button {
  margin-top: 24px;
  width: 200px;
  height: 56px;
  border: none;
  border-radius: 28px;
  background: var(--fg);
  color: var(--bg);
  font-size: 18px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.start-button:active {
  opacity: 0.6;
}

.note {
  color: var(--dim);
  font-size: 12px;
}

/* PCで開いたときだけ出る「スマホで開いてね」＋QRコード */
.pc-notice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px 24px 20px;
  border: 2px dashed var(--accent);
  border-radius: 16px;
}

/* hidden属性を display:flex で上書きしないように */
.pc-notice[hidden] {
  display: none;
}

.pc-notice-text {
  color: var(--accent);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
}

.qr {
  width: 160px;
  height: 160px;
  image-rendering: pixelated; /* QRコードのドットをぼかさない */
}

/* QRコードが増えたぶん、背の低いPCの画面でも下まで見られるようにスクロール可にする */
#start-screen {
  height: 100dvh;
  overflow-y: auto;
  justify-content: safe center;
}

/* ---------- コンパス画面 ---------- */

/* 上の大きい文字（「富良野」or「富良野じゃない」） */
.readout {
  position: relative; /* 集中線より手前に出す */
  z-index: 1;
  min-height: 1.4em;
  font-size: 44px;
  font-weight: 200;
  letter-spacing: 0.04em;
  transition: color 0.2s, transform 0.15s;
  /* 集中線が文字に重なっても読めるように、白いフチをつける */
  text-shadow: 0 0 4px var(--bg), 0 0 8px var(--bg), 0 0 12px var(--bg);
}

/* 富良野を向いているとき：太く、ちょっと大きく */
.readout.is-furano {
  font-weight: 700;
  transform: scale(1.15);
}

/* ---------- 集中線 ---------- */

/* 画面いっぱいに固定。ふだんは透明で、富良野を向いたときだけ出す */
.focus-lines {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}

.focus-lines.is-on {
  opacity: 1;
}

.focus-lines path {
  fill: var(--fg);
}

/* 文字盤の外枠。画面幅に合わせて正方形 */
.dial-wrap {
  position: relative;
  z-index: 1; /* 集中線より手前 */
  /* 目盛りの外側に文字を書くぶん、少し大きめにとる */
  width: min(94vw, 460px);
  aspect-ratio: 1 / 1;
}

.dial {
  width: 100%;
  height: 100%;
  /* 回転は main.js から transform で入れる */
  will-change: transform;
}

/* 上に固定の黒い三角（＝今向いている方向）。下向きの▼
   外側の文字（「こっちが富良野」など）とぶつからないよう、文字盤の枠の少し上に置く */
.pointer {
  position: absolute;
  top: -5%;
  left: 50%;
  width: 5%;
  height: 4.5%;
  transform: translateX(-50%);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  background: var(--fg);
  transition: background 0.2s;
}

/* 富良野を向いたら赤くなる */
.pointer.is-furano {
  background: var(--accent);
}

/* 真ん中の十字（iOSのコンパスの水準器っぽいやつを簡略化） */
.crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18%;
  height: 18%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.crosshair::before,
.crosshair::after {
  content: "";
  position: absolute;
  background: var(--dim);
}

/* 横棒 */
.crosshair::before {
  top: 50%;
  left: 0;
  width: 100%;
  height: 1px;
}

/* 縦棒 */
.crosshair::after {
  left: 50%;
  top: 0;
  width: 1px;
  height: 100%;
}

/* ---------- SVGの中身（main.jsで生成） ---------- */

.tick {
  stroke: var(--dim);
  stroke-width: 1;
}

.tick.major {
  stroke: var(--fg);
  stroke-width: 2;
}

/* 富良野の印（赤い三角） */
.furano-mark {
  fill: var(--accent);
}

.furano-label,
.not-furano-label {
  font-size: 16px;
  font-weight: 600;
  text-anchor: middle;
  dominant-baseline: middle;
}

/* 北（＝富良野）の文字は赤 */
.furano-label {
  fill: var(--accent);
}

/* 東・南・西の「富良野じゃない」はグレーで控えめに */
.not-furano-label {
  fill: var(--dim);
  font-size: 14px;
}

/* 位置情報が取れるまでは富良野の印を隠す */
.furano-group[hidden] {
  display: none;
}

/* エラーメッセージ */
.message {
  position: relative; /* 集中線より手前 */
  z-index: 1;
  color: var(--dim);
  font-size: 14px;
  line-height: 1.6;
}
