@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700;800&family=Noto+Sans+KR:wght@400;500;600;700;800;900&display=swap');
:root{color-scheme:dark;--bg:#061b30;--panel:#0b2943;--line:#2a5368;--text:#f2f8f4;--muted:#b2cbd2;--lime:#d8f18f}
*{box-sizing:border-box}html{background:var(--bg)}body{margin:0;background:radial-gradient(circle at 50% -5%,#16415d 0,#09243d 42%,#061b30 100%);color:var(--text);font-family:"DM Sans","Noto Sans KR",system-ui,sans-serif;min-height:100vh}
button{font:inherit;cursor:pointer}button:focus-visible,a:focus-visible{outline:3px solid var(--lime);outline-offset:3px}
.app{width:min(100%,680px);margin:auto;padding:18px 16px 26px}.topbar{display:flex;justify-content:space-between;align-items:center;margin-bottom:19px}.brand{display:flex;align-items:center;gap:11px}.brand-mark{width:42px;height:42px;display:grid;place-items:center;border:2px solid var(--lime);border-radius:13px;color:var(--lime);font-size:26px;font-weight:900;line-height:1;transform:rotate(-8deg)}.brand strong{display:block;font-size:23px;font-weight:900;letter-spacing:-1px;line-height:1.15}.brand small{display:block;margin-top:4px;font-size:9px;font-weight:800;letter-spacing:1.3px;color:#81b7bc}.top-actions{display:flex;gap:7px}.icon-button{width:39px;height:39px;border:1px solid #467088;border-radius:11px;background:#173b52;color:#e5f3ed;font-size:19px;font-weight:800}.icon-button:disabled{opacity:.45;cursor:default}
.hud{display:grid;grid-template-columns:1.1fr .9fr 1fr .82fr;gap:6px;margin-bottom:12px}.stat{background:#0e314b;border:1px solid #2b5469;border-radius:12px;min-width:0;padding:9px 7px 10px;text-align:center;box-shadow:inset 0 1px #ffffff0b}.stat span{display:block;color:#a4c0c9;font-size:10px;font-weight:700;white-space:nowrap}.stat strong{display:block;margin-top:3px;color:#f5f8ea;font-size:14px;font-weight:900;letter-spacing:-.5px;white-space:nowrap}.stat small{display:block;color:#b9d5d9;font-size:9px;font-weight:800;line-height:1}.stat:last-child strong{font-size:13px;color:var(--lime);letter-spacing:1px}.stat:last-child strong.danger{color:#ff8290}
.game-shell{background:#0e314b;border:1px solid #38627b;border-radius:19px;overflow:hidden;box-shadow:0 16px 50px #0004, inset 0 1px #ffffff21}.map-heading{height:36px;display:flex;align-items:center;gap:7px;padding:0 13px;color:#dcefe6;font-size:12px;font-weight:800;letter-spacing:.1px}.live-dot{width:7px;height:7px;border-radius:50%;background:var(--lime);box-shadow:0 0 0 3px #d8f18f29}.map-scale{margin-left:auto;font-size:10px;color:#a8c8ce;font-weight:600}
.board-wrap{position:relative;width:100%;aspect-ratio:400/560;overflow:hidden;background:#0a2b47}.board-wrap svg{width:100%;height:100%;display:block;touch-action:none;user-select:none}.board-wrap.flash{animation:flash .42s ease-out}@keyframes flash{0%,50%{box-shadow:inset 0 0 0 1000px #ff627a45}100%{box-shadow:none}}
.map-coord{font-size:8px;font-weight:700;letter-spacing:1.8px;fill:#8db7bd;opacity:.55}.island-glow{fill:var(--island);opacity:.13;filter:url(#glow)}.dock-outer{fill:#08263c;stroke:var(--island);stroke-width:2.5;stroke-dasharray:3 3}.island-core{fill:#173e51;stroke:var(--island);stroke-width:1.5}.island-connector{stroke:var(--island);stroke-width:1.2;opacity:.6}.island-name{fill:#fff;font-size:16px;font-weight:900;paint-order:stroke;stroke:#09293d;stroke-width:3px}.island-point{fill:#c2d8db;font-size:10px;font-weight:700;paint-order:stroke;stroke:#09293d;stroke-width:2px}
.route-halo,.draft-halo{fill:none;stroke-width:10;stroke-opacity:.14;stroke-linecap:round;stroke-linejoin:round}.route,.draft{fill:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:round}.route{stroke-dasharray:7 6;opacity:.9}.draft{stroke-width:3.5;stroke-dasharray:1 0}.boat-halo{fill:var(--boat);opacity:.16}.boat-disc{fill:#102b42;stroke:var(--boat);stroke-width:2.8}.boat-icon{fill:var(--boat)}.boat-tag-bg{fill:#082439;stroke:var(--boat);stroke-width:1}.boat-tag{font-size:11px;font-weight:900;fill:#fff}.boat.selected .boat-halo{opacity:.4}
.hazard{pointer-events:none}.hazard-buffer{fill:var(--hazard);opacity:.09;stroke:var(--hazard);stroke-width:1;stroke-dasharray:4 5;stroke-opacity:.65}.hazard-core{fill:#573d3eaa;stroke:var(--hazard);stroke-width:2.5;stroke-dasharray:5 3}.hazard-symbol{fill:#fff0d7;font-size:24px;font-weight:900}.hazard-label{fill:#ffe8d5;font-size:10px;font-weight:900;paint-order:stroke;stroke:#09293d;stroke-width:3px}.crossing-warning{pointer-events:none}.crossing-pulse{fill:#ffd681;opacity:.16}.crossing-core{fill:#59492a;stroke:#ffe293;stroke-width:2}.crossing-mark{fill:#fff;font-size:14px;font-weight:900}.crossing-warning.danger .crossing-pulse{fill:#ff5576;opacity:.28}.crossing-warning.danger .crossing-core{fill:#a62944;stroke:#ff8395}.draft.invalid{stroke:#ff627d;stroke-dasharray:7 5}
.board-overlay{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;padding:20px;background:linear-gradient(180deg,#051b2aa8,#051b2ad6);backdrop-filter:blur(2px)}.board-overlay[hidden]{display:none}.overlay-card{width:min(100%,315px);background:#10364e;border:1px solid #6690a0;border-radius:21px;padding:23px 22px 20px;box-shadow:0 15px 45px #03111b9c,inset 0 1px #ffffff33;text-align:left}.eyebrow{color:var(--lime);font-size:11px;font-weight:900;letter-spacing:1.5px;text-transform:uppercase}.overlay-card h1{font-size:30px;line-height:1.3;letter-spacing:-1.7px;margin:10px 0 13px;font-weight:900}.overlay-card h1 em{font-style:normal;color:var(--lime)}.overlay-card p{color:#d0e1e2;line-height:1.7;font-size:13px;margin:0 0 21px;word-break:keep-all}.overlay-card small{display:block;margin-top:13px;color:#a6c0c7;font-size:10px;line-height:1.5}.primary-button{width:100%;border:0;border-radius:12px;background:var(--lime);color:#153249;font-size:15px;font-weight:900;min-height:48px;padding:8px 15px;display:flex;align-items:center;justify-content:space-between;box-shadow:0 5px 0 #9aaf61}.primary-button span{font-size:21px}.primary-button:active{transform:translateY(3px);box-shadow:0 2px 0 #9aaf61}
.board-foot{display:flex;align-items:center;justify-content:space-between;min-height:48px;padding:8px 10px 8px 14px;gap:8px}.board-foot span{font-size:11px;font-weight:700;line-height:1.4;color:#d6e9e7;min-width:0}.board-foot button{flex:none;border:1px solid #436e7d;border-radius:9px;background:#183e53;color:#e4f2ed;font-size:11px;font-weight:800;padding:8px}
.tip-row{display:flex;align-items:flex-start;gap:10px;color:#bfd5d8;font-size:11px;line-height:1.55;margin:14px 5px 12px}.tip-row b{color:#eef8e4}.tip-icon{flex:none;width:24px;height:24px;border-radius:50%;background:#21475b;display:grid;place-items:center;color:var(--lime);font-size:14px}
footer{border-top:1px solid #2b5264;padding:13px 4px 0;color:#96b7bf;font-size:10px;line-height:1.7}footer b{color:#b8d2d2}footer button{border:0;background:transparent;padding:0;color:var(--lime);font-size:10px;font-weight:800;text-decoration:underline}
.modal{width:min(calc(100% - 30px),440px);max-height:min(80dvh,650px);overflow:auto;border:1px solid #7b9a9f;border-radius:18px;background:#10344a;color:#f5f8ed;padding:19px 21px;box-shadow:0 20px 60px #0009}.modal::backdrop{background:#031321bb;backdrop-filter:blur(3px)}.modal-head{display:flex;align-items:center;justify-content:space-between;gap:8px}.modal h2{margin:0;font-size:21px}.close-button{border:1px solid #587987;border-radius:8px;background:#1b4a60;color:white;width:32px;height:32px;font-size:20px}.modal ol{padding-left:21px;margin:18px 0}.modal li{margin:13px 0;padding-left:5px}.modal li b{display:block;color:var(--lime);font-size:14px}.modal li span{display:block;margin-top:3px;color:#cbdbdf;font-size:12px;line-height:1.7}.modal-note{color:#c3d9db;font-size:12px;line-height:1.7}.sources-list{display:grid;gap:8px;margin:17px 0}.source-row{display:grid;grid-template-columns:1fr auto;gap:4px 8px;padding:10px;border:1px solid #486b7b;border-radius:10px;background:#1a4358;font-size:12px}.source-row strong{grid-column:1;font-size:13px}.source-row span{grid-column:1;color:#b2d0d4;font-size:11px}.source-row a{grid-column:2;grid-row:1/3;align-self:center;color:var(--lime);font-weight:800}
@media(min-width:700px){.app{padding-top:28px}.board-wrap{aspect-ratio:400/560}.game-shell{max-width:550px;margin:auto}.hud{max-width:550px;margin-left:auto;margin-right:auto}.tip-row,footer{max-width:550px;margin-left:auto;margin-right:auto}.topbar{max-width:550px;margin-left:auto;margin-right:auto}}
@media(max-width:370px){.app{padding:12px 9px 20px}.brand strong{font-size:20px}.brand-mark{width:37px;height:37px}.stat strong{font-size:12px}.stat:last-child strong{font-size:11px}.board-foot span{font-size:10px}.island-name{font-size:14px}}
@media(prefers-reduced-motion:reduce){.board-wrap.flash{animation:none}}
.tension-bar{min-height:29px;display:flex;align-items:center;justify-content:space-between;gap:8px;margin:0 3px 10px;color:#bdd4d8;font-size:11px;font-weight:800}.tension-bar span{white-space:nowrap}.tension-bar .hot{color:var(--lime)}.tension-bar .danger{color:#ff9b9f}
.stat small{margin-top:1px}
.mission-badge{position:absolute;z-index:2;top:11px;left:11px;max-width:65%;padding:7px 10px;border:1px solid #f5d277;border-radius:9px;background:#173d52ee;box-shadow:0 5px 18px #04132099;color:#fff2c4;font-size:11px;font-weight:900;line-height:1.45;pointer-events:none}.mission-badge[hidden]{display:none}.mission-badge b{color:#ffe294}
.boat-wait{font-size:10px;font-weight:900;fill:#cce5dd;paint-order:stroke;stroke:#0b2b40;stroke-width:2px}.boat-wait.urgent{fill:#ff8686}.boat.type-fast .boat-disc{stroke-width:2}.boat.type-large .boat-disc{stroke-width:3.5}.boat.type-fast .boat-icon{fill:#f6ffff}
.mode-picker{display:grid;grid-template-columns:repeat(3,1fr);gap:5px;margin:3px 0 15px}.mode-option{border:1px solid #587e8d;border-radius:9px;background:#1b455a;color:#d8eaeb;text-align:center;min-height:47px;padding:5px 2px}.mode-option b{display:block;font-size:12px}.mode-option span{display:block;margin-top:2px;font-size:9px;color:#b1cbd0}.mode-option.selected{border-color:var(--lime);background:#305450;box-shadow:inset 0 0 0 1px var(--lime)}.mode-option.selected b{color:var(--lime)}.secondary-button{display:block;width:100%;min-height:30px;margin-top:10px;border:0;background:transparent;color:#c6e3d1;font-size:11px;font-weight:800;text-decoration:underline}.overlay-card.start-card{padding-top:17px;padding-bottom:15px}.overlay-card.start-card h1{font-size:26px;margin:8px 0}.overlay-card.start-card p{margin-bottom:13px}.overlay-card.start-card small{margin-top:8px}
@media(min-width:700px){.tension-bar{max-width:550px;margin-left:auto;margin-right:auto}}

/* Keep the entire playfield inside the portion of a phone actually visible above browser chrome. */
@media(max-width:699px), (max-width:1000px) and (max-height:600px){
  html,body{height:100%;overflow:hidden;overscroll-behavior:none}
  .app{width:100%;height:var(--visible-height,100dvh);min-height:0;display:flex;flex-direction:column;overflow:hidden;padding:6px 9px max(5px,env(safe-area-inset-bottom))}
  .topbar{flex:none;min-height:43px;margin-bottom:5px}
  .brand{gap:8px}.brand-mark{width:35px;height:35px;border-radius:10px;font-size:21px}
  .brand strong{font-size:19px}.brand small{font-size:8px;margin-top:2px}
  .icon-button{width:43px;height:43px}
  .hud{flex:none;gap:4px;margin-bottom:3px}
  .stat{min-height:47px;padding:5px 3px 4px;border-radius:9px}
  .stat span{font-size:9px}.stat strong{font-size:12px;margin-top:2px}.stat small{font-size:8px}
  .stat:last-child strong{font-size:12px}
  .tension-bar{flex:none;min-height:19px;margin:0 2px 3px;font-size:10px}
  .game-shell{flex:1 1 auto;min-height:0;display:flex;flex-direction:column;border-radius:14px}
  .map-heading{flex:none;height:27px;padding:0 10px;font-size:11px}
  .map-scale{font-size:9px}
  .board-wrap{flex:1 1 auto;min-height:0;aspect-ratio:auto}
  .board-wrap svg{width:100%;height:100%}
  .board-foot{flex:none;min-height:38px;padding:4px 7px 4px 9px}
  .board-foot button{min-height:31px}
  .tip-row{display:none}
  footer{flex:none;display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:24px;margin:0;border:0;padding:2px 4px 0;font-size:0;line-height:1.1;white-space:nowrap}
  footer b{font-size:0}footer::before{content:"실제 항로·운항정보가 아닌 게임입니다.";font-size:9px;color:#96b7bf}
  footer button{flex:none;min-height:22px;font-size:10px}
  .board-overlay{padding:5px;overflow:auto;align-items:safe center}
  .overlay-card{max-height:100%;overflow-y:auto;overscroll-behavior:contain}
  .overlay-card.start-card{padding:12px 17px 10px}
  .overlay-card.start-card h1{font-size:22px;margin:5px 0 6px;line-height:1.2}
  .overlay-card.start-card p{font-size:11px;line-height:1.45;margin-bottom:8px}
  .overlay-card.start-card .mode-picker{margin:2px 0 8px}
  .overlay-card.start-card .mode-option{min-height:40px}
  .overlay-card.start-card .primary-button{min-height:44px}
  .overlay-card.start-card .secondary-button{min-height:27px;margin-top:5px}
  .overlay-card.start-card small{font-size:9px;margin-top:4px}
}
@media(max-width:699px) and (max-height:560px), (min-width:700px) and (max-width:1000px) and (max-height:560px){
  .app{padding-top:3px;padding-bottom:max(3px,env(safe-area-inset-bottom))}
  .topbar{min-height:37px;margin-bottom:2px}.brand-mark{width:31px;height:31px}.brand strong{font-size:17px}.brand small{display:none}
  .icon-button{width:39px;height:39px}
  .hud{margin-bottom:1px}.stat{min-height:40px;padding:3px 2px}.stat span{font-size:8px}.stat strong{font-size:11px}
  .tension-bar{min-height:17px;margin-bottom:2px;font-size:9px}
  .map-heading{height:24px}.board-foot{min-height:34px}.board-foot button{min-height:29px}
  footer{min-height:20px}
  .overlay-card{padding:13px 15px 11px}.overlay-card h1{font-size:22px;margin:5px 0}.overlay-card p{font-size:11px;margin-bottom:8px;line-height:1.45}
  .mode-picker{margin-bottom:8px}.mode-option{min-height:39px}.primary-button{min-height:42px}
  .stat:first-child strong{font-size:10px;letter-spacing:-.7px}
  .island-name{font-size:20px}.island-point{font-size:12px}
  .boat-tag,.boat-wait{font-size:13px}
}
@media(min-width:700px) and (max-width:1000px) and (max-height:600px){
  .app{max-width:420px}
  .topbar,.hud,.tension-bar,.game-shell,footer{width:100%;max-width:none;margin-left:0;margin-right:0}
}
@media(max-width:1000px) and (max-height:420px){
  .overlay-card.start-card{padding:7px 12px}
  .overlay-card.start-card .eyebrow,.overlay-card.start-card p,.overlay-card.start-card small{display:none}
  .overlay-card.start-card h1{font-size:16px;margin:0 0 4px}
  .overlay-card.start-card .mode-picker{margin:0 0 5px}
  .overlay-card.start-card .mode-option{min-height:32px}
  .overlay-card.start-card .primary-button{min-height:36px}
  .overlay-card.start-card .secondary-button{min-height:22px;margin-top:2px}
}
.exit-button{min-width:48px;height:39px;border:1px solid #a96f7f;border-radius:10px;background:#4c2e42;color:#ffe7e7;font-size:12px;font-weight:900}.exit-button:disabled{opacity:.45;cursor:default}
.foot-actions{display:flex;flex:none;gap:5px}.board-foot .foot-actions button{white-space:nowrap}
.nickname-field{display:block;margin:0 0 10px;color:#e0eff0;font-size:11px;font-weight:800}.nickname-field span{display:block;margin-bottom:4px}.nickname-field input{display:block;width:100%;height:38px;border:1px solid #73909d;border-radius:9px;background:#092c43;color:#fff;padding:6px 10px;font:800 13px "Noto Sans KR",sans-serif}.nickname-field small{margin:3px 0 0!important;color:#accbd1;font-size:9px!important}.nickname-field input:focus{outline:2px solid var(--lime)}
.rank-controls{display:flex;align-items:center;gap:8px;margin:15px 0 10px;font-size:12px;font-weight:800}.rank-controls select{flex:1;min-width:0;border:1px solid #587e8d;border-radius:8px;background:#173e53;color:#fff;padding:8px;font:inherit}.rank-controls button,.quit-actions button{border:1px solid #6b8c95;border-radius:8px;background:#245166;color:#fff;padding:8px 10px;font-size:11px;font-weight:800}.rank-status{color:#bcd7dd;font-size:12px;line-height:1.5}.rank-status.error{color:#ffabb7}.my-rank{margin:10px 0;padding:11px;border:1px solid #bcd881;border-radius:10px;background:#2e5348;color:#edffcb;font-size:12px;font-weight:800}.my-rank:empty{display:none}.rank-list{list-style:none;margin:10px 0;padding:0;display:grid;gap:5px;max-height:31dvh;overflow:auto}.rank-list li{display:grid;grid-template-columns:29px minmax(0,1fr) auto;gap:8px;align-items:center;padding:7px 9px;border:1px solid #406c78;border-radius:9px;background:#194457;font-size:12px}.rank-list li b{color:var(--lime)}.rank-list li span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rank-list li strong{color:#fff;font-size:13px}.rank-list li.mine{border-color:var(--lime);background:#2d5551}.quit-actions{display:flex;gap:7px}.quit-actions button{flex:1;min-height:42px}.quit-actions #quitConfirm{border-color:#ff9da9;background:#743a4b}.rank-modal{max-height:85dvh}
.ranking-note{display:block;margin-top:10px;color:#d8e9ca;font-size:11px;line-height:1.5}.ranking-note.error{color:#ffb0be}.ranking-note.success{color:var(--lime)}.ranking-note button{display:block;margin-top:6px;border:1px solid var(--lime);border-radius:8px;background:#274f4e;color:#eefbcc;padding:6px 9px;font-size:11px;font-weight:900}
@media(max-width:699px){.exit-button{height:43px}.board-foot{gap:4px}.board-foot .foot-actions button{padding:6px 4px;font-size:10px}.board-foot span{font-size:10px}.nickname-field{margin-bottom:6px}.nickname-field input{height:34px}.nickname-field small{display:none!important}}
@media(max-width:370px){.top-actions{gap:4px}.icon-button{width:39px}.exit-button{min-width:43px}.board-foot .foot-actions button{font-size:9px}}
@media(max-width:699px) and (max-height:560px){
  .overlay-card.start-card{padding:8px 13px}
  .overlay-card.start-card .eyebrow,.overlay-card.start-card p,.overlay-card.start-card>small{display:none}
  .overlay-card.start-card h1{font-size:18px;line-height:1.15;margin:2px 0 5px}
  .overlay-card.start-card .nickname-field{margin-bottom:4px}
  .overlay-card.start-card .nickname-field input{height:30px}
  .overlay-card.start-card .mode-picker{margin:0 0 6px}
  .overlay-card.start-card .mode-option{min-height:33px}
  .overlay-card.start-card .primary-button{min-height:36px}
  .overlay-card.start-card .secondary-button{min-height:23px;margin-top:3px}
}
