@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700;800&family=Manrope:wght@500;600;700;800&display=swap");

:root { color-scheme: light; font-family: "DM Sans", sans-serif; }
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #3c9a87; outline-offset: 3px; }

.maze-page {
  --maze-bg: #dce7e3;
  --maze-surface: #e3ede9;
  --maze-ink: #233c43;
  --maze-muted: #60777a;
  --maze-accent: #168b7d;
  --maze-light: #f7fffa;
  min-height: 100svh;
  color: var(--maze-ink);
  background: radial-gradient(circle at 22% 5%, #eaf2ee 0, transparent 46%), radial-gradient(circle at 95% 95%, #c5d9d5 0, transparent 45%), var(--maze-bg);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.maze-app { min-height: 100svh; height: 100svh; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.maze-topbar { position: relative; z-index: 2; display: grid; grid-template-columns: 50px minmax(0, 1fr) 50px; align-items: center; gap: 14px; width: min(100%, 1120px); min-height: 78px; margin: auto; padding: 10px 22px; }
.maze-brand { display: flex; align-items: center; justify-content: center; gap: 10px; min-width: 0; text-align: left; }
.maze-brand-mark { display: grid; place-items: center; flex: 0 0 auto; width: 33px; height: 33px; border-radius: 12px; color: #f2fff9; background: #2d6767; font: 800 19px/1 "Manrope", sans-serif; box-shadow: inset 2px 2px 3px rgba(255,255,255,.24), inset -3px -3px 5px rgba(12,52,56,.3), 3px 4px 8px rgba(49,89,85,.21); }
.maze-brand-kicker, .maze-overline { display: block; color: #5b7f7c; font: 800 10px/1.3 "Manrope", sans-serif; letter-spacing: .17em; }
.maze-brand h1 { margin: 0; font: 800 clamp(18px, 3vw, 23px)/1.15 "Manrope", sans-serif; letter-spacing: -.045em; }
.maze-icon-button { display: grid; place-items: center; width: 48px; height: 48px; padding: 0; border: 0; border-radius: 16px; color: #3e6267; background: var(--maze-surface); box-shadow: 5px 5px 11px #b9cbc6, -5px -5px 11px #fafffc, inset 1px 1px 1px rgba(255,255,255,.8); text-decoration: none; transition: transform .16s ease, box-shadow .16s ease; }
.maze-icon-button:hover, .maze-button:hover, .maze-menu-tab:hover { transform: translateY(-2px); }
.maze-icon-button:active, .maze-button:active, .maze-menu-tab:active { transform: translateY(1px); }
.maze-icon-button svg { width: 22px; height: 22px; }
.maze-main { min-height: 0; display: grid; place-items: center; padding: 4px 18px max(18px, env(safe-area-inset-bottom)); }
.maze-play-panel { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto auto; gap: clamp(9px, 1.8vh, 17px); width: min(100%, 620px); height: 100%; min-height: 0; max-height: 760px; padding: clamp(15px, 2.4vh, 24px); border: 1px solid rgba(255,255,255,.65); border-radius: 30px; background: rgba(230,239,235,.7); box-shadow: 16px 20px 40px rgba(75,110,105,.16), -9px -9px 25px rgba(255,255,255,.65), inset 1px 1px 1px #fafffd; }
.maze-panel-top { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.maze-panel-top h2 { margin: 4px 0 0; font: 800 clamp(18px, 3.8vw, 24px)/1.15 "Manrope", sans-serif; letter-spacing: -.055em; }
.maze-swipe-hint, .maze-key-hint { color: var(--maze-muted); font: 800 10px/1.3 "Manrope", sans-serif; letter-spacing: .1em; white-space: nowrap; }
.maze-swipe-hint span { display: inline-grid; place-items: center; margin-left: 3px; font-size: 20px; line-height: .7; color: var(--maze-accent); }
.maze-stats { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 10px; }
.maze-stat { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-width: 0; min-height: 66px; padding: 9px 15px; border: 1px solid rgba(255,255,255,.64); border-radius: 17px; background: #e4eeea; box-shadow: inset 4px 4px 8px rgba(103,135,129,.18), inset -4px -4px 8px rgba(255,255,255,.8); }
.maze-stat span { color: #6d8585; font: 800 9px/1.2 "Manrope", sans-serif; letter-spacing: .14em; }
.maze-stat strong { color: #29464c; font: 800 clamp(18px, 4vw, 24px)/1.1 "Manrope", sans-serif; font-variant-numeric: tabular-nums; }
.maze-stat-time strong { color: var(--maze-accent); }
.maze-stat-time.is-urgent strong { color: #c36b62; }
.maze-board-frame { display: flex; align-items: center; justify-content: center; min-height: 0; padding: 10px; border-radius: 27px; background: #d4e1dd; box-shadow: inset 6px 6px 13px #b6cac4, inset -6px -6px 13px #f9fffb; overflow: hidden; }
.maze-wrapper { flex: 0 0 auto; width: min(100%, 550px); aspect-ratio: 1; overflow: hidden; border: 4px solid #e9f3ef; border-radius: 24px; background: #8baea9; box-shadow: 7px 9px 17px rgba(54,87,84,.26), -3px -3px 7px rgba(255,255,255,.75), inset 0 0 0 1px rgba(37,73,75,.22); }
#maze-canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.maze-bottom-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 24px; }
.maze-message { min-width: 0; margin: 0; color: #365f62; font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.maze-actions { display: grid; grid-template-columns: 1fr 1.3fr; gap: 12px; }
.maze-button { min-height: 50px; padding: 10px 18px; border: 0; border-radius: 16px; font: 800 14px/1.2 "Manrope", sans-serif; transition: transform .16s ease, box-shadow .16s ease; }
.maze-button-quiet { color: #47686c; background: #e4eeea; box-shadow: 5px 5px 10px #bacdc7, -5px -5px 10px #fafffc, inset 1px 1px 1px #fff; }
.maze-button-primary { color: #f6fffa; background: #2f8079; box-shadow: 5px 6px 12px rgba(43,106,101,.32), inset 2px 2px 2px rgba(255,255,255,.23), inset -3px -3px 4px rgba(15,67,65,.25); }
.maze-button-primary.is-complete { background: #166e66; box-shadow: 0 0 0 4px rgba(35,141,126,.14), 5px 6px 12px rgba(43,106,101,.32), inset 2px 2px 2px rgba(255,255,255,.23); }

.maze-modal-layer { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(33,58,61,.5); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.maze-modal { display: grid; grid-template-rows: auto auto minmax(0,1fr); gap: 20px; width: min(100%, 560px); max-height: min(760px, calc(100svh - 32px)); min-height: 300px; padding: 22px; border: 1px solid rgba(255,255,255,.78); border-radius: 28px; background: #e2ede8; box-shadow: 18px 24px 55px rgba(16,48,50,.3), -4px -4px 14px rgba(255,255,255,.18), inset 1px 1px 1px #fff; }
.maze-modal-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.maze-modal-header h2 { margin: 3px 0 0; font: 800 26px/1.1 "Manrope", sans-serif; letter-spacing: -.05em; }
.maze-menu-tabs { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 7px; padding: 6px; border-radius: 18px; background: #d7e4df; box-shadow: inset 4px 4px 8px #b9cbc5, inset -4px -4px 8px #f7fffa; }
.maze-menu-tab { min-height: 40px; padding: 7px 5px; border: 0; border-radius: 12px; color: #60797a; background: transparent; font: 800 12px/1.2 "Manrope", sans-serif; transition: transform .16s ease, background .16s ease; }
.maze-menu-tab.is-active { color: #236d68; background: #eaf4ef; box-shadow: 3px 4px 8px rgba(77,108,101,.2), -2px -2px 5px rgba(255,255,255,.7); }
.maze-modal-body { min-height: 0; overflow-y: auto; padding: 1px 3px 8px; scrollbar-color: #9bb8af transparent; }
.maze-menu-intro { margin: 0 0 16px; color: #5b7575; font-size: 13px; line-height: 1.5; }
.maze-level-list { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.maze-level-list li { min-width: 0; }
.maze-level-btn { display: grid; align-content: space-between; gap: 7px; width: 100%; min-height: 112px; padding: 13px; border: 1px solid rgba(255,255,255,.7); border-radius: 17px; color: #32585c; background: #e5efea; box-shadow: 5px 5px 10px #c0d1ca, -5px -5px 10px #f7fffa; text-align: left; transition: transform .16s ease, box-shadow .16s ease; }
.maze-level-btn:not(:disabled):hover { transform: translateY(-2px); }
.maze-level-btn.active { color: #f4fff8; background: #378a7c; box-shadow: 5px 6px 10px rgba(39,107,98,.28), inset 2px 2px 3px rgba(255,255,255,.2); }
.maze-level-btn.locked { opacity: .46; cursor: not-allowed; box-shadow: inset 3px 3px 6px #b9cac4, inset -3px -3px 6px #fbfffc; }
.maze-level-btn > span:first-child { font: 800 15px/1.2 "Manrope", sans-serif; }
.level-stars { display: flex; min-height: 19px; gap: 3px; align-items: center; }
.level-star::before { content: "★"; color: #a8bdb4; font-size: 17px; line-height: 1; }
.level-star.earned::before { color: #e4ad5c; }
.maze-level-btn.active .level-star:not(.earned)::before { color: rgba(255,255,255,.45); }
.level-time { font-size: 11px; color: inherit; opacity: .72; }
.maze-guide { display: grid; grid-template-columns: 44px minmax(0,1fr); gap: 14px; padding: 19px 0; border-bottom: 1px solid #cbdcd4; }
.maze-guide:first-child { padding-top: 2px; }
.maze-guide:last-child { border-bottom: 0; }
.maze-guide-number { display: grid; place-items: center; width: 39px; height: 39px; border-radius: 13px; color: #247a70; background: #e6f0eb; box-shadow: 3px 3px 7px #c1d1cb, -3px -3px 7px #fff; font: 800 12px "Manrope", sans-serif; }
.maze-guide h3 { margin: 1px 0 5px; font: 800 15px/1.2 "Manrope", sans-serif; }
.maze-guide p { margin: 0; color: #587273; font-size: 13px; line-height: 1.5; }
#maze-tab-account > .maze-button { width: 100%; }
.auth-panel { display: grid; gap: 9px; margin-top: 14px; padding: 16px; border-radius: 17px; background: #d8e6df; box-shadow: inset 4px 4px 8px #baccc3, inset -4px -4px 8px #f7fffa; }
.auth-status { color: #597476; font-size: 13px; }
.auth-panel input { min-height: 43px; width: 100%; padding: 9px 12px; border: 1px solid #c2d3cb; border-radius: 11px; color: var(--maze-ink); background: #f3faf5; font-size: 16px; }
.auth-panel button { min-height: 40px; }

@media (max-width: 520px) {
  .maze-topbar { min-height: 65px; grid-template-columns: 43px minmax(0,1fr) 43px; gap: 8px; padding: 7px 12px; }
  .maze-icon-button { width: 42px; height: 42px; border-radius: 14px; }
  .maze-icon-button svg { width: 20px; height: 20px; }
  .maze-brand-mark { width: 29px; height: 29px; font-size: 16px; }
  .maze-brand-kicker { font-size: 8px; }
  .maze-brand h1 { font-size: 18px; }
  .maze-main { padding: 2px 9px max(10px, env(safe-area-inset-bottom)); }
  .maze-play-panel { gap: 9px; max-height: 650px; padding: 14px; border-radius: 24px; }
  .maze-panel-top h2 { font-size: 18px; }
  .maze-swipe-hint, .maze-key-hint { font-size: 8px; }
  .maze-stats { gap: 6px; }
  .maze-stat { min-height: 58px; padding: 8px 10px; border-radius: 13px; }
  .maze-stat span { font-size: 8px; }
  .maze-stat strong { font-size: 19px; }
  .maze-board-frame { padding: 7px; border-radius: 21px; }
  .maze-wrapper { border-width: 3px; border-radius: 17px; }
  .maze-button { min-height: 46px; border-radius: 13px; }
  .maze-modal { gap: 14px; padding: 16px; border-radius: 23px; }
  .maze-level-list { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-height: 650px) {
  .maze-play-panel { gap: 6px; padding-block: 10px; }
  .maze-stat { min-height: 48px; }
  .maze-panel-top h2 { font-size: 16px; }
  .maze-actions .maze-button { min-height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .maze-icon-button, .maze-button, .maze-menu-tab, .maze-level-btn { transition: none; }
}
