@import url('https://fonts.googleapis.com/css2?family=Black+Han+Sans&family=DM+Mono:wght@400;500&family=Pretendard:wght@400;500;600;700&display=swap');

:root { --ink:#18213d; --paper:#f8f4ea; --orange:#fa8354; --yellow:#f7c64e; --blue:#83d6e4; --navy:#111a2e; --line:rgba(24,33,61,.16); --block-purple:#9c25cf; --block-blue:#2527d6; --block-yellow:#f4ef19; }
* { box-sizing:border-box; }
html { scroll-behavior:smooth; }
body { margin:0; min-width:320px; color:var(--ink); background:#d6eaf0; font-family:Pretendard,system-ui,sans-serif; }
button { font:inherit; cursor:pointer; }
.game-shell { position:relative; isolation:isolate; min-height:100vh; overflow:hidden; padding:29px clamp(25px,6vw,108px) 22px; background:linear-gradient(145deg,#f9f3e7 0%,#f9f3e7 57%,#f5e4ba 100%); }
.sky-glow { position:absolute; z-index:-1; border-radius:50%; filter:blur(1px); opacity:.72; }
.sky-glow--left { width:420px; height:420px; left:-130px; top:42%; background:#bee6df; }
.sky-glow--right { width:500px; height:500px; right:-180px; top:-250px; background:#f8cf69; opacity:.36; }
.topbar, footer { display:flex; justify-content:space-between; align-items:center; max-width:1440px; margin:auto; }
.brand { display:flex; gap:11px; align-items:center; color:var(--ink); text-decoration:none; font-family:'DM Mono',monospace; font-size:13px; font-weight:500; letter-spacing:.11em; }
.brand-mark { display:grid; grid-template-columns:repeat(2,8px); grid-template-rows:repeat(2,8px); gap:2px; transform:rotate(-2deg); }
.brand-mark i { background:var(--orange); border:1px solid var(--ink); }.brand-mark i:nth-child(2),.brand-mark i:nth-child(4){background:var(--yellow)}
.sound-button { display:flex; align-items:center; gap:8px; padding:9px 13px; border:1px solid var(--line); border-radius:100px; color:var(--ink); background:rgba(255,255,255,.38); font-family:'DM Mono',monospace; font-size:10px; letter-spacing:.08em; transition:.2s; }.sound-button:hover { background:white; transform:translateY(-2px); }.sound-button[aria-pressed=true]{color:#9b4e32}.sound-button span:first-child{font-size:16px}
.hero { display:grid; grid-template-columns:minmax(420px,.9fr) minmax(480px,1.1fr); align-items:center; min-height:calc(100vh - 115px); max-width:1440px; gap:38px; margin:0 auto; }
.hero-copy { padding:50px 0 74px; }.eyebrow { margin:0 0 17px; color:#a9553a; font-family:'DM Mono',monospace; font-weight:500; font-size:12px; letter-spacing:.14em; }
h1 { margin:0; font-family:'Black Han Sans',Pretendard,sans-serif; font-size:clamp(49px,5.25vw,79px); font-weight:400; line-height:1.15; letter-spacing:-.055em; }h1 em { color:var(--orange); font-style:normal; }
.intro { margin:26px 0 29px; color:#4b5365; font-size:16px; line-height:1.8; word-break:keep-all; }.menu-actions { display:flex; gap:11px; }.primary-button,.secondary-button { min-height:51px; padding:0 20px; border-radius:7px; font-weight:700; transition:transform .2s,box-shadow .2s; }.primary-button:hover,.secondary-button:hover { transform:translateY(-3px); box-shadow:0 7px 0 rgba(24,33,61,.13); }.primary-button { display:flex; justify-content:space-between; align-items:center; min-width:176px; border:2px solid var(--ink); color:var(--paper); background:var(--ink); }.primary-button b{font-size:22px}.secondary-button { border:1px solid #b9b4a9; color:var(--ink); background:transparent; }
.menu-actions { flex-wrap:wrap; }
.menu-actions a { text-decoration:none; display:flex; align-items:center; }
.menu-actions .primary-button { min-width:150px; padding-inline:14px; }
.menu-actions .secondary-button { padding-inline:12px; font-size:14px; white-space:nowrap; }
.scene { position:relative; align-self:center; width:100%; min-width:480px; height:min(570px,69vh); border:2px solid var(--ink); border-radius:14px; overflow:hidden; background:linear-gradient(#b4e4eb 0%,#d7eff0 68%,#afdbce 68%); box-shadow:7px 8px 0 rgba(24,33,61,.12); }.scene::before { content:''; position:absolute; inset:0; opacity:.14; background-image:linear-gradient(90deg,var(--ink) 1px,transparent 1px),linear-gradient(var(--ink) 1px,transparent 1px); background-size:30px 30px; }
.sun { position:absolute; width:125px; height:125px; top:9%; right:14%; border:2px solid var(--ink); border-radius:50%; background:var(--yellow); }.cloud{position:absolute;width:92px;height:17px;background:#f9f6ea;border:2px solid var(--ink);border-radius:30px}.cloud::before,.cloud::after{content:'';position:absolute;background:inherit;border:inherit;border-radius:50%}.cloud::before{width:30px;height:30px;bottom:7px;left:17px}.cloud::after{width:22px;height:22px;bottom:6px;right:14px}.cloud--one{left:8%;top:22%}.cloud--two{right:34%;top:29%;transform:scale(.58)}.bird{position:absolute;font-size:31px;line-height:1;color:#4c687a;font-weight:800;transform:rotate(-16deg)}.bird--one{top:19%;left:46%}.bird--two{top:25%;left:50%;transform:rotate(-15deg) scale(.6)}
.falling-blocks { position:absolute; z-index:2; top:7%; left:26%; width:235px; height:255px; animation:float 3.7s ease-in-out infinite; }
.tetromino { position:absolute; display:block; overflow:visible; }
.tetromino rect { fill:var(--tetromino-color); stroke:var(--ink); stroke-width:2; stroke-linejoin:round; shape-rendering:geometricPrecision; }
.tetromino--t { --tetromino-color:#f3a17f; top:0; left:0; width:66px; height:44px; }
.tetromino--j { --tetromino-color:#a69cde; top:52px; left:80px; width:66px; height:44px; transform:rotate(8deg); animation:spin 5s ease-in-out infinite; }
.tetromino--o { --tetromino-color:#8bd2b3; top:114px; left:28px; width:44px; height:44px; transform:rotate(20deg); }
.island { position:absolute; bottom:-1px; width:31%; height:32%; border:2px solid var(--ink); background:#cf8b55; clip-path:polygon(0 30%,15% 15%,44% 22%,61% 0,77% 19%,100% 27%,100% 100%,0 100%); }.island span{position:absolute;inset:0 0 74% 0;background:#588e61;border-bottom:2px solid var(--ink)}.island--left{left:-1%}.island--right{right:-1%; transform:scaleX(-1)}
.bridge { position:absolute; z-index:3; bottom:21%; left:23%; width:360px; height:102px; transform:none; }.bridge-piece { position:absolute; display:block; overflow:visible; fill:var(--piece-color); stroke:var(--ink); stroke-width:2; filter:drop-shadow(3px 3px 0 rgba(24,33,61,.14)); transform-origin:center; }.bridge-piece rect { fill:inherit; stroke:inherit; stroke-width:inherit; shape-rendering:geometricPrecision; }.bridge-piece--i{--piece-color:#32dce0;top:78px;width:90px;height:24px;animation:collapse-i 9s ease-in infinite}.bridge-piece--i-1{left:0}.bridge-piece--i-2{left:90px}.bridge-piece--i-3{left:180px}.bridge-piece--i-4{left:270px}.bridge-piece--o{--piece-color:#f4ef19;left:90px;top:32px;width:46px;height:46px;animation:collapse-o 9s ease-in infinite}.bridge-piece--s{--piece-color:#17dc16;left:136px;top:32px;width:68px;height:46px;animation:collapse-s 9s ease-in infinite}.bridge-piece--z{--piece-color:#f13129;left:204px;top:32px;width:68px;height:46px;animation:collapse-z 9s ease-in infinite}.bridge-piece--l{--piece-color:#f2a21c;left:272px;top:10px;width:46px;height:68px;animation:collapse-l 9s ease-in infinite}.bridge-piece--t{--piece-color:#9c25cf;left:79px;top:-14px;width:68px;height:46px;animation:collapse-t 9s ease-in infinite}.bridge-piece--j{--piece-color:#2527d6;left:204px;top:-36px;width:46px;height:68px;animation:collapse-j 9s ease-in infinite}.bridge-warning{position:absolute;top:-55px;left:155px;padding:5px 8px;border:2px solid var(--ink);border-radius:3px;background:#f7c64e;color:var(--ink);font-family:'DM Mono',monospace;font-size:10px;font-weight:700;opacity:0;animation:overload-warning 9s ease-in infinite}.goal-flag{position:absolute;z-index:4;bottom:31%;right:15%;width:54px;height:79px;border-left:3px solid var(--ink)}.goal-flag span{display:block;width:57px;padding:5px 2px;border:2px solid var(--ink);background:var(--yellow);font-family:'DM Mono',monospace;font-size:9px;font-weight:700;transform:translateY(1px)}.goal-flag i{position:absolute;bottom:0;left:-11px;width:20px;height:9px;border:2px solid var(--ink);border-radius:50%;background:#594333}
.dialog{position:fixed;z-index:10;left:50%;bottom:34px;width:min(440px,calc(100% - 40px));padding:18px 48px 18px 21px;border:2px solid var(--ink);border-radius:9px;background:var(--paper);box-shadow:6px 7px 0 rgba(24,33,61,.2);opacity:0;transform:translate(-50%,30px);pointer-events:none;transition:.25s}.dialog.is-visible{opacity:1;transform:translate(-50%,0);pointer-events:auto}.dialog p{margin:0;font-weight:600;line-height:1.55}.dialog-close{position:absolute;right:9px;top:8px;border:0;background:transparent;color:var(--ink);font-size:24px}.dialog-close:hover{color:var(--orange)}
footer{position:relative;color:#697080;font-family:'DM Mono',monospace;font-size:10px;letter-spacing:.06em}footer span:last-child{opacity:.65}@keyframes float{50%{transform:translateY(13px)}}@keyframes spin{50%{transform:rotate(10deg)}}@keyframes collapse-left{0%,37%{transform:translate(0,0) rotate(0);opacity:1}44%{transform:translate(-4px,4px) rotate(-3deg);opacity:1}59%,100%{transform:translate(-24px,160px) rotate(-57deg);opacity:0}}@keyframes collapse-o{0%,39%{transform:translate(0,0) rotate(0);opacity:1}47%{transform:translate(8px,8px) rotate(7deg);opacity:1}63%,100%{transform:translate(45px,168px) rotate(47deg);opacity:0}}@keyframes collapse-middle{0%,40%{transform:translate(0,0) rotate(0);opacity:1}48%{transform:translate(11px,8px) rotate(5deg);opacity:1}65%,100%{transform:translate(74px,175px) rotate(56deg);opacity:0}}@keyframes collapse-t{0%,42%{transform:translate(0,0) rotate(0);opacity:1}50%{transform:translate(9px,17px) rotate(9deg);opacity:1}67%,100%{transform:translate(90px,190px) rotate(78deg);opacity:0}}@keyframes collapse-l{0%,43%{transform:translate(0,0) rotate(0);opacity:1}51%{transform:translate(16px,24px) rotate(11deg);opacity:1}69%,100%{transform:translate(110px,207px) rotate(94deg);opacity:0}}@keyframes collapse-right{0%,44%{transform:translate(0,0) rotate(0);opacity:1}52%{transform:translate(18px,28px) rotate(14deg);opacity:1}71%,100%{transform:translate(133px,220px) rotate(116deg);opacity:0}}@keyframes overload-warning{0%,37%{opacity:0;transform:translateY(0)}42%,51%{opacity:1;transform:translateY(-7px)}58%,100%{opacity:0;transform:translateY(5px)}}
@keyframes collapse-i{0%,43%{transform:translate(0,0) rotate(0);opacity:1}51%{transform:translate(-2px,5px) rotate(-4deg);opacity:1}67%,100%{transform:translate(-30px,150px) rotate(-58deg);opacity:0}}@keyframes collapse-o{0%,44%{transform:translate(0,0) rotate(0);opacity:1}52%{transform:translate(5px,9px) rotate(6deg);opacity:1}69%,100%{transform:translate(32px,163px) rotate(41deg);opacity:0}}@keyframes collapse-j{0%,45%{transform:translate(0,0) rotate(0);opacity:1}53%{transform:translate(7px,12px) rotate(8deg);opacity:1}71%,100%{transform:translate(57px,181px) rotate(69deg);opacity:0}}@keyframes collapse-t{0%,46%{transform:translate(0,0) rotate(0);opacity:1}54%{transform:translate(10px,18px) rotate(10deg);opacity:1}73%,100%{transform:translate(80px,195px) rotate(90deg);opacity:0}}@keyframes collapse-s{0%,47%{transform:translate(0,0) rotate(0);opacity:1}55%{transform:translate(13px,23px) rotate(12deg);opacity:1}75%,100%{transform:translate(102px,207px) rotate(108deg);opacity:0}}@keyframes collapse-z{0%,48%{transform:translate(0,0) rotate(0);opacity:1}56%{transform:translate(17px,28px) rotate(15deg);opacity:1}77%,100%{transform:translate(123px,218px) rotate(124deg);opacity:0}}@keyframes collapse-l{0%,49%{transform:translate(0,0) rotate(0);opacity:1}57%{transform:translate(19px,31px) rotate(18deg);opacity:1}79%,100%{transform:translate(140px,224px) rotate(139deg);opacity:0}}@keyframes overload-warning{0%,40%{opacity:0;transform:translateY(0)}45%,54%{opacity:1;transform:translateY(-7px)}61%,100%{opacity:0;transform:translateY(5px)}}
@media (max-width:940px){.game-shell{padding:22px 28px}.hero{grid-template-columns:1fr;min-height:0;gap:0}.hero-copy{padding:72px 0 38px}.scene{min-width:0;height:480px;margin-bottom:42px}.bridge{left:24%;transform:scale(.85);transform-origin:left bottom}}
@media (max-width:560px){.game-shell{padding:18px 19px}.brand{font-size:10px}.sound-label{display:none}.hero-copy{padding:54px 0 33px}h1{font-size:47px}.intro{font-size:14px;line-height:1.7}.intro br{display:none}.menu-actions{flex-direction:column}.menu-actions button{width:100%}.scene{height:360px;border-radius:10px}.sun{width:87px;height:87px}.falling-blocks{left:17%;transform:scale(.72)}.bridge{left:18%;bottom:17%;transform:scale(.53)}.goal-flag{right:13%;bottom:27%;transform:scale(.75)}.island{height:30%;width:35%}footer{font-size:8px}.cloud--two,.bird--two{display:none}}

/* Match the reference layout while keeping the original on-screen cell size. */
.scene { background: linear-gradient(#b4e4eb 0%, #d7eff0 100%); }
.island {
  z-index: 4;
  display: block;
  bottom: 10%;
  width: 40%;
  height: 22%;
  border: 0;
  background: none;
  clip-path: none;
  overflow: visible;
}
.island--left { left: -2%; }
.island--right { right: 4%; width: 42%; }
.island-rock { fill: #c98555; }
.island-grass { fill: #588e61; }
.island-grass-edge,
.island-outline {
  fill: none;
  stroke: var(--ink);
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.island-grass-edge { stroke-width: 2; }
.island-outline { stroke-width: 3; }
.bridge {
  z-index: 3;
  top: 68%;
  bottom: auto;
  left: 24%;
  width: 42%;
  height: auto;
  aspect-ratio: 264 / 88;
  transform: translateY(-100%);
  overflow: visible;
}
.bridge-blocks { display: block; width: 100%; height: 100%; overflow: visible; }
.bridge-block {
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linejoin: round;
}
.bridge-block--i { fill: #20d7dc; }
.bridge-block--j { fill: var(--block-blue); }
.bridge-block--o { fill: var(--block-yellow); }
.bridge-block--s { fill: #a9da17; }
.bridge-block--t { fill: var(--block-purple); }
.bridge-block { cursor: pointer; }
.bridge-block:focus { outline: none; }
.bridge.is-collapsing .bridge-block { cursor: default; }
.bridge-burst { opacity: 0; fill: none; stroke: #fff7ba; stroke-width: 5; stroke-linecap: round; pointer-events: none; }
.bridge-burst circle { transform-box: fill-box; transform-origin: center; }
.bridge.is-collapsing .bridge-burst { opacity: 1; }
.bridge.is-collapsing .bridge-burst circle { animation: burst-ring .6s ease-out both; }
.bridge.is-collapsing .bridge-burst path { animation: burst-rays .5s ease-out both; }
@keyframes burst-ring { from { transform: scale(.35); opacity: 1; } to { transform: scale(2.5); opacity: 0; } }
@keyframes burst-rays { 0% { opacity: 1; stroke-width: 7; } 100% { opacity: 0; stroke-width: 1; } }
.goal-flag {
  z-index: 5;
  right: 15%;
  bottom: calc(32% - 3px);
  transform: none;
}
@media (max-width: 560px) {
  .island { width: 40%; height: 22%; bottom: 10%; }
  .island--right { width: 42%; }
  .bridge { top: 68%; left: 24%; width: 42%; transform: translateY(-100%); }
  .goal-flag { right: 13%; bottom: calc(32% - 3px); transform: scale(.75); transform-origin: bottom center; }
}

/* Keep the drifting blocks behind the bridge while reusing its pieces. */
.falling-blocks { top: 13%; left: 31%; width: 165px; height: 180px; }
@media (max-width: 560px) {
  .falling-blocks { top: 12%; left: 25%; scale: .8; transform: none; }
}

.menu-actions .profile-menu-button { display: flex; align-items: center; gap: 7px; }
.profile-menu-button img { object-fit: contain; }
.menu-dialog {
  width: min(540px,calc(100% - 28px));
  max-height: calc(100dvh - 28px);
  padding: clamp(16px,4vw,28px);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 18px 60px #0d263b4d;
}
.menu-dialog::backdrop { background: #1025388c; }
.menu-dialog > header,.menu-dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.menu-dialog h2 { margin: 0; font-size: clamp(22px,6vw,29px); }
.menu-close {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 22px;
}
.match-choices,.menu-profiles {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 12px;
  margin: 20px 0 0;
}
.match-choices a {
  display: grid;
  gap: 6px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
}
.match-choices a:hover { border-color: var(--green); }
.match-choices strong { color: var(--green); font-size: 18px; }
.match-choices span,.menu-dialog-actions p { color: var(--muted); font-size: 13px; }
.menu-profiles fieldset {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 10px 12px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
}
.menu-profiles legend { padding: 0 5px; font-weight: 700; }
.menu-profiles img { justify-self: center; object-fit: contain; }
.menu-profiles label { display: grid; gap: 4px; font-size: 13px; }
.menu-profiles :is(input,select) {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.menu-dialog-actions { margin-top: 16px; }
.menu-dialog-actions p { margin: 0; }
.menu-dialog-actions .primary-button { min-width: 0; min-height: 40px; }
@media(max-width:400px) {
  .match-choices { grid-template-columns: 1fr; }
  .menu-profiles { gap: 7px; }
  .menu-profiles fieldset { padding-inline: 8px; }
}

.brand svg.brand-mark { display: block; width: 42px; height: 35px; flex: none; transform: none; }
