/* ネオン調のダークテーマ */

/* ===== 変数・ベース ===== */
:root {
  color-scheme: dark;
  font-family: "M PLUS Rounded 1c", system-ui, "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic", sans-serif;

  --bg: #08080f;
  --panel: #16142e;
  --line: #ffffff24; /* パネルの枠 */
  --line-soft: #ffffff14; /* 表の罫線など */
  --text: #eee;
  --muted: #999;
  --subtle: #aaa;
  --dim: #777;

  /* 3つのボタンの色。ボタンの下の数字・県の数値欄も同じ色にそろえる */
  --happy: #c6ff3d;
  --neutral: #c9cfe3;
  --unhappy: #8b6bff;
  --happy-fill: #b8f21a;
  --unhappy-fill: #5a3df0;
  --accent: #6d4dff; /* 「現在地から判定」ボタン */
}

body { margin: 0; background: var(--bg); color: var(--text); }
button, select { font-family: inherit; }
main, footer { max-width: 32rem; margin: 0 auto; padding: 1rem; }
footer { text-align: center; color: var(--dim); }
footer a { color: var(--muted); }
[hidden] { display: none !important; }

.hint, #geo-status { text-align: center; color: var(--muted); text-wrap: balance; }
#geo-status:empty { display: none; }

.tabs {
  display: flex; gap: 0.25rem; width: calc(100% - 2rem); max-width: 32rem; margin: 0.8rem auto 0; padding: 0.25rem;
  box-sizing: border-box; background: var(--panel); border: 1px solid var(--line); border-radius: 0.8rem;
}
.tabs a {
  flex: 1; padding: 0.6rem; text-align: center; text-decoration: none; color: #ddd;
  font-weight: bold; font-size: 1.1rem; border-radius: 0.6rem;
}
.tabs a[aria-selected="true"] { background: var(--happy); color: #111; }

/* ===== 投票タブ ===== */
.headline {
  margin: 1.6rem 0 2.2rem; text-align: center; font-size: 2.6rem; line-height: 1.2; font-weight: 900;
  color: #e4e8f6; text-shadow: 0 2px 0 #79819e, 0 0 1.2rem #dfe4f544; /* 「無」ボタンのシルバーに合わせる */
}

/* 今日押した回数（0/10回） */
.tap-counter {
  width: fit-content; margin: -1rem auto 1.6rem; padding: 0.3rem 1.2rem; font-size: 1.1rem; font-weight: bold;
  color: var(--subtle); background: var(--panel); border: 1px solid var(--line); border-radius: 2rem;
}
.tap-counter b { color: var(--happy); font-size: 1.5rem; font-weight: 900; }
.tap-counter.full b { color: var(--subtle); }

.buttons { display: flex; gap: 1rem; padding: 0 0.3rem 0.5rem; }
.vote-col { flex: 1; }
.buttons button {
  display: flex; align-items: center; justify-content: center; width: 100%; aspect-ratio: 1; padding: 0;
  border: none; border-radius: 50%; cursor: pointer; touch-action: manipulation; transition: transform 0.08s;
}
.buttons button span { font-size: clamp(2.8rem, 15vw, 4.8rem); line-height: 1; }
.buttons button:active { transform: scale(0.94); }
.buttons button:disabled { opacity: 0.35; cursor: not-allowed; }
.buttons button:disabled:active { transform: none; }
.vote-col.happy button { background: var(--happy-fill); color: #1c2b00; }
.vote-col.neutral button { background: var(--neutral); color: #2a2f45; }
.vote-col.unhappy button { background: var(--unhappy-fill); color: #fff; }

/* ボタンの下の数字（この端末で押した回数） */
.count-label { margin: 1.4rem 0 0; text-align: center; font-size: 0.65rem; letter-spacing: 0.05em; color: var(--subtle); }
.count-label b { display: block; font-size: 1.1rem; letter-spacing: 0; }
.happy .count-label b { color: var(--happy); }
.neutral .count-label b { color: var(--neutral); }
.unhappy .count-label b { color: var(--unhappy); }
.tap-status { margin: 0.2rem 0 0; text-align: center; font-size: 0.75rem; color: var(--subtle); }

/* 県の選択・現在地の判定 */
.place {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem;
  margin-top: 0.5rem; padding: 0.6rem 0.8rem; background: var(--panel); border: 1px solid var(--line);
  border-radius: 0.8rem; color: var(--text);
}
.place-label { font-weight: bold; }
.place select {
  flex: 1; min-width: 7rem; padding: 0.3rem; border-radius: 0.4rem; background: #0e0d20; color: var(--text);
  border: 1px solid var(--line);
}
#btn-locate {
  padding: 0.4rem 0.8rem; border: none; border-radius: 0.5rem; background: var(--accent); color: #fff;
  font-weight: bold; cursor: pointer;
}
@media (max-width: 600px) {
  .place { flex-direction: column; align-items: stretch; }
  .place select { flex: none; width: 100%; }
  #btn-locate { width: 100%; }
}

/* ===== 結果タブ ===== */
.period {
  width: fit-content; margin: 1.2rem auto 0.8rem; padding: 0.3rem 1rem; text-align: center; font-weight: bold;
  color: #fff; background: var(--panel); border-radius: 2rem;
}
.refresh { margin-bottom: 0.5rem; padding: 0.5rem; text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: 0.8rem; }
.refresh button {
  margin-left: 0.4rem; padding: 0.3rem 0.8rem; border: none; border-radius: 0.5rem; background: var(--happy);
  color: #111; font-weight: bold; cursor: pointer;
}

/* 地図の背景は、青〜赤のどの色とも、灰色の「票なし」とも区別できる暗い紺色 */
.map {
  position: relative; padding: 0.25rem; overflow: hidden; background: #101226;
  border: 1px solid #8b6bff66; border-radius: 1rem; box-shadow: 0 0 1.4rem #8b6bff33;
}
/* 縦長の地図でも、スライダーや数値が1画面に収まるよう高さを抑える（余白は中央寄せ） */
.map svg { display: block; width: 100%; height: auto; max-height: 62vh; }
.map svg.zoomed { cursor: grab; }
.map svg.zoomed:active { cursor: grabbing; }
.map .pref { cursor: pointer; outline: none; }
.map .pref path { vector-effect: non-scaling-stroke; } /* 拡大しても線の太さを一定に */
.map .pref .base { stroke: #fff; stroke-opacity: 0.7; stroke-width: 0.8; }
.map .pref .hatch { pointer-events: none; }
.map .pref:hover .base, .map .pref:focus-visible .base { stroke-width: 2; stroke-opacity: 1; }
.map .pref.selected { paint-order: stroke; }
.map .pref.selected .base { stroke: #00e5ff; stroke-opacity: 1; stroke-width: 3; }
.okinawa-frame { fill: none; stroke: #fff; stroke-opacity: 0.6; stroke-width: 1; }

.map-controls { position: absolute; top: 0.5rem; right: 0.5rem; display: flex; flex-direction: column; gap: 0.3rem; }
.map-controls button {
  width: 2.2rem; height: 2.2rem; font-size: 1.1rem; line-height: 1; color: #fff; background: #16142ecc;
  border: 1px solid #ffffff40; border-radius: 0.4rem; cursor: pointer; touch-action: manipulation;
}
.map-controls button:disabled { opacity: 0.4; cursor: default; }

/* 県をタップしたときの数値欄 */
.pref-info {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 6.5rem; margin: 0.8rem 0; padding: 0.6rem 0.8rem; box-sizing: border-box; text-align: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 0.8rem; color: var(--text);
}
.info-name { font-weight: bold; font-size: 1.1rem; }
.info-counts { display: flex; justify-content: center; gap: 1.6rem; }
.info-counts span { display: flex; align-items: center; gap: 0.3rem; font-size: 1.6rem; font-weight: 900; }
.info-counts i { font-style: normal; font-size: 1.3rem; }
.info-counts .happy { color: var(--happy); }
.info-counts .neutral { color: var(--neutral); }
.info-counts .unhappy { color: var(--unhappy); }
.info-sub { font-size: 0.85rem; color: var(--subtle); }

/* 凡例 */
.legend { display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem; margin: 0.6rem 0; font-size: 0.8rem; }
.legend-bar { flex: 1; min-width: 6rem; height: 0.8rem; border-radius: 0.4rem; }
.legend-chip { width: 1rem; height: 1rem; margin-left: 0.6rem; border-radius: 0.2rem; }
.legend-chip.no-data { background: #c4c8d4; }
.legend-chip.low { background: repeating-linear-gradient(45deg, #d14bf0 0 3px, #fff9 3px 5px); }

/* 時間帯のスライダー */
.slider-label { display: block; margin-top: 0.8rem; }
.slider-ends { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--muted); }
#slider { width: 100%; accent-color: var(--happy); }

/* 詳細テーブル */
details { margin-top: 1rem; padding: 0.6rem 0.8rem; background: var(--panel); border: 1px solid var(--line-soft); border-radius: 0.8rem; }
summary { cursor: pointer; font-weight: bold; color: #fff; }
table { width: 100%; margin-top: 0.5rem; border-collapse: collapse; }
th, td { padding: 0.25rem 0.5rem; text-align: right; border-bottom: 1px solid var(--line-soft); }
th:first-child, tbody th { text-align: left; font-weight: normal; }
thead th { color: #bbb; font-weight: normal; font-size: 0.85rem; }
.ratio-chip {
  display: inline-block; min-width: 3.2rem; padding: 0.1rem 0.5rem; border-radius: 1rem; text-align: center;
  font-weight: bold; color: #fff; text-shadow: 0 1px 2px #0008;
}

/* ===== 文章ページ（プライバシーポリシーなど） ===== */
.doc { max-width: 40rem; line-height: 1.8; }
.doc h1 { margin: 1rem 0 0.2rem; font-size: 1.6rem; }
.doc h2 { margin: 2rem 0 0.5rem; padding-left: 0.6rem; font-size: 1.1rem; border-left: 4px solid var(--happy); }
.doc .meta { margin-top: 0; color: var(--muted); font-size: 0.85rem; }
.doc a { color: var(--happy); }
.doc .back { text-decoration: none; }
.doc ul { padding-left: 1.2rem; }
.doc table { margin: 0.8rem 0; font-size: 0.9rem; }
.doc th, .doc td { padding: 0.5rem; text-align: left; vertical-align: top; }
.doc thead th { color: #bbb; }
