:root {
  --ink: #26302c;
  --ink-soft: #5d6b66;
  --bg: #eef1e8;
  --paper: #ffffff;
  --line: #d6ded6;
  --primary: #2f6f5e;
  --primary-dark: #1f4d41;
  --accent: #f0803c;
  --hint: #ffd23f;
  --gold: #f2c14e;
  --font: "Zen Maru Gothic", system-ui, sans-serif;
  --num: "Martian Mono", ui-monospace, "Zen Maru Gothic", 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; white-space: nowrap; }
.g-title { flex: 1; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.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; }

.bar { display: grid; grid-template-columns: 1.3fr 1.2fr 1fr; gap: 6px; margin-bottom: 8px; }
.box { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 4px 6px; text-align: center; min-width: 0; }
.lbl { font-size: 11px; font-weight: 900; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.val { font: 700 20px/1.3 var(--num); font-variant-numeric: tabular-nums; white-space: nowrap; }
.val.pen { color: #c4451f; }
.dots { display: flex; justify-content: center; align-items: center; gap: 5px; height: 26px; }
.dots i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #b9c6bf; display: block; }
.dots i.on { background: var(--accent); border-color: var(--accent); }

/* 2枚の絵（スマホは上下・パソコンは左右） */
.pics { display: grid; grid-template-columns: 1fr; gap: 8px; touch-action: manipulation; }
.pic { position: relative; aspect-ratio: 400 / 280; border-radius: 12px; overflow: hidden; border: 2px solid #c9d3cc; background: #fff; cursor: crosshair; box-shadow: 0 6px 18px rgba(38, 48, 44, 0.12); }
.pic > svg { display: block; width: 100%; height: 100%; }
.pic .marks { position: absolute; inset: 0; pointer-events: none; }
.pic.shake { animation: shake 0.3s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.mk-found { fill: none; stroke: var(--accent); stroke-width: 4; }
.mk-found2 { fill: none; stroke: #ffffff; stroke-width: 7; opacity: 0.85; }
.mk-miss { stroke: #d8433a; stroke-width: 5; stroke-linecap: round; animation: fade 0.9s forwards; }
@keyframes fade { 0%, 60% { opacity: 1; } 100% { opacity: 0; } }
.mk-hint { fill: rgba(255, 210, 63, 0.25); stroke: var(--hint); stroke-width: 4; animation: pulse 0.8s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: 0.35; } to { opacity: 1; } }
.play.cool .pic { cursor: wait; }
@media (prefers-reduced-motion: reduce) { .pic.shake, .mk-hint { animation: none; } }

.tools { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin-top: 8px; }
.tool { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); font: 900 14px/1 var(--font); cursor: pointer; white-space: nowrap; }
.tool.armed { background: var(--hint); border-color: #e0b22a; }
.tool:disabled { opacity: 0.35; cursor: default; }
.kbd { margin: 6px 0 0; font-size: 12px; color: var(--ink-soft); text-align: center; }

/* タイトル・結果（絵を隠して全体を見せる） */
.play.menu .bar, .play.menu .pics, .play.menu .tools, .play.menu .kbd { display: none; }
.card-ui { width: 100%; max-width: 420px; margin: 0 auto; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 20px 16px 16px; text-align: center; box-shadow: 0 10px 30px rgba(38, 48, 44, 0.1); }
.logo { margin: 0; font: 900 26px/1.3 var(--font); letter-spacing: 0.02em; white-space: nowrap; }
.day { margin: 2px 0 12px; 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 24px/1.4 var(--font); color: var(--primary-dark); }
.daily-thumb { margin: 6px auto 0; max-width: 260px; aspect-ratio: 400 / 280; border-radius: 10px; overflow: hidden; border: 2px solid #c9d3cc; position: relative; }
.daily-thumb svg { display: block; width: 100%; height: 100%; filter: blur(5px); transform: scale(1.06); } /* 始める前に絵を見て覚えられないよう、ぼかして見せる */
.daily-note { margin: 8px 0; font-size: 12px; color: var(--ink-soft); }
.done { font-size: 14px; font-weight: 900; margin-top: 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); }
.howto .nb { color: #c4451f; }
.stats { font-size: 12px; color: var(--ink-soft); font-weight: 700; margin: 10px 0 0; }

.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: 4px; }
.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.sub { font-size: 15px; }
.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-time { margin: 6px 0 2px; }
.clear-time b { font: 700 52px/1 var(--num); font-variant-numeric: tabular-nums; }
.clear-sub { margin: 4px 0 0; font-size: 14px; font-weight: 700; }
.c-thumb { margin: 10px auto 0; max-width: 300px; aspect-ratio: 400 / 280; border-radius: 10px; overflow: hidden; border: 2px solid #c9d3cc; position: relative; }
.c-thumb svg { display: block; width: 100%; height: 100%; }
.c-thumb .marks { position: absolute; inset: 0; }
.best { display: block; width: max-content; margin: 8px auto 0; padding: 2px 12px; border-radius: 999px; background: var(--gold); 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 22px/1.4 var(--font); }
.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: 40%; transform: translate(-50%, -50%); z-index: 40; max-width: calc(100% - 24px); padding: 10px 18px; border-radius: 16px; background: rgba(38, 48, 44, 0.92); color: #fff; font-weight: 900; font-size: 14px; text-align: center; pointer-events: none; }

/* 下の解説（ポータルと同じ決まり: 行間 1.85・段落の間は1行分・見出しは前を広く後ろを狭く） */
.guide { margin: 28px auto 0; max-width: 640px; 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; }
.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 (min-width: 760px) {
  main { max-width: 1000px; }
  .g-head { max-width: 1000px; }
  .pics { grid-template-columns: 1fr 1fr; gap: 14px; }
  .bar, .tools, .kbd { max-width: 620px; margin-left: auto; margin-right: auto; }
  .bar { margin-bottom: 10px; }
}
/* スマホの低い画面: 上下の余白をつめる */
@media (max-width: 759px) and (max-height: 700px) {
  .pics { gap: 6px; }
  .bar { margin-bottom: 6px; }
  .kbd { display: none; }
}
@media (max-width: 360px) {
  .logo { font-size: 23px; }
  .val { font-size: 17px; }
  .g-brand { font-size: 12px; }
}
