* { box-sizing: border-box; }
:root { color-scheme: light; background: #e9f2f5; color: #203952; font-family: system-ui, "Hiragino Sans", Meiryo, sans-serif; }
body { margin: 0; }
[hidden] { display: none !important; }
main { width: min(100%, 500px); margin: auto; display: flex; flex-direction: column; align-items: center; padding: env(safe-area-inset-top) max(7px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(7px, env(safe-area-inset-left)); }
header { display: flex; width: 100%; min-height: 57px; align-items: center; justify-content: space-between; gap: 6px; padding: 3px 4px; }
header a { display: flex; align-items: center; flex: none; min-height: 44px; color: #29485f; font-size: 12px; text-decoration: none; }
h1 { margin: 0; font-size: clamp(14px, 4.5vw, 22px); text-align: right; line-height: 1.14; letter-spacing: -.04em; }
.board { position: relative; flex: none; width: min(100%, calc((100vh - 65px) * 320 / 490)); width: min(100%, calc((100svh - 65px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) * 320 / 490)); aspect-ratio: 320 / 490; }
canvas { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 20px; box-shadow: 0 4px 12px #24476323; background: #c6dce9; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: crosshair; }
#hint { position: absolute; left: 50%; top: 53%; transform: translateX(-50%); margin: 0; white-space: nowrap; padding: 8px 12px; border-radius: 16px; background: #f9fcff; box-shadow: 0 2px 4px #26485e40; font-size: clamp(12px, 4vw, 17px); font-weight: 740; pointer-events: none; }
#result { position: absolute; left: 6%; right: 6%; top: 5.5%; padding: 8px; display: grid; justify-items: center; gap: 3px; border: 1px solid #d9ebfe; border-radius: 15px; background: #f7fcff; box-shadow: 0 7px 20px #20456447; }
#filled { font-size: clamp(25px, 8vw, 38px); color: #254965; line-height: 1.1; font-variant-numeric: tabular-nums; }
#notice { margin: 0; font-size: clamp(10px, 3.2vw, 14px); }
.actions { display: flex; gap: 5px; width: 100%; justify-content: center; margin-top: 3px; }
button { min-height: 44px; border: 1px solid #a0b9cd; padding: 5px 7px; border-radius: 8px; background: #e7eff8; color: #263f53; font: 750 clamp(11px, 3.6vw, 16px) system-ui, sans-serif; cursor: pointer; white-space: nowrap; }
#again { background: #294e70; color: white; }
#copy { display: block; width: 100%; min-height: 48px; font-size: 16px; }
#save { display: inline-flex; align-items: center; min-height: 44px; font-size: 13px; color: #254965; }
:focus-visible { outline: 3px solid #284e80; outline-offset: 2px; }
@media (orientation: landscape) and (max-height: 490px) {
  header { min-height: 42px; }
  h1 { font-size: 14px; }
  .board { width: min(100%, calc((100svh - 48px) * 320 / 490)); }
  #result { padding: 4px; left: 2%; right: 2%; }
  button { min-height: 31px; padding-inline: 4px; }
  #filled { font-size: 19px; }
}
