body.maze-page main { min-height: 100dvh; background: radial-gradient(circle at 9% 18%, #fff 0 3px, transparent 4px), linear-gradient(#bfeaf2 0 300px, #fff8e7 300px); }
.maze-game { width: min(1050px, calc(100% - 40px)); margin: 30px auto 44px; position: relative; z-index: 1; }
.maze-layout { display: grid; grid-template-columns: 310px minmax(0, 1fr); overflow: hidden; border: 3px solid var(--ink); border-radius: 28px; background: #fff; box-shadow: 10px 10px 0 var(--ink); animation: maze-card-in .65s cubic-bezier(.2,.8,.2,1) both; }
.maze-info { padding: 34px 28px; background: #dff5e5; border-right: 3px solid var(--ink); display: flex; flex-direction: column; justify-content: center; }
.maze-kicker { color: #2e7d87; font-size: 10px; letter-spacing: .18em; font-weight: 900; }
.maze-info h1 { margin: 10px 0 16px; font-size: 48px; line-height: .98; letter-spacing: -.055em; }
.maze-info p { margin: 0; color: #52675b; font-size: 13px; line-height: 1.75; }
.maze-steps { display: grid; gap: 9px; margin: 24px 0; }
.maze-steps span { display: flex; align-items: center; gap: 9px; font-size: 11px; font-weight: 900; }
.maze-steps b { width: 25px; height: 25px; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 50%; background: var(--yellow); }
.maze-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.maze-actions button { min-height: 48px; padding: 9px 8px; border: 2px solid var(--ink); border-radius: 14px; box-shadow: 4px 4px 0 var(--ink); font-size: 11px; font-weight: 900; cursor: pointer; transition: transform .16s ease, box-shadow .16s ease; }
.maze-actions button:hover { transform: translateY(-2px); }
.maze-actions button:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--ink); }
.maze-hint { background: #e8dcff; }
.maze-new { background: var(--blue); }
.maze-board-wrap { min-width: 0; padding: 22px; background: #fff; }
.maze-board-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; color: #687184; font-size: 10px; font-weight: 900; }
.maze-board-top strong { padding: 7px 13px; border-radius: 20px; background: #fff2bd; color: var(--ink); }
#mazeCanvas { width: 100%; aspect-ratio: 1; display: block; border: 3px solid var(--ink); border-radius: 22px; background: #fffaf0; touch-action: none; cursor: grab; outline: none; }
#mazeCanvas:active { cursor: grabbing; }
#mazeCanvas:focus-visible { box-shadow: 0 0 0 6px #71cfe566; }
.maze-toast { position: fixed; z-index: 2000; top: max(14px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 28px); padding: 13px 22px; border: 3px solid var(--ink); border-radius: 16px; background: var(--pink); color: #fff; box-shadow: 5px 5px 0 var(--ink); font-weight: 900; text-align: center; animation: maze-toast-in .35s cubic-bezier(.2,.8,.2,1); }
.maze-page footer { padding-bottom: env(safe-area-inset-bottom); }

@keyframes maze-card-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes maze-toast-in { from { opacity: 0; transform: translate(-50%,-18px) scale(.9); } to { opacity: 1; transform: translateX(-50%) scale(1); } }

@media (max-width: 780px) {
  .maze-page .topbar { width: calc(100% - 22px); min-height: calc(56px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); }
  .maze-page .brand { font-size: 0; gap: 0; }
  .maze-page .brand-mark { width: 28px; height: 28px; }
  .maze-page .mode-switch a { min-height: 38px; padding: 5px 6px; font-size: 8px; }
  .maze-game { width: calc(100% - 22px); margin: 14px auto 28px; }
  .maze-layout { grid-template-columns: 1fr; border-radius: 21px; box-shadow: 7px 7px 0 var(--ink); }
  .maze-info { padding: 14px 14px 12px; border-right: 0; border-bottom: 3px solid var(--ink); display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; align-items: center; }
  .maze-kicker { display: none; }
  .maze-info h1 { margin: 0 0 5px; font-size: 31px; }
  .maze-info h1 br { display: none; }
  .maze-info p { grid-column: 1; font-size: 10px; line-height: 1.4; }
  .maze-steps { display: none; }
  .maze-actions { grid-column: 2; grid-row: 1 / span 2; width: 156px; gap: 7px; }
  .maze-actions button { min-height: 42px; padding: 7px 5px; font-size: 9px; box-shadow: 3px 3px 0 var(--ink); }
  .maze-board-wrap { padding: 11px; }
  .maze-board-top { margin-bottom: 7px; }
  #mazeCanvas { border-radius: 16px; }
  .maze-page footer { width: calc(100% - 22px); min-height: 58px; }
}

@media (max-width: 390px) {
  .maze-info h1 { font-size: 27px; }
  .maze-info p { max-width: 165px; }
  .maze-actions { width: 142px; }
}

@media (max-height: 700px) and (max-width: 780px) {
  .maze-game { margin-top: 8px; }
  .maze-info { padding-block: 9px; }
  .maze-info p { display: none; }
  .maze-actions { grid-row: 1; }
  .maze-board-wrap { padding: 8px; }
  .maze-board-top { margin-bottom: 5px; }
  .maze-page footer { min-height: 48px; font-size: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .maze-layout, .maze-toast, .maze-actions button { animation: none !important; transition: none !important; }
}
