/* mweeper — スタイル（Cairn Design System 準拠） */
:root {
  --fs: 1; /* 文字の大きさの倍率（設定の「文字を大きく」で 2 倍） */
  --bg: #f2f2ef;
  --card: #ffffff;
  --fg: #1b1b1d;
  --sub: #a3a3a6;
  --sub2: #c6c6c8;
  --hairline: #e7e7e4;
  --pill: #4a4a4c;
  --toolbar: #3d3d3f;
  --toolbar-hi: #59595c;
  --red: #e5484d;
  --blue: #2f6bff;
  --green: #3eb370; /* 緑 */
  --tile: #dededa;
  --tile-hi: #e9e9e5;
  /* 浮いている部品（ツールバー・トースト・名前の札）。
     ライトモードは Safari の下のバー（ページからは色を変えられない）と同じグレーにそろえる */
  --float-bg: #474745;
  --float-fg: #f2f2ef;
  --float-hi: #62625f;
  --float-shadow: 0 6px 20px rgba(0,0,0,0.16);
  /* 決定ボタン。ライトモードはライトグレー */
  --primary-bg: #b9b9b4;
  --primary-fg: #1b1b1d;
  --toggle-on: #8e8e93;
  --logo-bg: #c6c6c1;
  --logo-fg: #84847f;
  --open: #f8f8f6;
  --open-line: #e3e3df;
  --sheet-r: 22px;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
}

.theme-dark {
  --bg: #161618;
  --card: #232326;
  --fg: #ececee;
  --sub: #86868a;
  --sub2: #5a5a5e;
  --hairline: #313134;
  --pill: #4a4a4c;
  --toolbar: #2c2c2e;
  --toolbar-hi: #4c4c50;
  --tile: #2b2b2e;
  --tile-hi: #343437;
  --float-bg: #2c2c2e;
  --float-fg: #ffffff;
  --float-hi: #4c4c50;
  --float-shadow: 0 8px 24px rgba(0,0,0,0.28);
  --primary-bg: #ececee;
  --primary-fg: #161618;
  --toggle-on: #ececee;
  --logo-bg: #111113;
  --logo-fg: #d8d6d0;
  --open: #1c1c1f;
  --open-line: #2a2a2d;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: var(--bg); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  /* 長押しで「ペースト・選択」などのメニューや拡大鏡を出さない */
  -webkit-touch-callout: none;
}
canvas { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input { font: inherit; color: var(--fg); }
.hidden { display: none !important; }

#app {
  height: 100dvh;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-top: calc(10px + env(safe-area-inset-top));
}

/* ---------- ブランドタグ ---------- */
.brand-tag {
  position: absolute;
  top: calc(4px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  font-size: calc(11px * var(--fs));
  color: var(--sub);
  z-index: 6;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 4px;
}
.brand-dot { width: 9px; height: 9px; border-radius: 3px; background: var(--sub2); display: inline-block; }

/* ---------- ヘッダー ---------- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px 6px;
  min-height: 56px;
  flex-shrink: 0;
  z-index: 5;
}
.title-wrap { min-width: 0; }
.page-title {
  font-size: calc(27px * var(--fs));
  font-weight: 800;
  letter-spacing: 0.2px;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-align: left;
}
.page-header { cursor: pointer; }
.page-header:active .title-wrap { opacity: 0.55; }
.stat-line { font-size: calc(12px * var(--fs)); color: var(--sub); margin-top: 1px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.stat-line b { color: var(--fg); font-weight: 700; }
/* まだ地雷の回数を数えていない間は、少し沈んだ色 */
.stat-line .muted { opacity: 0.45; }

.header-pill {
  background: var(--pill);
  border-radius: 999px;
  display: flex;
  align-items: center;
  padding: 4px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.12);
  flex-shrink: 0;
}
.pill-icon { width: 42px; height: 36px; display: grid; place-items: center; border-radius: 999px; }
.pill-icon svg { width: 19px; height: 19px; stroke: #fff; }
.pill-icon:active { opacity: 0.6; }

/* ---------- 盤面 ---------- */
.board-wrap { flex: 1; position: relative; overflow: hidden; }
#board { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
#board.grabbing { cursor: grabbing; }
.coord-chip {
  position: absolute;
  left: 20px;
  bottom: calc(96px + env(safe-area-inset-bottom));
  font-size: calc(11px * var(--fs));
  color: var(--sub);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.conn-chip {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: calc(11px * var(--fs));
  color: var(--sub);
  background: var(--card);
  padding: 4px 12px;
  border-radius: 999px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.07);
  pointer-events: none;
}

/* ついていく中（押すとやめる） */
.follow-chip {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 32px);
  white-space: nowrap;
  overflow: hidden;
  font-size: calc(12.5px * var(--fs));
  font-weight: 600;
  color: var(--fg);
  background: var(--card);
  padding: 6px 12px;
  border-radius: 999px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
}
.follow-chip .pdot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.follow-chip .x { color: var(--sub); margin-left: 4px; }
.follow-chip.hidden { display: none; }

/* ---------- ツールバー ---------- */
.toolbar {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  max-width: 524px;
  margin: 0 auto;
  background: var(--float-bg);
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  box-shadow: var(--float-shadow);
  z-index: 10;
}
.tb-btn {
  width: 58px;
  height: 48px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  position: relative;
  transition: background 0.25s ease, transform 0.12s;
}
.tb-btn:active { transform: scale(0.9); }
.tb-btn svg { width: 21px; height: 21px; stroke: var(--float-fg); opacity: 0.95; }
.tb-btn.active { background: var(--float-hi); }
.tb-btn.active svg { fill: rgba(127,127,127,0.18); }
.tb-btn .dot {
  position: absolute;
  top: 8px;
  right: 11px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

/* ---------- オーバーレイ ---------- */
.dim { position: fixed; inset: 0; background: rgba(0,0,0,0.22); z-index: 30; animation: fade-in 0.18s ease; }
.dim.clear { background: transparent; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { transform: scale(0.7); opacity: 0; } to { transform: none; opacity: 1; } }

.ctx-menu {
  position: fixed;
  z-index: 35;
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 10px 36px rgba(0,0,0,0.16);
  padding: 5px;
  min-width: 220px;
  animation: pop-in 0.18s var(--ease);
  transform-origin: top right;
}
.ctx-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  font-size: calc(14.5px * var(--fs));
  border-radius: 9px;
  text-align: left;
}
.ctx-row:active { background: var(--bg); }
.ctx-row .ic { width: 18px; height: 18px; display: grid; place-items: center; }
.ctx-row .ic svg { width: 16px; height: 16px; stroke: var(--fg); }
.ctx-row.danger { color: var(--red); }
.ctx-sep { border-top: 1px solid var(--hairline); margin: 4px 10px; }

/* ボトムシート */
.sheet {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 560px;
  background: var(--card);
  border-radius: var(--sheet-r) var(--sheet-r) 0 0;
  z-index: 34;
  padding: 16px 20px calc(24px + env(safe-area-inset-bottom));
  animation: sheet-up 0.3s var(--ease);
  max-height: 86dvh;
  overflow-y: auto;
  -webkit-user-select: text;
  user-select: text;
}
@keyframes sheet-up { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }
.sheet-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg);
  display: grid;
  place-items: center;
  transition: transform 0.12s;
  z-index: 1;
}
.sheet-close:active { transform: scale(0.9); }
.sheet-close svg { width: 16px; height: 16px; stroke: var(--fg); }
.theme-dark .sheet-close { background: #1c1c1f; }
.sheet-body { padding-top: 6px; }
.sheet h2 { font-size: calc(17px * var(--fs)); font-weight: 700; text-align: center; margin-bottom: 14px; }
/* タイトルのないメニューは、閉じるボタンの下から始める */
.sheet[data-kind="menu"] .sheet-body { padding-top: 40px; }
.sheet .hint { font-size: calc(12.5px * var(--fs)); color: var(--sub); line-height: 1.7; text-align: center; margin-top: 12px; }
.sheet .sec { font-size: calc(13px * var(--fs)); font-weight: 700; color: var(--sub); padding: 14px 2px 6px; }
.sheet .empty { color: var(--sub); text-align: center; padding: 26px 0; font-size: calc(14px * var(--fs)); }

/* ランキング行 */
.rank-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 2px;
  font-size: calc(16.5px * var(--fs));
}
.rank-row + .rank-row { border-top: 1px solid var(--hairline); }
.rank-row .rank { width: 26px; color: var(--sub); font-size: calc(13px * var(--fs)); font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
/* テーマカラーそのままの色で出す（オフラインでも薄くしない。オンラインは緑の点でわかる）。白に近い色も見えるよう細い縁 */
.avatar { width: 21px; height: 21px; border-radius: 50%; flex-shrink: 0; position: relative; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08); }
.theme-dark .avatar { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1); }
.avatar .on { position: absolute; right: -2px; bottom: -2px; width: 8px; height: 8px; border-radius: 50%; background: var(--green); border: 2px solid var(--card); }
.rank-row .body { flex: 1; min-width: 0; }
.rank-row .name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row.me .name { font-weight: 800; }
.rank-row .meta { font-size: calc(12px * var(--fs)); color: var(--sub); margin-top: 2px; }
.rank-row .pts { font-weight: 700; font-variant-numeric: tabular-nums; }
.rank-row .pts small { font-size: calc(11px * var(--fs)); color: var(--sub); font-weight: 500; margin-left: 2px; }
.rank-row .go {
  background: var(--primary-bg);
  color: var(--primary-fg);
  border-radius: 999px;
  font-size: calc(12.5px * var(--fs));
  font-weight: 700;
  padding: 7px 13px;
  transition: transform 0.12s;
}
.rank-row .go:active { transform: scale(0.92); }
.rank-row .gos { display: flex; gap: 6px; flex-shrink: 0; }
.rank-row .go.alt { background: transparent; color: var(--fg); box-shadow: inset 0 0 0 1px var(--hairline); }

/* 設定カード */
.set-card { background: var(--bg); border-radius: 18px; overflow: hidden; margin-bottom: 12px; }
.theme-dark .set-card { background: #1c1c1f; }
.set-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  font-size: calc(15px * var(--fs));
  text-align: left;
  position: relative;
}
.set-row + .set-row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: 1px solid var(--hairline); }
.set-row .grow { flex: 1; }
.set-row .val { color: var(--sub); font-size: calc(13.5px * var(--fs)); }
.set-row .chev-r { color: var(--sub2); font-size: calc(16px * var(--fs)); }
.set-row .sub-l { display: block; font-size: calc(12px * var(--fs)); color: var(--sub); margin-top: 2px; }

.toggle {
  width: 46px; height: 28px; border-radius: 999px; background: var(--sub2);
  position: relative; transition: background 0.2s; flex-shrink: 0; display: inline-block;
}
.toggle::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: transform 0.2s var(--ease);
}
.toggle.on { background: var(--toggle-on); }
.toggle.on::after { transform: translateX(18px); }

.seg { background: rgba(0,0,0,0.055); border-radius: 999px; padding: 3px; display: inline-flex; }
.theme-dark .seg { background: rgba(255,255,255,0.08); }
.seg button { font-size: calc(12.5px * var(--fs)); padding: 6px 13px; border-radius: 999px; color: var(--sub); transition: background 0.2s, color 0.2s, box-shadow 0.2s; }
.seg button.on { background: var(--card); color: var(--fg); font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,0.12); }

/* 遊び方 */
.howto { font-size: calc(14.5px * var(--fs)); line-height: 1.7; }
.howto .item { display: flex; gap: 12px; padding: 9px 0; }
.howto .item + .item { border-top: 1px solid var(--hairline); }
.howto .k { flex-shrink: 0; width: 76px; font-weight: 700; font-size: calc(13px * var(--fs)); padding-top: 2px; }
.howto .d { flex: 1; color: var(--fg); }
.howto .d small { color: var(--sub); display: block; font-size: calc(12.5px * var(--fs)); }

/* ダイアログ */
.ml-alert {
  position: fixed;
  left: 50%; top: 50%;
  translate: -50% -50%;
  width: calc(100% - 60px);
  max-width: 330px;
  background: var(--card);
  border-radius: 18px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.22);
  padding: 22px 20px 16px;
  z-index: 40;
  animation: pop-in 0.2s var(--ease);
}
.ml-alert .ttl { font-size: calc(17px * var(--fs)); font-weight: 800; text-align: center; margin-bottom: 6px; }
.ml-alert .msg { font-size: calc(14.5px * var(--fs)); line-height: 1.65; margin-bottom: 16px; text-align: center; color: var(--sub); }
.ml-alert .field {
  width: 100%; background: var(--bg); border: none; border-radius: 10px;
  padding: 12px 14px; outline: none; font-size: calc(16px * var(--fs)); margin-bottom: 8px; text-align: center;
}
.ml-alert .a-btn {
  display: block; width: 100%; padding: 12px; border-radius: 12px; font-size: calc(14.5px * var(--fs));
  margin-top: 8px; background: var(--bg); text-align: center; transition: transform 0.12s;
}
.ml-alert .a-btn:active { transform: scale(0.97); }
.ml-alert .a-btn.primary { background: var(--primary-bg); color: var(--primary-fg); font-weight: 700; }
.ml-alert .a-btn.warn { color: var(--red); background: rgba(229,72,77,0.08); }
.ml-alert .a-row { display: flex; gap: 10px; }
.ml-alert .a-row .a-btn { flex: 1; }
/* 初回のチュートリアル */
.tut .tut-view { overflow: hidden; margin: 0 -20px; padding: 0 20px; touch-action: none; } /* 横スワイプはアプリで受ける（ブラウザに縦スクロールとして取られないように） */
.tut .tut-slide { will-change: transform; }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 200; }
.tut .tut-pic { position: relative; display: flex; justify-content: center; margin: 4px 0 14px; }
.tut .tut-board { max-width: 100%; height: auto; }
.tut .tut-bulb { position: absolute; right: 14px; bottom: -6px; width: 36px; height: 36px; border-radius: 50%; background: var(--float-bg); display: grid; place-items: center; box-shadow: var(--float-shadow); }
.tut .tut-bulb svg { width: 20px; height: 20px; stroke: var(--float-fg); }
.tut .msg { min-height: 48px; }
.tut-dots { display: flex; justify-content: center; gap: 6px; margin: -4px 0 6px; }
.tut-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--sub2); }
.tut-dots span.on { background: var(--fg); }
.ml-alert .pebble { width: 56px; height: 56px; border-radius: 16px; background: var(--logo-bg); margin: 0 auto 14px; display: grid; place-items: center; }
.ml-alert .pebble svg rect, .ml-alert .pebble svg circle { fill: var(--logo-fg); }
.ml-alert .pebble svg { width: 34px; height: 34px; }

/* トースト */
.toast {
  position: fixed;
  bottom: calc(100px + env(safe-area-inset-bottom));
  left: 50%;
  translate: -50% 0;
  background: var(--float-bg);
  color: var(--float-fg);
  box-shadow: var(--float-shadow);
  font-size: calc(13px * var(--fs));
  padding: 10px 20px;
  border-radius: 999px;
  z-index: 100;
  width: max-content;
  max-width: calc(100% - 40px);
  text-align: center;
  line-height: 1.5;
  white-space: pre-line;
  animation: pop-in 0.2s ease;
  pointer-events: none;
}
.toast.good { background: rgba(56,178,111,0.95); color: #fff; }
.toast.bad { background: rgba(229,72,77,0.95); color: #fff; }
/* 実績を手に入れたとき */
.toast.ach { background: #a8781f; color: #fff; font-weight: 700; font-size: calc(14px * var(--fs)); animation: special-pop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1); }

/* メニュー: お問い合わせのロゴ・曲の音量・選んでいる曲の印 */
.sns { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; color: var(--fg); background: var(--card); margin-left: 6px; }
.sns svg { width: 18px; height: 18px; }
.vol { width: 100%; margin-top: 10px; accent-color: var(--fg); }
.set-row .check { width: 20px; text-align: center; font-weight: 800; }
.profile-actions { margin-top: 18px; }

/* 規約への同意の一文と、設定の中のリンク */
.agree { color: var(--sub); font-size: calc(11.5px * var(--fs)); line-height: 1.6; margin-top: 10px; text-align: center; }
.agree a { color: inherit; }
a.set-row { color: inherit; text-decoration: none; }

/* いまいる人の欄の、Hollow World の探索者（名前だけ・グレーの地） */
.explorer-row { background: var(--bg); border-radius: 12px; padding: 10px 14px; margin-top: 8px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* プロフィール */
.profile-head { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 4px 0 18px; }
.avatar.big { width: 96px; height: 96px; }
.profile-name { font-size: calc(20px * var(--fs)); font-weight: 800; text-align: center; }
.profile-name .sub-l { display: inline; margin-left: 4px; font-size: calc(13px * var(--fs)); font-weight: 500; }
.rank-row[data-profile] { cursor: pointer; }

/* ショップ */
.shop-note { background: var(--bg); color: var(--sub); border-radius: 12px; padding: 10px 12px; font-size: calc(12.5px * var(--fs)); margin-bottom: 12px; }
.shop-sub { color: var(--sub); font-size: calc(12px * var(--fs)); margin: -4px 0 8px; }
.shop-row .avatar { width: 40px; height: 40px; }
.shop-thumb { width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0; }
.shop-thumb.icon { display: flex; align-items: center; justify-content: center; background: var(--bg); color: var(--fg); }
.shop-thumb.icon svg { width: 22px; height: 22px; stroke: currentColor; }
.shop-thumb.design { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 4px; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06); }
.shop-thumb.design i { border-radius: 2px; }
.shop-owned { color: var(--sub); font-size: calc(12.5px * var(--fs)); flex-shrink: 0; }
.shop-desc { color: var(--sub); font-size: calc(12px * var(--fs)); margin-top: 2px; }
.shop-row .go { background: var(--primary-bg); color: var(--primary-fg); border-radius: 999px; font-size: calc(12.5px * var(--fs)); font-weight: 700; padding: 7px 13px; flex-shrink: 0; }
.shop-row .go.on { background: transparent; color: var(--fg); box-shadow: inset 0 0 0 1px var(--hairline); }

/* 実績一覧 */
.ach-sum { color: var(--sub); font-size: calc(13px * var(--fs)); margin: -4px 0 10px; }
.ach-list { background: var(--card); border-radius: 14px; overflow: hidden; }
.ach-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.ach-row + .ach-row { border-top: 1px solid var(--hairline); }
.ach-medal { font-size: calc(22px * var(--fs)); line-height: 1; }
.ach-row .body { flex: 1; min-width: 0; }
.ach-row .ttl { font-weight: 700; font-size: calc(15px * var(--fs)); }
.ach-row .side { text-align: right; flex-shrink: 0; }
.ach-row .pts { font-weight: 700; font-size: calc(14px * var(--fs)); font-variant-numeric: tabular-nums; }
.ach-row .pts small { font-size: calc(11px * var(--fs)); color: var(--sub); margin-left: 1px; font-weight: 500; }
.ach-row .at { color: var(--sub); font-size: calc(11.5px * var(--fs)); margin-top: 2px; }
/* スペシャルエリアを埋めたとき: 水色のきらきらした札が弾む */
.toast.special {
  background: linear-gradient(120deg, #82c7d4, #c1e4e9 45%, #82c7d4); /* 水色・白藍 */
  color: #fff; font-size: calc(16px * var(--fs)); font-weight: 800; padding: 12px 26px;
  text-shadow: 0 1px 2px rgba(30, 80, 95, 0.45);
  box-shadow: 0 8px 26px rgba(130,199,212,0.45), 0 0 0 1px rgba(255,255,255,0.4) inset;
  animation: special-pop 0.55s cubic-bezier(0.2, 1.6, 0.4, 1);
}
@keyframes special-pop { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- テーマカラー・線の色の選択 ---------- */
.swatches { display: grid; grid-template-columns: repeat(6, 30px); gap: 10px 12px; justify-content: center; margin: 2px 0 6px; }
#s-line.swatches { display: flex; flex-wrap: nowrap; justify-content: space-between; gap: 8px; padding: 4px; }
/* 設定のテーマカラーも、線の色と同じく横幅いっぱいに均等に並べる */
#s-color.swatches { justify-content: space-between; padding: 4px; }
/* 狭い画面でも一列に収まるよう、丸を少しだけ小さくする */
#s-line .sw { width: auto; height: auto; flex: 0 1 30px; min-width: 0; aspect-ratio: 1; }
.sw-name { font-size: calc(12.5px * var(--fs)); color: var(--sub); text-align: center; min-height: 18px; margin-bottom: 12px; }
.set-row .sw-name { text-align: left; margin: -4px 0 0; }
.set-row .swatches { justify-content: flex-start; margin: 0; }
.sw {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.12);
  transition: transform 0.12s, box-shadow 0.15s;
}
.sw:active { transform: scale(0.88); }
.sw.on { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--fg); }
.sw.auto { background: linear-gradient(135deg, var(--sub2) 0 50%, var(--hairline) 50% 100%); }
.set-row.col { flex-direction: column; align-items: stretch; gap: 10px; }
.sw-label { font-size: calc(13px * var(--fs)); font-weight: 700; text-align: center; margin: 6px 0 10px; }
.sw-label small { display: block; font-weight: 400; color: var(--sub); font-size: calc(11.5px * var(--fs)); margin-top: 2px; }
.me-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }

/* ---------- コメント ---------- */
.cm-now { font-size: calc(13px * var(--fs)); color: var(--fg); background: var(--bg); border-radius: 10px; padding: 8px 12px; margin: -6px 0 12px; text-align: center; }
.cm-count { font-size: calc(11.5px * var(--fs)); color: var(--sub); text-align: right; margin: -2px 2px 8px; font-variant-numeric: tabular-nums; }
.cm-warn { font-size: calc(12.5px * var(--fs)); color: var(--red); text-align: center; margin-bottom: 4px; }
.ml-alert .a-btn:disabled { opacity: 0.4; }
.ml-alert .field:disabled { opacity: 0.5; }

/* ---------- アカウントリセット ---------- */
.set-row.danger { color: var(--red); }
.reset-list { font-size: calc(13px * var(--fs)); line-height: 1.6; color: var(--fg); margin: -6px 0 16px 18px; }
.reset-list li + li { margin-top: 4px; }

/* ---------- 引き継ぎコード ---------- */
.ml-alert .a-btn.link { background: none; color: var(--sub); font-size: calc(13.5px * var(--fs)); margin-top: 4px; }
.ml-alert .field.code { font-size: calc(22px * var(--fs)); letter-spacing: 3px; font-weight: 700; font-variant-numeric: tabular-nums; text-transform: uppercase; }
.code-val { font-weight: 700; color: var(--fg) !important; letter-spacing: 1px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- 招待（QR コード） ---------- */
.qr-wrap { display: flex; justify-content: center; margin: 4px 0 12px; }
.qr { width: min(72vw, 280px); height: auto; border-radius: 14px; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,0.08); }
.invite-url { font-size: calc(13px * var(--fs)); text-align: center; margin: 6px 0 14px; font-variant-numeric: tabular-nums; word-break: break-all; }
.invite-actions { gap: 10px; }
.sheet .a-btn { display: block; width: 100%; padding: 12px; border-radius: 12px; font-size: calc(14.5px * var(--fs)); background: var(--bg); text-align: center; transition: transform 0.12s; }
.sheet .a-btn:active { transform: scale(0.97); }
.sheet .a-btn.primary { background: var(--primary-bg); color: var(--primary-fg); font-weight: 700; }
.sheet .a-row { display: flex; gap: 10px; }
.sheet .a-row .a-btn { flex: 1; }
.invite-btn { display: inline-block !important; width: auto !important; margin-top: 14px; padding: 10px 20px !important; }

.cm-view { font-size: calc(18px * var(--fs)); font-weight: 600; text-align: center; line-height: 1.5; padding: 14px 8px 18px; word-break: break-all; }

/* ---------- 爆発の振り返り ---------- */
.review-chip {
  position: fixed; left: 50%; translate: -50% 0;
  bottom: calc(172px + env(safe-area-inset-bottom));
  background: var(--float-bg); color: var(--float-fg); box-shadow: var(--float-shadow);
  border: 0; border-radius: 999px; padding: 9px 18px; font: inherit; font-size: calc(14px * var(--fs)); font-weight: 700;
  z-index: 30; animation: pop-in 0.25s var(--ease); cursor: pointer;
}
.review-chip.hidden { display: none; }
.ml-alert .rv-sub { margin-bottom: 12px; font-size: calc(13.5px * var(--fs)); }
.rv-grid { display: grid; gap: 2px; margin: 0 auto 10px; width: 100%; }
.rv-c { aspect-ratio: 1; border-radius: 3px; display: grid; place-items: center; font-size: 13px; line-height: 1; position: relative; }
.rv-c.h { background: var(--tile); }
.theme-dark .rv-c.h { background: #3a3a3e; }
.rv-c.o { background: var(--open); box-shadow: inset 0 0 0 1px var(--open-line); }
.rv-c.out { background: transparent; }
.rv-c b { font-weight: 800; font-size: 13px; }
.rv-c.hit { background: rgba(229,72,77,0.28); font-size: 14px; }
.rv-c.safe { color: var(--green); font-weight: 900; font-size: 14px; box-shadow: inset 0 0 0 2px var(--green); }
.rv-flag { width: 3px; height: 62%; background: var(--sub); position: relative; display: block; }
.rv-flag::after { content: ''; position: absolute; left: 3px; top: 0; border-left: 8px solid var(--red); border-top: 4px solid transparent; border-bottom: 4px solid transparent; }
.rv-c.wrong s { position: absolute; inset: 0; display: grid; place-items: center; color: var(--red); font-size: 20px; font-weight: 900; text-decoration: none; }
.rv-note { font-size: calc(13px * var(--fs)); text-align: center; color: var(--fg); margin-bottom: 8px; }
.rv-legend { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; font-size: calc(11.5px * var(--fs)); color: var(--sub); margin-bottom: 12px; }
.rv-legend em { font-style: normal; font-weight: 900; }
.rv-legend .ok { color: var(--green); }
.rv-legend .ng { color: var(--red); }
.rv-c.used { box-shadow: inset 0 0 0 2px #e0a500; }
.rv-lbl { position: absolute; left: 1px; top: 0; font-size: 8.5px; font-weight: 800; color: #b07f00; line-height: 1; }
.theme-dark .rv-lbl { color: #f0c040; }
.rv-c.dmine { color: var(--red); font-size: 11px; }
.rv-c.dsafe { color: var(--green); font-size: 11px; }
.rv-step { position: absolute; right: 1px; bottom: 0; font-size: 8px; font-weight: 800; color: var(--sub); line-height: 1; }
.rv-detail { text-align: left; font-size: calc(12.5px * var(--fs)); line-height: 1.6; margin-bottom: 10px; max-height: 34vh; overflow-y: auto; }
.rv-dh { font-weight: 800; font-size: calc(13px * var(--fs)); margin-bottom: 4px; }
.rv-more { color: var(--sub); font-size: calc(12px * var(--fs)); margin-bottom: 4px; }
.rv-detail ol { margin: 0; padding-left: 1.4em; }
.rv-detail li + li { margin-top: 4px; }
.rv-detail .rv-legend { margin: 8px 0 0; }
.rv-legend .lb { color: #b07f00; }
.theme-dark .rv-legend .lb { color: #f0c040; }
.ml-alert { max-height: calc(100% - 32px); overflow-y: auto; }
.rv-pages { overflow: hidden; margin: 0 -20px; touch-action: pan-y; }
.rv-pages.single { overflow: visible; }
.rv-solo { padding-top: 6px; }
.rv-track { display: flex; will-change: transform; }
.rv-page { flex: 0 0 100%; box-sizing: border-box; padding: 0 20px; }
.rv-page + .rv-page { overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.ml-alert .rv-dt { font-size: calc(15px * var(--fs)); margin-bottom: 10px; }
.rv-page .rv-detail { max-height: none; overflow: visible; }
.rv-dots { margin: 8px 0 10px; }
.rv-dots span { cursor: pointer; }
.ach-h { font-size: calc(13px * var(--fs)); font-weight: 700; color: var(--sub); margin: 14px 2px 6px; }
.ach-list.stats { margin-bottom: 4px; }
.stat-row { display: flex; justify-content: space-between; align-items: baseline; padding: 11px 14px; font-size: calc(14.5px * var(--fs)); }
.stat-row + .stat-row { border-top: 1px solid var(--hairline); }
.stat-row b { font-variant-numeric: tabular-nums; font-weight: 700; }
.ml-alert .a-btn.link.danger { color: var(--red); }
.cm-del { border: 0; background: none; color: var(--red); font: inherit; font-size: calc(12.5px * var(--fs)); font-weight: 700; margin-left: 8px; padding: 2px 4px; cursor: pointer; }
.cm-readers { font-size: calc(13px * var(--fs)); color: var(--sub); text-align: center; margin: -6px 0 14px; line-height: 1.6; }
.cm-readers b { display: block; color: var(--fg); font-weight: 600; }

/* 文字を大きく（設定）。ふつうの文章は倍率どおり、見出しの大きな文字は少し控えめに */
html.big-text { --fs: 1.9; }
html.big-text body { font-size: calc(16px * var(--fs)); }
html.big-text .page-title { font-size: 40px; }
/* 文字を大きくしたときに、横に並べると窮屈なところは縦に積む */
html.big-text .set-row { flex-wrap: wrap; }
html.big-text .set-row .seg { margin-left: auto; }
html.big-text .howto .item { flex-direction: column; gap: 2px; }
html.big-text .howto .k { width: auto; }
html.big-text .set-row .grow { min-width: 4.5em; }

/* 指の操作: 盤面まわりは指の動きをすべてアプリで受ける（ページの拡大やスクロールをさせない）。
   シート・ダイアログは縦スクロールだけ許す（body に none をつけると iPhone でシートが動かなくなることがある） */
#app, #dim, .toast { touch-action: none; }
.sheet { touch-action: pan-y; overscroll-behavior: contain; }
/* ダイアログは横スワイプ（振り返りカードのページ送り）もあるので縦横どちらも許す */
.ml-alert { touch-action: pan-x pan-y; overscroll-behavior: contain; }
.howto-tut { display: block; width: 100%; border: 0; border-radius: 14px; background: var(--bg); color: var(--fg); font: inherit; font-size: calc(14.5px * var(--fs)); font-weight: 700; padding: 12px; margin: 0 0 10px; cursor: pointer; }
.theme-dark .howto-tut { background: #1c1c1f; }
.rv-c.focus { box-shadow: inset 0 0 0 2px #3b8fe0; }
.rv-easy { font-size: calc(14px * var(--fs)); line-height: 1.75; text-align: left; margin: 4px 2px 10px; }
.rv-legend .fc { color: #3b8fe0; }

/* 盤面のデザイン（ショップで買えるもの。和の伝統色）。使っている間はライトの見た目になる */
body.design-washi { --bg: #f8f4e6; --tile: #dcd3b2; --open: #fbfaf5; --open-line: #ede4cd; --hairline: #ede4cd; }   /* 象牙色・砂色・生成り色・練色 */
body.design-sakura { --bg: #fdeff2; --tile: #e4d2d8; --open: #fef4f4; --open-line: #e8d3d1; --hairline: #e8d3d1; } /* 薄桜・鴇鼠・桜色・灰桜 */
body.design-matcha { --bg: #d6e9ca; --tile: #c5c56a; --open: #fffffc; --open-line: #d6e9ca; --hairline: #d6e9ca; } /* 白緑・抹茶色・胡粉色 */
body.design-aizome { --bg: #ebf6f7; --tile: #165e83; --open: #fffffc; --open-line: #c1e4e9; --hairline: #c1e4e9; } /* 藍白・藍色・胡粉色・白藍 */
body.design-sumi { --bg: #f3f3f2; --tile: #a3a3a2; --open: #fffffc; --open-line: #dcdddd; --hairline: #dcdddd; }   /* 白練・薄墨色・胡粉色・白鼠 */
