* { box-sizing: border-box; }
[hidden] { display: none !important; }
:root { color-scheme: light; --ink:#1f2b2e; --muted:#647174; --paper:#f7f1e7; --card:#fffaf0; --accent:#286b72; --accent-strong:#17484e; --trap:#a33b35; --clear:#2f7b55; --line:rgba(31,43,46,.16); --shadow:0 18px 45px rgba(47,58,51,.16); }
body { margin:0; min-height:100vh; font-family:"Hiragino Sans","Yu Gothic","Meiryo",sans-serif; color:var(--ink); background:linear-gradient(rgba(255,255,255,.72) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.7) 1px,transparent 1px),#efe4d2; background-size:28px 28px; }
.page-shell { width:min(1120px, calc(100% - 32px)); margin:0 auto; padding:28px 0 24px; }
.lab-header,.game-card { background:rgba(255,250,240,.94); border:1px solid var(--line); border-radius:8px; box-shadow:var(--shadow); }
.lab-header { padding:22px 24px 18px; margin-bottom:16px; }
.lab-mark,.site-footer a { color:var(--accent-strong); text-decoration:none; font-weight:700; }
.lab-kicker,.input-label,.target-label,.score-row { letter-spacing:0; color:var(--muted); }
.lab-kicker { margin:18px 0 8px; font-size:.86rem; font-weight:700; }
h1 { margin:0; font-size:clamp(2rem,4vw,3.25rem); line-height:1.08; }
h1 span { display:block; margin-top:6px; font-size:clamp(1rem,2vw,1.35rem); font-weight:700; color:var(--accent); }
.lead { max-width:740px; margin:14px 0 0; color:#3d4b4e; line-height:1.7; }
.game-card { padding:18px; }
.rule-strip,.score-row,.action-row { display:grid; gap:10px; }
.rule-strip { grid-template-columns:repeat(3,minmax(0,1fr)); margin-bottom:12px; }
.rule-strip div { border:1px dashed var(--line); border-radius:8px; padding:10px 12px; background:rgba(255,255,255,.58); }
.rule-strip strong,.rule-strip span { display:block; }
.rule-strip strong { color:var(--accent-strong); }
.rule-strip span { margin-top:4px; font-size:.88rem; color:var(--muted); }
.score-row { grid-template-columns:repeat(3,minmax(0,1fr)); align-items:center; font-weight:700; font-size:.92rem; margin:8px 0 12px; }
.score-row span { border-bottom:1px solid var(--line); padding-bottom:6px; }
.action-row { grid-template-columns:auto auto minmax(0,1fr); align-items:center; margin-bottom:12px; }
button { min-height:44px; border:1px solid var(--accent-strong); border-radius:8px; padding:0 18px; font:inherit; font-weight:800; cursor:pointer; }
.primary-button { color:#fffaf0; background:var(--accent-strong); }
.ghost-button { color:var(--accent-strong); background:transparent; }
.status-text { min-height:44px; margin:0; display:flex; align-items:center; color:var(--accent-strong); font-weight:800; }
.game-card.is-clear .status-text { color:var(--clear); }
.game-card.is-trapped .status-text { color:var(--trap); }
.game-card.is-complete .status-text { color:var(--accent-strong); }
.scramble-stage { position:relative; min-height:230px; overflow:hidden; border:1px solid var(--line); border-radius:8px; background:repeating-linear-gradient(-2deg,rgba(40,107,114,.07) 0 1px,transparent 1px 18px),rgba(255,255,255,.62); display:grid; place-items:center; padding:20px; }
.stage-guide { max-width:520px; padding:14px 16px; border:1px dashed rgba(40,107,114,.34); border-radius:8px; color:var(--muted); background:rgba(255,250,240,.8); text-align:center; line-height:1.7; }
.target-card { width:min(720px,100%); margin:0; padding:18px 20px; border-radius:8px; border:2px solid rgba(23,72,78,.76); background:#fffaf0; box-shadow:0 14px 26px rgba(31,43,46,.14); }
.target-label { display:inline-flex; border-radius:999px; padding:4px 10px; background:rgba(40,107,114,.1); font-size:.82rem; font-weight:800; color:var(--accent-strong); }
#targetText { margin:14px 0 0; font-size:clamp(1.45rem,3.2vw,2.55rem); line-height:1.45; font-weight:800; overflow-wrap:anywhere; }
#targetText .swap { display:inline-block; transform:rotate(var(--tilt,-1deg)); text-decoration:underline wavy rgba(163,59,53,.5) 1.5px; text-underline-offset:6px; }
.input-label { display:block; margin:14px 0 6px; font-size:.92rem; font-weight:800; }
textarea { width:100%; min-height:82px; resize:vertical; border:1px solid rgba(31,43,46,.28); border-radius:8px; padding:12px 14px; font:inherit; font-size:1.06rem; line-height:1.6; background:rgba(255,255,255,.82); color:var(--ink); }
textarea:focus { outline:3px solid rgba(40,107,114,.22); border-color:var(--accent); }
textarea:disabled { color:var(--muted); background:rgba(240,233,220,.78); }
.site-footer { display:flex; gap:14px; justify-content:center; flex-wrap:wrap; padding:18px 0 0; }
@media (max-width:640px) { .page-shell { width:min(100% - 20px,520px); padding-top:12px; } .lab-header { padding:18px 16px; } h1 { font-size:2rem; } .game-card { padding:12px; } .rule-strip { grid-template-columns:1fr; } .score-row { grid-template-columns:1fr 1fr; } .score-row span:last-child { grid-column:span 2; } .action-row { grid-template-columns:1fr 1fr; } .status-text { grid-column:span 2; min-height:32px; } .scramble-stage { min-height:210px; padding:14px; } #targetText { font-size:1.45rem; } }

/* Safety note near typing input */
.mode-safety-note {
  margin: 0.55rem 0 0;
  max-width: 100%;
  color: inherit;
  font-size: 0.82rem;
  line-height: 1.65;
  opacity: 0.72;
}
