/* The Edge of the World: sunlit staged sea, soft gold/teal/blue palette, vintage cinema field notes. */
:root{--ink:#1b3442;--cream:#f9f4e5;--gold:#edc378;--navy:#153e52;--blue:#7cc8cf;--line:#bfd2c8}
*{box-sizing:border-box}body{margin:0;background:#f1e8d5;color:var(--ink);font-family:Arial,"PingFang SC","Microsoft YaHei",sans-serif;background-image:radial-gradient(#afbaa144 1px,transparent 1px);background-size:22px 22px}
.wrap{max-width:1380px;margin:auto;padding:18px 20px 30px}header{display:flex;align-items:center;justify-content:space-between;gap:15px;border-bottom:2px solid #819ea2;padding-bottom:13px;margin-bottom:14px}header small{color:#54818c;font-weight:900;font-size:11px;letter-spacing:.15em}h1{margin:3px 0;font:600 clamp(25px,3.1vw,41px) Georgia,"Noto Serif SC","Songti SC",serif}h1 em{font:700 11px Arial;letter-spacing:.16em;color:#55808a;margin-left:10px;font-style:normal}.stamp{border:2px solid var(--ink);padding:10px;transform:rotate(3deg);font-size:12px;letter-spacing:.12em;font-weight:900}
.stage{position:relative;overflow:hidden;border:4px solid #264a55;background:#b9dfe3;box-shadow:0 8px 0 #25495a44;border-radius:7px}.stage canvas{width:100%;height:auto;aspect-ratio:1200/675;display:block;touch-action:none}
.topbar{position:absolute;inset:0 0 auto;display:flex;align-items:center;gap:17px;padding:13px 20px;color:#1d4351;background:linear-gradient(#f5eedbdc,#f5eedb00);font-size:12px;font-weight:800}.topbar>div:first-child{white-space:nowrap}.topbar b{display:block;font-size:17px}.topbar>div:last-child{text-align:right}.track{flex:1;height:9px;border-radius:30px;border:1px solid #668f9a;background:#d8e1d9;overflow:hidden}.track i{display:block;height:100%;width:0;background:#dba157}.bottom{position:absolute;inset:auto 13px 12px;display:flex;gap:9px;align-items:stretch;justify-content:space-between}.bottom>div{min-width:0;flex:1;padding:8px 11px;background:#fff9e9e8;border:1px solid #83a3aa;border-radius:6px;font-weight:800;font-size:11px}.bottom b{font-size:14px}.bar{height:8px;margin:5px 0;background:#c7d9d9;border-radius:30px;overflow:hidden}.bar i{display:block;height:100%;background:#69b7a2;width:100%;transition:width .1s}.bottom>div:nth-child(2) .bar i{background:#6ab8cf}.bottom>div:nth-child(3) .bar i{background:#e7b75c}.message{position:absolute;left:50%;top:18%;transform:translateX(-50%);padding:10px 18px;font-weight:800;font-size:18px;color:white;text-shadow:0 2px 3px #213a4e;pointer-events:none;text-align:center;opacity:0;transition:opacity .35s;width:80%}.message.visible{opacity:1}.hidden{display:none!important}
.overlay{position:absolute;inset:0;background:#1c32418c;display:grid;place-items:center;padding:12px}.dialog{width:min(570px,96%);max-height:96%;overflow:auto;background:#fff8e9;border:3px solid #274e59;border-radius:6px;box-shadow:10px 10px 0 #152f3a66;padding:23px 27px;text-align:left}.dialog>small:first-child{color:#8b7558;letter-spacing:.16em;font-size:10px;font-weight:900}.dialog h2{font:600 clamp(25px,4vw,42px)/1.22 Georgia,"Songti SC",serif;margin:12px 0}.dialog p{font-size:13px;line-height:1.7}.field{display:block;font-size:12px;font-weight:800;margin:12px 0}.field select{display:block;margin-top:5px;width:100%;padding:9px;border:1px solid #91a9a9;background:white;color:#2c4651;border-radius:5px;font:inherit}.apiMessage{padding:9px;background:#e8f0df;border:1px solid #aec8b7;border-radius:5px;font-size:11px!important}.dialogBtns{display:flex;gap:9px;flex-wrap:wrap;margin:12px 0}.dialogBtns button,button.primary{padding:12px 16px;border-radius:5px;border:1px solid #577782;background:#fffdf5;color:#284958;font-weight:900;cursor:pointer}.dialogBtns button.primary,.primary{background:#dfac61;color:#213b43;border-color:#bd8c45}.dialogBtns button:hover,button:hover{filter:brightness(1.05)}#dialogFoot{color:#697f7f;font-size:10px}
.under{display:grid;grid-template-columns:1fr 1fr;gap:15px;margin-top:20px}.box{border:2px solid #8fa9a9;background:#f9f6e9;padding:16px 19px;border-radius:6px}.box h3{font-size:13px;letter-spacing:.12em;margin:0 0 16px}.box h3 span{font-weight:400;color:#6b8386;letter-spacing:0;margin-left:5px}.controls{display:flex;gap:9px;flex-wrap:wrap;justify-content:space-between}.controls>div{display:flex;align-items:center;gap:5px;flex:1;min-width:118px}.controls span{font-size:11px;font-weight:bold;margin-left:3px}kbd{border:2px solid #4a7380;border-bottom:4px solid #4a7380;background:white;border-radius:5px;padding:7px;font-size:13px;font-family:inherit;font-weight:900;white-space:nowrap}.between{display:flex;justify-content:space-between;align-items:center;gap:10px}.between h3{margin-bottom:10px}.between>button,.presets button{border:1px solid #89aaad;background:#edf4ef;border-radius:5px;padding:6px 9px;color:#315363;font-size:11px;font-weight:800;cursor:pointer}#apiState{font-size:11px;color:#2d8180}.stats{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:7px 0 11px}.stats>div{background:#e8f0ed;border-radius:5px;padding:7px}.stats small{font-size:10px;color:#6b8989;display:block}.stats b{font-size:17px}.between>small{font-size:10px;color:#5d777a;max-width:65%}.presets{margin-top:9px;display:flex;flex-wrap:wrap;gap:5px;font-size:11px;align-items:center}.presets .active{background:#477f87;color:white}.touch{display:flex;gap:7px;flex-wrap:wrap;margin-top:15px}.touch button{font-weight:900;background:#d6ece5;border:1px solid #638b91;border-bottom:4px solid #638b91;color:#235060;padding:12px 14px;border-radius:7px;touch-action:none;user-select:none}.touch button:active{background:#f0c681}footer{display:flex;justify-content:space-between;gap:18px;margin-top:20px;padding-top:12px;border-top:1px solid #b0bcb0;font-size:11px;color:#637e82;flex-wrap:wrap}a{color:#306982}
@media(max-width:850px){.under{grid-template-columns:1fr}.wrap{padding:10px}.stamp{display:none}.topbar{padding:8px}.topbar b{font-size:12px}.bottom{inset:auto 4px 4px;gap:3px}.bottom>div{padding:4px;font-size:9px}.bottom b{font-size:10px}.bar{height:5px}.dialog{padding:12px;box-shadow:4px 4px 0 #152f3a66}.dialog h2{font-size:23px}.dialog p{font-size:11px}.field{margin:7px 0}.message{font-size:13px}.box{padding:12px}}
@media(max-width:500px){h1 em{display:block;margin:5px 0}.stage canvas{min-height:330px;object-fit:cover}.topbar>div:last-child{font-size:9px}.topbar{gap:5px}.dialog{max-height:98%}.dialog h2{margin:5px 0}.dialogBtns button{padding:7px}.dialog p{line-height:1.35}.stats b{font-size:14px}}
@media(prefers-reduced-motion:reduce){*,*:after,*:before{transition:none!important}}

/* V4: persistent pause and live sea selection */
.controlHead{align-items:flex-start;margin-bottom:13px}.controlHead h3{margin-bottom:0}
.pauseButton{background:#f0c67f;border:2px solid #507480;color:#254c59;border-radius:7px;padding:10px 13px;min-width:112px;font-size:12px;font-weight:900;cursor:pointer;box-shadow:0 3px 0 #7b9593}.pauseButton:hover:not(:disabled){filter:brightness(1.05)}.pauseButton:disabled{opacity:.55;cursor:not-allowed}
.inlineCity{display:flex;justify-content:space-between;gap:12px;align-items:center;font-size:11px;font-weight:900;color:#315b62;margin:8px 0 12px}.inlineCity select{width:min(64%,320px);min-height:36px;padding:7px 9px;border-radius:5px;border:1px solid #84a6aa;background:#fffdf2;color:#284958;font:inherit}
@media(max-width:520px){.inlineCity{display:block}.inlineCity select{width:100%;margin-top:7px}.controlHead{gap:5px}.pauseButton{min-width:95px}}

.broadcastBox{margin-top:12px;border:1px dashed #72979a;background:#e6eee5;padding:9px 11px;border-radius:5px;color:#31505b;line-height:1.55}.broadcastBox b{font-size:11px;letter-spacing:.04em}.broadcastBox p{font-size:12px;font-weight:700;margin:6px 0}.broadcastBox small{font-size:10px;color:#628087}

/* V6 / itch.io embed: in-frame action dock always follows the canvas */
html{scrollbar-gutter:stable}
.stage{display:flex;flex-direction:column;overflow:hidden}
.stage #canvas{
  width:100%;
  height:auto;
  max-height:max(240px,calc(100dvh - 245px));
  aspect-ratio:1200/675;
  object-fit:contain;
  flex-shrink:1;
  min-height:0;
}
.actionDock{
  position:relative;
  z-index:5;
  display:flex;align-items:center;justify-content:space-between;gap:9px;
  background:linear-gradient(135deg,#fff5df,#e6f1e9);
  border-top:2px solid #557d87;
  padding:8px 12px;
  flex-wrap:wrap;
  min-height:73px;
}
.dockButtons{display:flex;gap:5px;align-items:center;flex:1;flex-wrap:wrap}
.dockButtons button{
  font-weight:800;
  background:#d8eee6;
  border:1px solid #618d98;
  border-bottom:3px solid #638c95;
  border-radius:6px;
  color:#255667;
  min-height:45px;
  min-width:64px;
  padding:7px 10px;
  cursor:pointer;
  touch-action:none;
  user-select:none;
  -webkit-user-select:none;
}
.dockButtons button:active{background:#f4d695;transform:translateY(1px)}
.dockButtons small{font-size:9px;opacity:.72}
.actionDock .pauseButton{margin:0;flex-shrink:0;min-height:45px;box-shadow:none}
.dockSea{display:flex;align-items:center;gap:6px;white-space:nowrap;font-size:11px;font-weight:800;color:#315c68}
.dockSea select{max-width:155px;border:1px solid #79a2a5;color:#234957;background:#fff;padding:9px 6px;border-radius:6px;font-size:11px;font-weight:800;min-height:43px}
.inframeHelp{color:#55767c;font-size:11px;margin:13px 0 0}
.stage .bottom{bottom:84px}
.stage .overlay{bottom:0;z-index:9}
.overlay .dialog{max-height:calc(100% - 10px)}
@media(max-width:960px){
  .wrap{padding:7px 10px 16px}
  header{margin-bottom:7px;padding-bottom:7px}
  header small{font-size:9px}
  h1{font-size:clamp(21px,2.7vw,31px)}
  .stage #canvas{max-height:calc(100dvh - 205px)}
  .actionDock{gap:6px;padding:7px}
  .dockButtons button{min-width:58px;padding:7px}
  .dockSea select{max-width:135px}
}
@media(max-width:650px){
  .stage #canvas{max-height:calc(100dvh - 240px);min-height:160px}
  .actionDock{display:grid;grid-template-columns:1fr auto;gap:7px}
  .dockButtons{grid-column:1/-1;justify-content:space-between}
  .dockButtons button{flex:1;min-width:0;font-size:11px;padding:5px 3px;min-height:42px}
  .dockSea{grid-row:2;grid-column:1;justify-content:flex-start}
  .actionDock .pauseButton{grid-row:2;grid-column:2;min-height:37px;padding:7px;font-size:11px}
  .stage .bottom{bottom:104px}
  .dialog{max-height:min(98%,calc(100dvh - 18px));overflow:auto}
  .topbar{font-size:9px}
}
@media(max-height:560px) and (min-width:651px){
  .mast,.stamp{display:none}
  header{padding:2px 0;margin-bottom:4px}
  header h1{font-size:20px}
  .stage #canvas{max-height:calc(100dvh - 195px)}
  .under{margin-top:10px}
}

/* V7: prioritize immersive gameplay over squeezing the full image into the iframe.
   The stage uses a cropped, full-bleed canvas, not object-fit:contain.
   The interactive dock floats on top of the lowest part of the sea. */
.stage{display:block!important;position:relative;overflow:hidden}
.stage #canvas{
 display:block;
 width:100%!important;
 height:min(56.25vw,calc(100dvh - 125px))!important;
 max-height:none!important;
 min-height:0!important;
 aspect-ratio:auto!important;
 object-fit:cover!important;
 object-position:center center!important;
}
.stage .actionDock{
 position:absolute!important;
 bottom:0;left:0;right:0;
 min-height:66px;
 padding:8px 10px;
 background:linear-gradient(90deg,rgba(244,250,241,.94),rgba(255,249,229,.94));
 border-top:1px solid #7eaaad;
 box-shadow:0 -5px 20px #21485a25;
 backdrop-filter:blur(4px);
}
.stage .dockButtons button{
 min-height:40px;
 border-bottom-width:2px;
 background:#d5ece7f0;
}
.stage .actionDock .pauseButton{min-height:40px}
.stage .dockSea select{min-height:39px}
.stage .bottom{bottom:78px}
.stage .topbar{z-index:2}
.stage .overlay{z-index:10}
@media(max-height:690px){
  .stage .bottom{display:none!important}
  .stage .topbar{padding:7px 10px}
  .stage .topbar b{font-size:13px}
  header{min-height:0}
}
@media(max-width:650px){
  .stage #canvas{
    height:max(315px,calc(100dvh - 168px))!important;
    max-height:520px!important;
    object-position:45% center!important;
  }
  .stage .actionDock{min-height:101px;padding:6px 7px}
  .stage .dockButtons button{min-height:38px}
  .stage .bottom{display:none!important}
}
@media(max-height:560px) and (min-width:651px){
  header{margin-bottom:4px;padding-bottom:3px}
  header h1{font-size:19px}
  .stage #canvas{height:calc(100dvh - 100px)!important}
}
