:root {
  --ink: #1f2b2e;
  --ink-soft: #5b6b6f;
  --bg: #e8f1ef;
  --paper: #ffffff;
  --line: #cfe0dc;
  --primary: #1f6f7d;
  --primary-dark: #154e59;
  --accent: #f0a23a;
  --card: #fffaf0;
  --card-line: #e3d6b8;
  --sel: #ffd66b;
  --good: #2f8f5b;
  --bad: #c2453a;
  --hk: #bfe2ff;
  --font: "Zen Kaku Gothic New", system-ui, sans-serif;
  --num: "Martian Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-weight: 500; line-height: 1.7; line-break: strict; }
.hidden { display: none !important; }
.nw { white-space: nowrap; }

.g-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; max-width: 520px; margin: 0 auto; font-size: 13px; font-weight: 900; }
.g-brand { color: var(--ink-soft); text-decoration: none; }
.g-title { flex: 1; text-align: center; }
.g-head [data-mg-account] a { color: var(--primary-dark); text-decoration: none; }

main { max-width: 520px; margin: 0 auto; padding: 0 12px 24px; }
.play { position: relative; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }

.bar { display: grid; grid-template-columns: 1.2fr 1fr 0.8fr 0.9fr; gap: 6px; margin-bottom: 6px; }
.box { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 4px 4px; text-align: center; min-width: 0; display: flex; flex-direction: column; justify-content: center; min-height: 54px; }
.lbl { font-size: 11px; font-weight: 900; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.val { font: 700 19px/1.2 var(--num); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#qno { font-size: 16px; }
#qno small { display: block; font: 900 10px/1.2 var(--font); color: var(--ink-soft); }
.menu-btn { font: 900 11px/1.2 var(--font); color: var(--ink-soft); cursor: pointer; align-items: center; gap: 2px; touch-action: manipulation; }
.steps-bar { list-style: none; display: flex; justify-content: center; gap: 6px; margin: 0 0 4px; padding: 0; }
.steps-bar li { min-width: 46px; padding: 0 8px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line); font-size: 12px; font-weight: 900; color: var(--ink-soft); text-align: center; }
.steps-bar li.now { background: var(--primary); border-color: var(--primary); color: #fff; }
.steps-bar li.ok { background: #e2f3e8; border-color: #8cc7a1; color: #1d6a3d; }
.steps-bar li.pass { background: #f4ecec; border-color: #d9b5b1; color: #8e3d35; }
.note { margin: 2px 0 6px; min-height: 1.7em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; font-weight: 900; color: var(--primary-dark); text-align: center; }
.note.warn { color: var(--bad); }
.note.good { color: var(--good); }

/* 遊ぶ場所。押す操作は touch-action: manipulation の下（portal の nozoom.js がすばやい連打を止めない） */
.field { position: relative; touch-action: manipulation; }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; touch-action: manipulation; }
.card { position: relative; height: clamp(104px, 27vw, 132px); border: 2px solid var(--card-line); border-radius: 18px; background: var(--card); color: var(--ink); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4px; box-shadow: 0 4px 0 var(--card-line); touch-action: manipulation; transition: transform 0.08s; }
.card:active { transform: translateY(2px); }
.card .v { font: 700 46px/1 var(--num); letter-spacing: -0.02em; display: inline-flex; align-items: center; gap: 4px; }
.card .x { margin-top: 6px; max-width: 100%; font: 700 12px/1.2 var(--num); color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card.sel { background: var(--sel); border-color: #e2a91c; box-shadow: 0 4px 0 #c9921a; }
.card.gone { visibility: hidden; }
.card.zero { opacity: 0.3; cursor: not-allowed; }
.card.hk { background: var(--hk); border-color: #2b8be0; box-shadow: 0 4px 0 #2b8be0; }
.card.ten { background: #e2f3e8; border-color: var(--good); box-shadow: 0 4px 0 var(--good); }
.card.bad { background: #fbe9e7; border-color: var(--bad); box-shadow: 0 4px 0 var(--bad); }
.card.pop { animation: pop 0.25s ease-out; }
@keyframes pop { 0% { transform: scale(0.85); } 70% { transform: scale(1.05); } 100% { transform: scale(1); } }
/* 分数（分子の下に線・分母） */
.fr { display: inline-flex; flex-direction: column; align-items: center; font-size: 30px; line-height: 1.05; }
.fr i { font-style: normal; padding: 0 4px; }
.fr i:first-child { border-bottom: 3px solid currentColor; }
.sg { font-size: 34px; }

.ops { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; touch-action: manipulation; }
.op { height: 62px; border: 0; border-radius: 16px; background: var(--primary); color: #fff; font: 700 34px/1 var(--num); cursor: pointer; box-shadow: 0 4px 0 var(--primary-dark); touch-action: manipulation; }
.op:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--primary-dark); }
.op.on { background: var(--accent); box-shadow: 0 4px 0 #b9741a; color: #2a1a00; }
.op.hk { background: #2b8be0; box-shadow: 0 4px 0 #1b5f9d; }
.op:disabled { opacity: 0.35; cursor: default; }

.tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 12px; touch-action: manipulation; }
.tools.four { grid-template-columns: repeat(4, 1fr); }
.tool { display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 11px 2px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); font: 900 13px/1.1 var(--font); cursor: pointer; white-space: nowrap; touch-action: manipulation; }
.tool:disabled { opacity: 0.35; cursor: default; }
.tool.armed { background: #fff1d6; border-color: var(--accent); }
.kbd { margin: 8px 0 0; font-size: 11px; color: var(--ink-soft); text-align: center; }
@media (hover: none) { .kbd { display: none; } }

/* 解けたときの知らせ（遊ぶ場所の上に重ねる） */
.solved { position: absolute; inset: -4px; z-index: 20; border-radius: 18px; background: var(--paper); border: 2px solid var(--good); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; text-align: center; }
.solved.give { border-color: var(--ink-soft); }
.s-big { font: 900 34px/1.2 var(--font); color: var(--good); }
.solved.give .s-big { color: var(--ink-soft); font-size: 22px; }
.s-expr { margin: 8px 0 2px; font: 700 24px/1.35 var(--num); word-break: break-all; }
.s-count { font-size: 15px; font-weight: 900; color: var(--primary-dark); }
.s-stars { margin-top: 6px; font-size: 26px; color: #e0a100; letter-spacing: 0.1em; }
.solved .btn { max-width: 280px; margin: 10px 0 0; }
.solved .btn.ghost { margin-top: 6px; }

.r-pop { position: absolute; left: 50%; top: 70px; transform: translateX(-50%); z-index: 35; width: calc(100% - 24px); max-width: 400px; padding: 16px; border-radius: 18px; background: var(--paper); border: 2px solid var(--good); box-shadow: 0 14px 40px rgba(20, 60, 60, 0.25); text-align: center; cursor: pointer; }
.r-pop.give { border-color: var(--ink-soft); }
.r-pop.give .s-big { color: var(--ink-soft); font-size: 22px; }
.r-pop-t { margin-top: 6px; font-size: 11px; font-weight: 700; color: var(--ink-soft); }
@media (prefers-reduced-motion: reduce) { .card.pop, .card { animation: none; transition: none; } }

/* タイトル・結果（遊ぶ場所を隠して全体を見せる） */
.play.menu .bar, .play.menu .steps-bar, .play.menu .note, .play.menu .field { display: none; }
.card-ui { width: 100%; max-width: 420px; margin: 0 auto; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 18px 16px 16px; text-align: center; box-shadow: 0 10px 30px rgba(20, 60, 60, 0.1); }
.logo-art { display: flex; justify-content: center; align-items: center; gap: 6px; }
.logo-art i { font: 700 22px/1 var(--num); font-style: normal; width: 40px; height: 48px; display: flex; align-items: center; justify-content: center; background: var(--card); border: 2px solid var(--card-line); border-radius: 10px; }
.logo-art b { margin-left: 6px; font: 700 24px/1 var(--num); color: #fff; background: var(--good); border-radius: 10px; padding: 12px 10px; }
.logo { margin: 8px 0 0; font: 900 30px/1.25 var(--font); letter-spacing: 0.04em; color: var(--primary-dark); }
.logo span { display: inline-block; }
.day { margin: 2px 0 10px; font-size: 13px; color: var(--ink-soft); font-weight: 900; }
.daily-box { border: 2px solid var(--primary); border-radius: 16px; padding: 12px; margin-bottom: 10px; }
.daily-lbl { font-size: 11px; font-weight: 900; color: var(--ink-soft); letter-spacing: 0.1em; }
.daily-name { font: 900 19px/1.4 var(--font); color: var(--primary-dark); }
.daily-note { margin: 6px 0 8px; font-size: 12px; color: var(--ink-soft); }
.done { font-size: 14px; font-weight: 900; margin-top: 6px; }
.free-lbl { font-size: 12px; font-weight: 900; color: var(--ink-soft); margin: 6px 0 4px; }
.free-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.howto { list-style: none; margin: 12px 0 0; padding: 10px 12px; background: var(--bg); border-radius: 12px; text-align: left; font-size: 13px; font-weight: 700; }
.howto li { display: flex; align-items: baseline; gap: 6px; padding: 3px 0; }
.howto .num { flex: none; font-weight: 900; color: var(--primary); }
.stats { font-size: 12px; color: var(--ink-soft); font-weight: 700; margin: 10px 0 0; }

.list-h { margin: 0; font: 900 24px/1.4 var(--font); color: var(--primary-dark); }
.list-sub { margin: 2px 0 10px; font-size: 12px; color: var(--ink-soft); font-weight: 700; }
.qlist { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; touch-action: manipulation; max-height: 60vh; overflow-y: auto; }
.qlist button { width: 100%; padding: 8px 0 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); font: 900 15px/1.1 var(--font); color: var(--ink); cursor: pointer; }
.qlist button small { display: block; margin-top: 3px; font-size: 10px; letter-spacing: -1px; color: #c48a00; min-height: 1em; }

.btn { display: block; width: 100%; margin: 8px 0; padding: 13px 10px; border: 0; border-radius: 14px; font: 900 16px/1.2 var(--font); cursor: pointer; background: var(--bg); color: var(--ink); }
.btn small { display: block; font-size: 11px; font-weight: 700; color: var(--ink-soft); margin-top: 3px; }
.btn.primary { background: var(--primary); color: #fff; box-shadow: 0 4px 0 var(--primary-dark); }
.btn.primary:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--primary-dark); }
.btn.lv { margin: 0; font-size: 14px; padding: 10px 2px; background: #dcece8; }
.btn.sub { font-size: 14px; }
.btn.ghost { background: transparent; border: 2px solid var(--line); color: var(--ink-soft); font-size: 14px; }
.btn.x { background: #000; color: #fff; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn:disabled { opacity: 0.5; cursor: default; }

.clear-lbl { font-size: 13px; font-weight: 900; color: var(--primary-dark); }
.clear-big { margin: 4px 0 0; }
.clear-big b { font: 700 58px/1.05 var(--num); }
.clear-big span { font-size: 20px; font-weight: 900; margin-left: 4px; }
.clear-time { font: 700 24px/1.3 var(--num); color: var(--primary-dark); }
.clear-sub { margin: 0; font-size: 14px; font-weight: 700; }
.c-probs { list-style: none; margin: 10px 0 0; padding: 0; text-align: left; }
.c-probs li { display: flex; align-items: baseline; gap: 6px; padding: 6px 4px; border-top: 1px solid var(--line); font-size: 13px; }
.c-probs .num { flex: none; font-weight: 900; color: var(--primary); }
.c-probs .t { flex: none; width: 5.2em; font-weight: 900; color: var(--ink-soft); font-size: 12px; }
.c-probs .e { flex: 1; min-width: 0; font: 700 14px/1.35 var(--num); word-break: break-all; }
.c-probs .e.ps { font-family: var(--font); font-weight: 700; color: var(--bad); font-size: 13px; }
.c-probs .e small { display: block; font: 700 11px/1.4 var(--font); color: var(--ink-soft); }
.c-probs .n { flex: none; font-size: 12px; font-weight: 900; color: var(--ink-soft); }
.c-rare { margin: 8px 0 0; padding: 8px 10px; border-radius: 12px; background: #eaf4f1; font-size: 13px; font-weight: 900; color: var(--primary-dark); }
.c-rare:empty { display: none; }
.c-detail { list-style: none; margin: 8px auto 0; padding: 8px 12px; max-width: 300px; background: var(--bg); border-radius: 12px; text-align: left; font-size: 13px; font-weight: 700; }
.c-detail li { display: flex; justify-content: space-between; gap: 8px; padding: 1px 0; }
.c-detail li b { font-weight: 900; }
.c-detail li.tot { border-top: 1px solid var(--line); margin-top: 3px; padding-top: 4px; }
.best { display: inline-block; margin: 8px 4px 0; padding: 2px 12px; border-radius: 999px; background: var(--accent); font-weight: 900; font-size: 13px; }
.pstreak { display: inline-block; margin: 8px 4px 0; padding: 2px 12px; border-radius: 999px; background: #e6f6ee; color: #1f6b47; font-weight: 900; font-size: 13px; }
.rank { margin: 12px 0; padding: 8px; background: var(--bg); border-radius: 14px; }
.rank-lbl { font-size: 11px; font-weight: 900; color: var(--ink-soft); }
.rank-name { font: 900 26px/1.4 var(--font); color: var(--primary-dark); }
.rank-basis { font-size: 11px; font-weight: 700; color: var(--ink-soft); }
.c-note { margin: 8px 0; padding: 8px 10px; border-radius: 12px; background: #fff6dd; font-size: 13px; font-weight: 700; text-align: left; }
.share { margin: 8px 0; }

.toast { position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); z-index: 40; width: max-content; max-width: calc(100% - 24px); padding: 10px 18px; border-radius: 16px; background: rgba(31, 43, 46, 0.92); color: #fff; font-weight: 900; font-size: 15px; text-align: center; pointer-events: none; }

/* 下の解説（ポータルと同じ決まり） */
.guide { margin-top: 28px; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 22px 20px 12px; font-size: 15px; line-height: 1.85; }
.guide p { margin: 0 0 1em; }
.guide h2 { font: 900 19px/1.4 var(--font); margin: 32px 0 12px; padding-left: 10px; border-left: 5px solid var(--primary); }
.guide h2:first-child { margin-top: 0; }
.guide h3 { font-size: 16px; margin: 22px 0 6px; line-height: 1.5; display: flex; align-items: baseline; gap: 4px; }
.guide h3 .num { flex: none; }
.guide ul { padding-left: 1.3em; margin: 0 0 1em; }
.guide li { margin: 6px 0; }
.guide .steps { list-style: none; padding: 0; }
.guide .steps li { display: flex; align-items: baseline; gap: 6px; }
.guide .steps .num { flex: none; font-weight: 900; color: var(--primary); }
.guide details { border-top: 1px solid var(--line); padding: 12px 0; }
.guide details p { margin: 8px 0 4px; }
.guide summary { font-weight: 900; cursor: pointer; }
.guide a { color: var(--primary-dark); }
.g-foot { max-width: 520px; margin: 0 auto; padding: 14px 16px 28px; font-size: 12px; text-align: center; }
.g-foot a { color: var(--ink-soft); }
.card-ui .mg-box { background: var(--bg); border-color: transparent; }
@media (max-width: 360px) { main { padding: 0 6px 24px; } .card .v { font-size: 40px; } .op { height: 56px; } }

/* 遊んでいるあいだ（html.make10-play）: ページが指でずれない・サイトの見出しを隠す */
html.make10-play, html.make10-play body { overscroll-behavior: none; }
html.make10-play .g-head { display: none; }
html.make10-play main { padding-top: 8px; }
