:root { color-scheme:light; font-family:Arial,"Microsoft YaHei",sans-serif; color:#333; background:#f5f5f5; --red:#990011; }
* { box-sizing:border-box; }
[hidden] { display:none !important; }
body { margin:0; }
a { color:var(--red); text-decoration:none; }
a:hover { text-decoration:underline; }
button { font:inherit; cursor:pointer; color:#333; }
button:disabled { cursor:default; opacity:.45; }
a:focus-visible,button:focus-visible { outline:3px solid #b84252; outline-offset:3px; }
.masthead { background:repeating-linear-gradient(135deg,#0002 0 1px,transparent 1px 4px),linear-gradient(#191919,#59121d); }
.brand-wrap { width:min(960px,calc(100% - 40px)); margin:auto; height:104px; display:flex; align-items:center; }
.brand { color:#eee; display:flex; align-items:center; gap:10px; }
.brand:hover { text-decoration:none; }
.brand img { width:86px; height:86px; object-fit:contain; transform:scale(1.35); margin-right:10px; }
.brand strong { display:block; font-size:32px; letter-spacing:1px; text-shadow:2px 2px 3px #000; }
.motto { display:block; margin-top:5px; font-size:13px; font-weight:bold; color:#e9e6c8; }
.topbar { background:#333; box-shadow:0 2px 4px #0002; }
.topbar > div { display:flex; justify-content:flex-end; width:min(960px,100%); margin:auto; }
.topbar a { color:#eee; padding:8px 18px; border-left:1px solid #666; font-size:13px; white-space:nowrap; }
.topbar a:last-child { border-right:1px solid #666; }
.topbar a[aria-current],.topbar a:hover { background:#555; text-decoration:none; }
main { width:min(880px,calc(100% - 40px)); margin:24px auto 28px; }
.page-heading { display:flex; justify-content:space-between; align-items:center; border-bottom:1px solid #bbb; padding-bottom:14px; margin-bottom:20px; }
h1 { color:#85000f; font-size:28px; margin:0 0 8px; }
.page-heading p { margin:0; font-size:14px; line-height:1.6; }
.back-link { font-size:13px; white-space:nowrap; margin-left:12px; }
.game-layout { display:grid; grid-template-columns:minmax(0,484px) 250px; justify-content:center; align-items:start; gap:32px; }
.play-section { min-width:0; width:100%; }
.hud { display:grid; grid-template-columns:1fr 1fr 1.25fr; gap:10px; margin-bottom:11px; }
.score-card,.next-card { min-width:0; height:71px; border:1px solid #c5c0bd; border-top:3px solid #8b2633; background:white; padding:8px 12px; }
.score-card > span,.next-card > span { display:block; font-size:12px; color:#777; }
.score-card strong { display:block; margin-top:3px; color:#85000f; font-size:26px; font-variant-numeric:tabular-nums; }
.best-card strong { color:#444; }
.next-card { display:grid; grid-template-columns:1fr 46px; grid-template-rows:19px 1fr; align-items:center; }
.next-card canvas { width:44px; height:44px; grid-column:2; grid-row:1/3; }
.next-card strong { font-size:13px; font-weight:normal; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.well-wrap { position:relative; border:1px solid #bcb4b0; border-radius:4px 4px 12px 12px; background:#f9f5ec; box-shadow:0 4px 12px #442b1710; overflow:hidden; }
#board { display:block; width:100%; height:auto; aspect-ratio:484/704; touch-action:none; cursor:crosshair; outline:none; }
#board:focus-visible { box-shadow:inset 0 0 0 3px #b84252; }
.well-overlay { position:absolute; inset:0; display:grid; place-items:center; padding:24px; background:#f9f5ecee; text-align:center; }
.well-overlay > div { width:100%; max-width:270px; }
.well-overlay strong { font-size:23px; }
.well-overlay p { font-size:14px; line-height:1.6; }
.well-overlay button { margin-top:12px; min-width:150px; }
.pause-overlay { background:#f9f5eccc; }
.pause-overlay strong { display:block; }
.end-tag { font-size:12px; letter-spacing:2px; color:#888; }
.end-card h2 { color:#85000f; margin:13px 0; font-size:34px; }
.end-card #end-score { color:#85000f; }
.game-status { min-height:32px; display:flex; align-items:center; justify-content:center; font-size:13px; color:#777; text-align:center; }
.game-status.warning { color:#a40017; font-weight:bold; }
.controls { display:grid; grid-template-columns:1.3fr 1fr 1fr 1fr; gap:7px; }
button { padding:9px 8px; border:1px solid #bbb; border-radius:3px; background:#fff; font-size:13px; min-height:39px; white-space:nowrap; }
button:hover:enabled { background:#f0ecea; }
.primary-button { color:white; border-color:#7b0010; background:#990011; font-weight:bold; }
.primary-button:hover:enabled { background:#79000d; }
.shake-button { grid-column:1 / -1; color:#85000f; border-color:#b58189; background:#fff8f8; }
.order-panel { border:1px solid #bcbcbc; background:white; border-radius:4px; overflow:hidden; }
.guide h2 { margin:0; font-size:15px; }
.order-panel h2 { padding:12px 16px; background:#e8e8e8; border-bottom:1px solid #bbb; color:#650010; }
#level-list { list-style:none; margin:0; padding:5px 14px; }
.level-row { display:flex; align-items:center; gap:10px; padding:5px 0; min-height:47px; border-bottom:1px solid #eee; font-size:13px; }
.level-row:last-child { border-bottom:0; }
.level-row canvas { width:35px; height:35px; flex-shrink:0; }
.level-row .rank { color:#aaa; font:11px Georgia,serif; min-width:16px; }
.level-row .level-name { flex:1; }
.level-row.unlocked .rank { color:#990011; }
.level-row.highest .level-name { color:#990011; font-weight:bold; }
.level-row.highest::after { content:'◆'; color:#990011; font-size:9px; }
.how-to { padding:17px 4px; font-size:12px; line-height:1.75; color:#666; }
.how-to h2 { color:#555; margin-bottom:10px; }
.how-to p { margin:8px 0; }
footer { display:flex; justify-content:center; gap:10px; padding:20px; border-top:1px solid #ddd; font-size:12px; color:#aaa; }
@media(min-width:761px) and (min-height:760px) {
  .game-layout { grid-template-columns:minmax(0,min(484px,calc((100svh - 340px)*.6875))) 250px; }
}
@media(max-width:760px) {
  .brand-wrap { width:calc(100% - 28px); height:86px; }
  .brand img { width:68px; height:68px; margin-right:2px; }
  .brand strong { font-size:26px; }
  .motto { font-size:11px; }
  .topbar > div { justify-content:center; }
  .topbar a { font-size:11px; padding:8px 10px; }
  main { width:calc(100% - 24px); margin-top:16px; }
  .page-heading { margin-bottom:14px; padding-bottom:10px; }
  h1 { font-size:23px; margin-bottom:5px; }
  .page-heading p { font-size:12px; }
  .back-link { display:none; }
  .game-layout { grid-template-columns:minmax(0,484px); gap:19px; }
  .hud { gap:7px; }
  .score-card,.next-card { padding:7px 9px; height:63px; }
  .score-card strong { font-size:24px; }
  .next-card { grid-template-columns:1fr 36px; }
  .next-card canvas { width:36px; height:36px; }
  .next-card strong { font-size:11px; }
  .controls { gap:5px; }
  button { padding:8px 5px; font-size:12px; }
  #level-list { display:flex; overflow-x:auto; padding:10px 6px; scrollbar-width:thin; }
  .level-row { width:73px; min-width:73px; flex-direction:column; gap:4px; border:0; padding:0 4px; position:relative; text-align:center; }
  .level-row .rank { display:none; }
  .level-row .level-name { white-space:nowrap; font-size:10px; }
  .level-row:not(:last-child)::after { content:'›'; position:absolute; right:-1px; top:12px; color:#aaa; font-size:15px; }
  .level-row.highest::before { content:'◆'; position:absolute; left:8px; top:0; color:#990011; font-size:7px; }
  .how-to { display:none; }
}
@media(prefers-reduced-motion:reduce) { * { scroll-behavior:auto; } }
