.maze-hero { padding-block: 3rem 2rem; }
.maze-hero h1 { font-size: clamp(2.8rem, 6vw, 4.5rem); }
.maze-studio { max-width: 1200px; margin: auto; padding: 2rem 1.25rem 4rem; }
.maze-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.maze-toolbar h2 { font: 2rem/1.2 var(--serif); margin: .5rem 0; }
.maze-options { display: flex; flex-wrap: wrap; gap: .6rem; }
.maze-page button, .maze-primary { border: 1px solid #b7a783; background: #fffaf0; padding: .7rem 1rem; border-radius: 24px; font: inherit; cursor: pointer; color: #29483e; }
.maze-page button:hover { background: #f5e4bd; }
#instructions { max-width: 780px; color: #625f50; font-size: .95rem; margin: 1rem 0 2rem; }
.maze-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3rem); align-items: start; }
.maze-play { min-width: 0; }
.maze-endpoints { display: flex; justify-content: space-between; gap: 1rem; font-size: .78rem; margin-bottom: .75rem; }
.maze-board { position: relative; background: #fff8df; border-radius: 18px; overflow: hidden; box-shadow: 0 12px 40px #29483e15; }
#maze { display: block; width: 100%; height: auto; touch-action: none; }
#maze:focus-visible { outline: 4px solid #bb7a25; outline-offset: -4px; }
#fireworks { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#game-status { min-height: 1.5em; text-align: center; font-size: .9rem; margin: 1rem 0; }
.maze-pad { display: grid; grid-template-columns: repeat(3, 54px); grid-template-rows: repeat(2, 48px); justify-content: center; gap: 5px; }
.maze-pad button { padding: 0; border-radius: 12px; font-size: 1.6rem; touch-action: none; user-select: none; }
.maze-pad [data-direction="up"] { grid-column: 2; }
.maze-pad [data-direction="left"] { grid-row: 2; grid-column: 1; }
.maze-pad [data-direction="down"] { grid-row: 2; grid-column: 2; }
.maze-pad [data-direction="right"] { grid-row: 2; grid-column: 3; }
.maze-print { max-width: 650px; margin: 1rem auto 0; background: #fffaf1; border: 1px solid #daceb6; padding: 1.4rem; border-radius: 18px; }
.maze-print img { display: block; width: 100%; height: auto; border-radius: 8px; margin-bottom: 1.5rem; }
.maze-print h2 { font: 1.8rem/1.2 var(--serif); }
.maze-print p { color: #625f50; }
.maze-primary { display: inline-block; background: #294f43; color: #fffaf0; text-decoration: none; text-align: center; font-size: .88rem; }
.maze-print-link { display: block; margin-top: 1rem; font-size: .85rem; text-underline-offset: 4px; }
.maze-small { font-size: .78rem; }
.maze-celebration { text-align: center; margin-top: 1.5rem; padding: 1.5rem; background: #e5eddf; border: 1px solid #b5c99d; border-radius: 16px; }
.maze-celebration[hidden] { display: none; }
.maze-celebration h3 { font: 2.2rem/1.2 var(--serif); margin: 0; }
.maze-back { display: inline-block; margin-top: 2.5rem; text-underline-offset: 4px; }
.maze-page a:focus-visible, .maze-page button:focus-visible { outline: 3px solid #bb7a25; outline-offset: 4px; }
@media (max-width: 800px) { .maze-layout { grid-template-columns: 1fr; }.maze-print { max-width: 480px; margin: 1rem auto 0; }.maze-print img { max-width: 280px; margin-inline: auto; } }
@media print { .site-header, .site-footer, .maze-hero, .maze-toolbar, #instructions, .maze-play, .maze-back, .maze-print > :not(img) { display: none !important; }.maze-layout { display: block; }.maze-print { border: 0; padding: 0; max-width: none; }.maze-print img { max-width: 100%; } }

.maze-board { overflow-x: auto; }
#maze, #fireworks { min-width: 0; }
.maze-print img { max-width: 260px; margin-inline: auto; }
#new-maze { background: #294f43; color: #fffaf0; }

.maze-board { overflow: hidden; border: 1px solid #b8c6ae; }
.maze-gamebar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 1rem; background: #244b40; color: #fff5db; }
.maze-gamebar .maze-options { gap: .5rem; }
.maze-gamebar button { font-size: .85rem; padding: .6rem 1rem; border: 1px solid #f0d69a; background: #fff5db; color: #244b40; box-shadow: 0 3px 0 #102b24; }
.maze-gamebar #new-maze { background: #edc468; color: #243b32; font-weight: 700; }
.maze-gamebar button:active { transform: translateY(2px); box-shadow: 0 1px 0 #102b24; }
.maze-scoreboard { display: flex; align-items: center; gap: .65rem; flex-shrink: 0; }
.maze-scoreboard strong { font: 2rem/1 var(--serif); color: #f7d88d; font-variant-numeric: tabular-nums; }
.maze-scoreboard span { max-width: 70px; font-size: .72rem; line-height: 1.3; }
.maze-view { position: relative; }
.maze-view #fireworks { z-index: 2; }
.maze-score-note { font-size: .8rem; color: #626753; margin: .75rem 0; }
.maze-view .maze-celebration { position: absolute; z-index: 1; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(88%, 390px); margin: 0; padding: clamp(.8rem, 2vw, 1.8rem); background: #fff9eaf5; box-shadow: 0 10px 50px #183c3650; border: 2px solid #d6ae56; }
.maze-view .maze-celebration h3 { font-size: clamp(1.3rem, 3vw, 2.4rem); }
.maze-view .maze-celebration p { font-size: .9rem; margin: .7rem 0; }
#victory-score { font-weight: 700; color: #365c43; }
@media (max-width: 500px) {
  .maze-gamebar { padding: .65rem; gap: .5rem; }
  .maze-gamebar button { padding: .5rem .65rem; font-size: .75rem; }
  .maze-scoreboard { gap: .35rem; }.maze-scoreboard strong { font-size: 1.6rem; }.maze-scoreboard span { font-size: .6rem; max-width: 52px; }
  .maze-view .maze-celebration p { margin: .35rem 0; font-size: .75rem; }
  .maze-view .maze-celebration button { padding: .4rem .7rem; font-size: .8rem; }
}
.maze-community { padding: clamp(1.25rem, 3vw, 2.5rem); background: #fffaf1; border: 1px solid #daceb6; border-radius: 18px; }
.community-intro { max-width: 720px; margin-bottom: 1.8rem; }
.community-intro h2 { font: clamp(1.8rem, 3vw, 2.5rem)/1.2 var(--serif); }
.community-intro p, .community-player p, #leaderboard-note { color: #625f50; font-size: .9rem; }
.community-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3.5rem); }
.community-player h3, .community-leaders h3 { font: 1.6rem/1.2 var(--serif); margin: 0 0 .8rem; overflow-wrap: anywhere; }
.community-player label { display: block; font-size: .85rem; margin: .8rem 0 .4rem; }
.community-player input:not([type=checkbox]) { width: 100%; min-height: 44px; padding: .7rem; border: 1px solid #a9b5a3; border-radius: 8px; font: inherit; background: white; color: #29483e; }
.community-player input:focus-visible { outline: 3px solid #bb7a25; outline-offset: 2px; }
.community-player .community-consent { display: flex; align-items: flex-start; gap: .6rem; margin: 1rem 0; }
.community-consent input { flex-shrink: 0; width: 20px; height: 20px; accent-color: #294f43; }
.community-player button[type=submit] { background: #294f43; color: #fffaf0; margin-top: .6rem; }
.community-player details { margin-top: 1.2rem; }
.community-player summary { cursor: pointer; text-underline-offset: 4px; font-size: .85rem; }
#community-status { margin-top: 1.5rem; padding: .8rem 1rem; border-left: 3px solid #ba974c; background: #f3ecd9; }
.leaderboard-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.leaderboard-heading button { font-size: .8rem; padding: .5rem .8rem; }
.leaderboard-table { overflow-x: auto; }
.leaderboard-table table { border-collapse: collapse; width: 100%; font-size: .9rem; }
.leaderboard-table th { text-align: left; color: #48634e; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; }
.leaderboard-table td, .leaderboard-table th { padding: .8rem .5rem; border-bottom: 1px solid #ddd7c5; overflow-wrap: anywhere; }
.leaderboard-table td:last-child, .leaderboard-table th:last-child { text-align: right; }
.leaderboard-table tr.is-you { background: #e7efdc; font-weight: 700; }
#player-panel[hidden], #join-panel[hidden] { display: none; }
.maze-page button:disabled { opacity: .55; cursor: wait; }
.maze-gamebar { flex-wrap: wrap; }
.maze-options button { min-height: 44px; }
.maze-screen-open { overflow: hidden; }
.maze-play.is-expanded { position: fixed; inset: 0; z-index: 10000; width: 100%; height: 100dvh; margin: 0; padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); background: #f8f1df; display: flex; flex-direction: column; gap: .4rem; }
.maze-play.is-expanded .maze-endpoints { display: none; }
.maze-play.is-expanded .maze-board { flex: 1; display: flex; flex-direction: column; min-height: 0; box-shadow: none; }
.maze-play.is-expanded .maze-view { flex: 1; min-height: 0; }
.maze-play.is-expanded #maze, .maze-play.is-expanded #fireworks { width: 100%; height: 100%; object-fit: contain; }
.maze-play.is-expanded #game-status { margin: .15rem 0; font-size: .75rem; }
.maze-play.is-expanded .maze-pad { flex-shrink: 0; grid-template-rows: repeat(2, 44px); }
.maze-play:fullscreen { max-width: none; }
@media (max-width: 650px) {
  .community-grid { grid-template-columns: 1fr; }
  .maze-studio { padding-inline: .75rem; }
  .maze-gamebar { padding: .6rem; gap: .65rem; }
  .maze-gamebar .maze-options { gap: .4rem; flex: 1; }
  .maze-gamebar button { font-size: .75rem; padding: .5rem .7rem; }
  .maze-scoreboard span { max-width: 55px; }
}
@media (orientation: landscape) and (max-height: 600px) {
  .maze-play.is-expanded { display: grid; grid-template-columns: minmax(0, 1fr) 132px; grid-template-rows: 1fr auto; align-items: center; gap: .4rem .65rem; }
  .maze-play.is-expanded .maze-board { grid-row: 1 / 3; height: 100%; }
  .maze-play.is-expanded .maze-pad { grid-column: 2; grid-row: 1; grid-template-columns: repeat(3, 40px); align-self: end; }
  .maze-play.is-expanded #game-status { grid-column: 2; grid-row: 2; align-self: start; }
  .maze-play.is-expanded .maze-gamebar { padding: .4rem .6rem; }
  .maze-play.is-expanded .maze-gamebar button { min-height: 36px; font-size: .72rem; padding: .35rem .65rem; }
}
/* Explorer dashboard */
.maze-community { padding: 0; overflow: hidden; border: 1px solid #ccd4c4; border-radius: 20px; background: #edf1e8; box-shadow: 0 10px 35px #203e3410; }
.community-intro { max-width: none; margin: 0; padding: clamp(1.3rem, 3vw, 2rem); background: #203f35; color: #fff7e2; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.maze-community .community-intro .eyebrow { color: #e5c77f; font-size: .65rem; margin: 0 0 .55rem; }
.community-intro h2 { font: 650 clamp(1.8rem, 3vw, 2.5rem)/1.15 var(--sans); margin: 0; letter-spacing: -.04em; }
.community-intro p:last-child { color: #cfdacf; margin: .5rem 0 0; font-size: .88rem; }
.community-season { flex-shrink: 0; padding: .65rem .9rem; border: 1px solid #7c8f6c; border-radius: 7px; color: #eed494; font-size: .65rem; letter-spacing: .12em; font-weight: 700; }
.community-grid { grid-template-columns: minmax(260px, .85fr) minmax(0, 1.5fr); gap: 1.25rem; padding: clamp(.9rem, 2vw, 1.5rem); align-items: start; }
.community-player, .community-leaders { min-width: 0; background: #fffdf7; border: 1px solid #d9dfd1; border-radius: 13px; overflow: hidden; }
.player-card-heading { display: flex; align-items: center; gap: .85rem; padding: 1.15rem 1.25rem; background: #f2eddf; border-bottom: 1px solid #e4dcc9; }
.player-emblem { display: grid; place-items: center; width: 43px; height: 43px; flex-shrink: 0; border-radius: 12px; color: #fff8df; background: #355d45; font: italic 1.8rem var(--serif); box-shadow: inset 0 0 0 3px #ffffff18; }
.dashboard-label { display: block; color: #75806a; font-size: .6rem; font-weight: 750; letter-spacing: .12em; line-height: 1.5; }
.community-player .player-card-heading h3 { font: 700 1rem/1.3 var(--sans); margin: .2rem 0 0; color: #2c4739; }
#join-panel, #player-panel { padding: 1.25rem; }
.community-player p.join-tagline { margin: 0 0 1rem; color: #314d3c; font-size: .88rem; }
.community-player label { font-weight: 650; font-size: .78rem; }
.community-player input:not([type=checkbox]) { border-color: #c4cebc; border-radius: 8px; background: #fbfcf6; font-size: .9rem; }
.community-player .field-hint { font-size: .72rem; line-height: 1.5; margin: .4rem 0 .9rem; color: #79806f; }
.community-player .community-consent { font-size: .75rem; font-weight: 400; line-height: 1.5; gap: .65rem; }
.community-player #join-player { width: 100%; display: flex; align-items: center; justify-content: space-between; font-size: .85rem; font-weight: 700; border: 0; border-radius: 8px; padding: .85rem 1rem; }
.community-player p.join-footnote { text-align: center; font-size: .65rem; margin: .7rem 0 0; color: #777c6e; }
.community-player details { border-top: 1px solid #e4e7dc; padding-top: .9rem; margin-top: 1rem; }
.community-player summary { font-size: .75rem; color: #52624c; }
.community-player details p { font-size: .75rem; }
.community-player details button { font-size: .75rem; border-radius: 8px; }
#community-status { font-size: .73rem; line-height: 1.5; margin: 0; padding: .9rem 1.25rem; border: 0; border-top: 1px solid #e3e8d9; background: #f1f5e9; color: #54644b; }
.player-identity { margin-bottom: 1.2rem; }
.community-player .player-identity h3 { margin: .35rem 0 .6rem; font: 750 1.3rem/1.25 var(--sans); color: #294b38; }
.player-saved { display: inline-block; font-size: .65rem; padding: .25rem .5rem; color: #3f6746; background: #e8f0df; border-radius: 5px; }
.player-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; margin-bottom: .8rem; }
.player-stat-grid > div { display: flex; flex-direction: column; padding: .9rem .75rem; background: #f0f3e9; border: 1px solid #e1e6d8; border-radius: 9px; }
.player-stat-grid .dashboard-label { font-size: .55rem; letter-spacing: .07em; }
.player-stat-grid strong { color: #294d39; font: 750 2.3rem/1.3 var(--sans); font-variant-numeric: tabular-nums; }
.player-stat-grid > div > span:last-child { font-size: .6rem; color: #727d66; }
.player-stat-grid .player-best-stat { background: #fcf2d8; border-color: #eddcb2; }
.player-best-stat strong { color: #8a6724; }
.leaderboard-heading { padding: 1.3rem 1.3rem .55rem; }
.community-leaders h3 { font: 750 1.2rem/1.3 var(--sans); margin: .25rem 0; color: #2a4938; letter-spacing: -.025em; }
.leaderboard-heading button { border-radius: 7px; border-color: #d8dfcd; background: #f5f7ef; font-size: .72rem; padding: .5rem .65rem; min-height: 36px; }
#leaderboard-note { margin: 0; padding: 0 1.3rem 1.2rem; font-size: .73rem; color: #7b826f; }
.leaderboard-table { max-height: 530px; overflow: auto; }
.leaderboard-table table { table-layout: fixed; font-size: .85rem; }
.leaderboard-table th { background: #e9eee2; color: #5c6b51; position: sticky; top: 0; font-size: .62rem; letter-spacing: .1em; padding: .8rem 1.1rem; border: 0; }
.leaderboard-table th:first-child { width: 70px; }
.leaderboard-table th:last-child { width: 95px; }
.leaderboard-table td { height: 56px; padding: .85rem 1.1rem; border-bottom: 1px solid #eef0e7; color: #41563c; }
.leaderboard-table td:first-child:not([colspan]) { font-weight: 800; color: #88917d; }
.leaderboard-table td:last-child:not([colspan]) { font-weight: 750; font-variant-numeric: tabular-nums; color: #294d39; }
.leaderboard-table td[colspan] { height: 170px; padding: 2rem; text-align: center; font-size: .85rem; line-height: 1.7; color: #7b846e; }
.leaderboard-table tr:nth-child(even) { background: #f8faf3; }
.leaderboard-table tr.rank-1 td:first-child { color: #a87a24; }
.leaderboard-table tr.rank-2 td:first-child { color: #6c8390; }
.leaderboard-table tr.rank-3 td:first-child { color: #a2764c; }
.leaderboard-table tr.is-you { background: #e4eed7; box-shadow: inset 3px 0 #5e824a; }
.leaderboard-footer { display: flex; align-items: center; gap: .5rem; padding: 1rem 1.3rem; background: #f5f7ef; color: #7a846d; font-size: .65rem; line-height: 1.5; border-top: 1px solid #e8ecdf; }
.leaderboard-dot { flex-shrink: 0; width: 6px; height: 6px; border-radius: 50%; background: #8b9d71; }
@media (max-width: 780px) { .community-grid { grid-template-columns: 1fr; }.community-season { display: none; } }
@media (max-width: 400px) { .leaderboard-table th, .leaderboard-table td { padding-inline: .75rem; }.leaderboard-table th:first-child { width: 55px; }.leaderboard-table th:last-child { width: 75px; }.leaderboard-heading { padding-inline: 1rem; }.community-leaders h3 { font-size: 1.05rem; } }