@font-face { font-family: 'Bungee'; src: url('bungee.woff2') format('woff2'); font-display: swap; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #062c48; color: #eafcff; overscroll-behavior: none; }
body { font-family: ui-rounded, 'SF Pro Rounded', 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif; user-select: none; -webkit-user-select: none; touch-action: none; }
#wrap { position: fixed; inset: 0; overflow: hidden; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- HUD ---------- */
#hud { position: absolute; z-index: 5; display: flex; gap: 8px; pointer-events: none; }
#hud > * { pointer-events: auto; }
#hud.top { left: 0; right: 0; top: 0; padding: calc(env(safe-area-inset-top) + 8px) 10px 0; align-items: stretch; height: 64px; }
#hud.side { left: calc(env(safe-area-inset-left) + 10px); top: 10px; bottom: 10px; width: 156px; flex-direction: column; }
.ib { width: 46px; height: 46px; flex: 0 0 auto; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(180deg, rgba(20,80,120,.85), rgba(6,36,66,.9)); border: 2px solid rgba(160,235,255,.35); box-shadow: 0 3px 0 rgba(0,20,40,.45); }
.ib svg { fill: currentColor; stroke: none; }
#bMapBack svg { fill: none; stroke: currentColor; stroke-width: 3; }
.ib:active { transform: translateY(2px); box-shadow: none; }
.hc { flex: 1 1 0; min-width: 0; border-radius: 14px; padding: 4px 10px; display: flex; flex-direction: column; justify-content: center;
  background: linear-gradient(180deg, rgba(10,60,100,.72), rgba(4,30,58,.78)); border: 2px solid rgba(160,235,255,.22); }
.hc b { font-family: 'Bungee', system-ui; font-weight: 400; font-size: 18px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .5px; }
.hc small { font-size: 12px; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.hlev { flex: 1.6 1 0; }
#hud.side .hc { flex: 0 0 auto; padding: 8px 12px; }
#hud.side .hc b { font-size: 20px; }
#hud.side .hlev b { font-size: 17px; }
.hstars { display: flex; align-items: center; justify-content: center; gap: 2px; padding: 0 6px; border-radius: 14px; background: rgba(4,30,58,.6); border: 2px solid rgba(160,235,255,.18); }
#hud.side .hstars { padding: 8px; }
.hstars i, .bigstars i { display: block; width: 18px; height: 18px; background: #ffd34d; clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); transition: opacity .3s, transform .3s, filter .3s; filter: drop-shadow(0 0 4px rgba(255,210,80,.6)); }
.hstars i.off { opacity: .22; filter: none; transform: scale(.85); }
@media (max-width: 420px) { .hc b { font-size: 15px; } .hc small { font-size: 11px; } .hc { padding: 3px 7px; } #hud.top { gap: 6px; padding-left: 8px; padding-right: 8px; } .hstars i { width: 14px; height: 14px; } .ib { width: 42px; height: 42px; } }
@media (max-width: 360px) { .hstars { display: none; } }

/* ---------- overlays ---------- */
.ov { position: absolute; inset: 0; z-index: 10; display: none; align-items: center; justify-content: center; padding: 16px; }
.ov.show { display: flex; animation: ovIn .25s ease-out; }
@keyframes ovIn { from { opacity: 0; } to { opacity: 1; } }
#ovPause, #ovResult { background: rgba(2,18,36,.55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.card { width: min(420px, 100%); max-height: 100%; overflow-y: auto; border-radius: 26px; padding: 22px 20px 16px; text-align: center;
  background: linear-gradient(180deg, rgba(18,92,140,.96), rgba(6,40,78,.97)); border: 3px solid rgba(160,240,255,.45);
  box-shadow: 0 18px 50px rgba(0,10,30,.6), inset 0 2px 0 rgba(255,255,255,.15); animation: pop .35s cubic-bezier(.2,1.6,.4,1); }
@keyframes pop { from { transform: scale(.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
h2 { font-family: 'Bungee', system-ui; font-weight: 400; margin: 0 0 12px; font-size: 30px; letter-spacing: 1px; color: #fff3b8; text-shadow: 0 3px 0 #b5531c, 0 6px 14px rgba(0,0,0,.4); }
.btn { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-height: 50px; padding: 8px 20px; border-radius: 16px; font-weight: 800; font-size: 18px;
  background: linear-gradient(180deg, #2bb3d6, #127aa8); border: 2px solid rgba(200,250,255,.55); box-shadow: 0 4px 0 #0a4a6e, 0 8px 16px rgba(0,0,0,.25); color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,.3); transition: transform .08s, filter .15s; }
.btn small { font-size: 12px; font-weight: 700; opacity: .85; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #0a4a6e; }
.btn.primary { background: linear-gradient(180deg, #ffe066, #ffab1f); color: #5a2a00; text-shadow: 0 1px 0 rgba(255,255,255,.5); border-color: #fff4c2; box-shadow: 0 4px 0 #b4600a, 0 8px 18px rgba(0,0,0,.3); }
.btn.primary:active { box-shadow: 0 1px 0 #b4600a; }
.btn.big { font-family: 'Bungee', system-ui; font-weight: 400; font-size: 26px; min-height: 64px; padding: 8px 40px; letter-spacing: 1px; }
.btn.big small { font-family: ui-rounded, system-ui, sans-serif; font-weight: 800; letter-spacing: 0; }
.btn:focus-visible, .ib:focus-visible, .opt:focus-visible, .tg:focus-visible, .node:focus-visible { outline: 3px solid #fff3b8; outline-offset: 2px; }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.col .row .btn { flex: 1; }

/* title */
#ovTitle { background: radial-gradient(ellipse at 50% 45%, rgba(2,26,50,.62), rgba(2,20,40,.4) 70%); flex-direction: column; }
.titlebox { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.logo { margin: 0; font-family: 'Bungee', system-ui; font-weight: 400; line-height: .9; display: flex; flex-direction: column; align-items: center; }
.logo span { display: block; background: linear-gradient(180deg, #fffbe0 0%, #ffe066 45%, #ff9a1f 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 #0a4a6e) drop-shadow(0 10px 18px rgba(0,20,40,.5)); }
.logo .l1 { font-size: clamp(48px, 13vmin, 110px); }
.logo .l2 { font-size: clamp(58px, 16vmin, 136px); background: linear-gradient(180deg, #e9ffff 0%, #6ff3ff 45%, #1ea6d8 100%); -webkit-background-clip: text; background-clip: text; }
.tag { margin: 0; font-weight: 700; font-size: clamp(15px, 2.4vmin, 19px); text-shadow: 0 2px 6px rgba(0,0,0,.5); }
.toggles { gap: 8px; }
.tg { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 12px; background: rgba(4,30,58,.6); border: 2px solid rgba(160,235,255,.25); font-weight: 700; font-size: 14px; }
.tg.off { opacity: .5; }
.tg.off svg { stroke: #ff9a9a; }
.gclink { position: absolute; bottom: calc(env(safe-area-inset-bottom) + 8px); right: 12px; font-size: 13px; color: rgba(230,250,255,.75); text-decoration: none; font-weight: 700; }
.card .gclink { position: static; display: inline-block; margin-top: 10px; }
.gclink:hover { color: #fff; text-decoration: underline; }
@media (max-height: 520px) { .titlebox { gap: 8px; } .logo { flex-direction: row; gap: 16px; } .logo .l1, .logo .l2 { font-size: clamp(40px, 14vmin, 80px); } .btn.big { min-height: 54px; font-size: 22px; } }

/* pause opts */
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 10px 12px; border-radius: 12px; background: rgba(2,24,48,.5); border: 2px solid rgba(160,235,255,.18); font-weight: 700; font-size: 14px; text-align: left; }
.opt i { flex: 0 0 auto; width: 34px; height: 20px; border-radius: 10px; background: rgba(255,255,255,.2); position: relative; transition: background .2s; }
.opt i::after { content: ''; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; }
.opt.on i { background: #3ddc84; }
.opt.on i::after { transform: translateX(14px); }
.opt em { font-style: normal; color: #ffe066; }
.keys { font-size: 12px; opacity: .7; margin: 12px 0 0; line-height: 1.5; }
@media (max-width: 380px) { .opts { grid-template-columns: 1fr; } }

/* results */
.bigstars { display: flex; justify-content: center; gap: 10px; margin: 4px 0 12px; }
.bigstars i { width: 64px; height: 64px; opacity: .18; filter: none; transform: scale(.7); }
.bigstars i:nth-child(2) { transform: scale(.8) translateY(-10px); width: 76px; height: 76px; }
.bigstars i.on { opacity: 1; filter: drop-shadow(0 0 10px rgba(255,210,80,.9)); animation: star .5s cubic-bezier(.2,1.8,.4,1) both; }
.bigstars i:nth-child(2).on { animation-name: star2; }
@keyframes star { from { transform: scale(2.2) rotate(-40deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }
@keyframes star2 { from { transform: scale(2.4) rotate(40deg) translateY(-10px); opacity: 0; } to { transform: scale(1.05) translateY(-10px); opacity: 1; } }
.lines { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; margin: 0 auto 12px; max-width: 280px; font-weight: 700; text-align: left; }
.lines b { font-family: 'Bungee', system-ui; font-weight: 400; text-align: right; color: #fff3b8; }
.badge { display: inline-block; margin: 0 auto 12px; padding: 4px 14px; border-radius: 20px; background: #ff5d8f; color: #fff; font-weight: 800; animation: wob 1s ease-in-out infinite alternate; }
@keyframes wob { from { transform: rotate(-3deg) scale(1); } to { transform: rotate(3deg) scale(1.08); } }

/* banner + toast */
#banner { position: absolute; z-index: 6; left: 50%; top: 32%; transform: translate(-50%, -50%); pointer-events: none; text-align: center; opacity: 0; transition: opacity .35s, transform .35s; white-space: nowrap; }
#banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
#banner .bt { font-family: 'Bungee', system-ui; font-size: clamp(30px, 7vmin, 56px); color: #fff; text-shadow: 0 4px 0 #0a4a6e, 0 8px 20px rgba(0,0,0,.45); }
#banner .bs { font-weight: 800; font-size: clamp(16px, 3vmin, 22px); margin-top: 4px; padding: 6px 16px; border-radius: 20px; background: rgba(4,30,58,.7); display: inline-block; }
#toast { position: absolute; inset: 0; z-index: 8; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(2,18,36,.35); cursor: pointer; }
.tipcard { display: grid; grid-template-columns: auto 1fr; gap: 10px 14px; align-items: center; width: min(420px, 100%); padding: 16px; border-radius: 22px;
  background: linear-gradient(180deg, rgba(18,92,140,.97), rgba(6,40,78,.98)); border: 3px solid rgba(160,240,255,.5); box-shadow: 0 14px 40px rgba(0,0,0,.45); animation: pop .35s cubic-bezier(.2,1.6,.4,1); }
.tipcard canvas { width: 64px; height: 64px; }
.tipcard b { display: block; font-family: 'Bungee', system-ui; font-weight: 400; color: #fff3b8; font-size: 19px; margin-bottom: 2px; }
.tipcard span { font-size: 15px; font-weight: 600; line-height: 1.35; }
.tipcard .btn { grid-column: 1 / -1; min-height: 44px; }

/* map */
#ovMap { flex-direction: column; padding: 0; background: #06284a; align-items: stretch; justify-content: flex-start; }
.maphead { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; padding: calc(env(safe-area-inset-top) + 10px) 12px 10px; background: linear-gradient(180deg, #0b4d7c, #083a62); border-bottom: 2px solid rgba(160,235,255,.25); z-index: 2; }
.mt { flex: 1; display: flex; flex-direction: column; }
.mt b { font-family: 'Bungee', system-ui; font-weight: 400; font-size: 22px; }
.mt small { font-weight: 700; opacity: .85; }
.buddy { font-size: 12px; font-weight: 700; text-align: right; opacity: .85; max-width: 46%; }
#mapScroll { flex: 1; overflow-y: auto; overflow-x: hidden; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
#mapInner { position: relative; }
.zone { position: relative; padding: 18px 0 10px; }
.zone h3 { position: relative; z-index: 1; margin: 0 auto 4px; text-align: center; font-family: 'Bungee', system-ui; font-weight: 400; font-size: 20px; letter-spacing: .5px; text-shadow: 0 2px 0 rgba(0,0,0,.35); }
.zone h3 small { display: block; font-family: ui-rounded, system-ui, sans-serif; font-size: 13px; font-weight: 700; opacity: .85; }
.zone svg.path { position: absolute; left: 0; top: 0; width: 100%; height: 100%; stroke: none; fill: none; pointer-events: none; }
.node { position: absolute; width: 62px; height: 62px; margin: -31px 0 0 -31px; border-radius: 50%; display: grid; place-items: center; font-family: 'Bungee', system-ui; font-size: 20px; color: #fff;
  background: radial-gradient(circle at 34% 28%, #ffffff 0, #bff4ff 12%, #34c6e6 45%, #0b6a9a 85%, #08466e 100%); border: 3px solid rgba(255,255,255,.7); box-shadow: 0 5px 0 rgba(0,30,60,.45), 0 0 0 4px rgba(0,0,0,.08); text-shadow: 0 2px 0 rgba(0,40,70,.6); }
.node.done { background: radial-gradient(circle at 34% 28%, #ffffff 0, #fff3b8 12%, #ffc933 45%, #e07b12 85%, #9a4a08 100%); }
.node.locked { background: radial-gradient(circle at 34% 28%, #8aa 0, #577 40%, #2d3f4a 100%); color: rgba(255,255,255,.45); border-color: rgba(255,255,255,.25); cursor: default; }
.node.cur { animation: nodePulse 1.2s ease-in-out infinite; }
@keyframes nodePulse { 0%, 100% { box-shadow: 0 5px 0 rgba(0,30,60,.45), 0 0 0 0 rgba(255,240,150,.7); } 50% { box-shadow: 0 5px 0 rgba(0,30,60,.45), 0 0 0 12px rgba(255,240,150,0); } }
.node .st { position: absolute; bottom: -14px; left: 50%; transform: translateX(-50%); display: flex; gap: 1px; }
.node .st i { width: 15px; height: 15px; background: #ffd34d; clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.node .st i.o { background: rgba(0,0,0,.35); }
.node .fishmark { position: absolute; top: -8px; right: -8px; width: 26px; height: 26px; border-radius: 50%; background: #ff8a3d; border: 2px solid #fff; display: grid; place-items: center; }
.node .fishmark svg { width: 16px; height: 16px; fill: #fff; stroke: none; }
.mapend { text-align: center; padding: 26px 16px 40px; font-weight: 700; opacity: .8; }

@media (prefers-reduced-motion: reduce) { .node.cur, .badge { animation: none; } .card { animation: none; } }

@media (max-height: 500px) {
  .card { width: min(680px, 100%); padding: 12px 16px 10px; }
  h2 { font-size: 22px; margin-bottom: 6px; }
  .card.result { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; align-items: center; }
  .card.result h2, .card.result .bigstars, .card.result .lines, .card.result .badge { grid-column: 1; }
  .card.result .col { grid-column: 2; grid-row: 1 / span 4; }
  .bigstars i { width: 40px; height: 40px; } .bigstars i:nth-child(2) { width: 48px; height: 48px; }
  .bigstars { margin: 0 0 6px; }
  .lines { font-size: 14px; margin-bottom: 6px; }
  #ovPause .card { display: grid; grid-template-columns: 1fr 1.4fr; gap: 0 14px; align-items: start; }
  #ovPause .card h2 { grid-column: 1 / -1; }
  #ovPause .opts { margin-top: 0; }
  #ovPause .keys { grid-column: 1 / -1; margin-top: 6px; }
  #ovPause .gclink { grid-column: 1 / -1; margin-top: 4px; }
  #pauseBtns .btn { min-height: 42px; font-size: 16px; }
  .opt { padding: 7px 10px; }
  .btn.big { min-height: 48px; font-size: 20px; }
}
