* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0d1a2a; }
body { font-family: "Yu Gothic UI", "Meiryo", "Hiragino Sans", sans-serif; font-size: 14px; color: #3a2a17; }
.hidden { display: none !important; }
#sea { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; cursor: crosshair; image-rendering: pixelated; }

h1, h2, h3 { font-family: "Yu Mincho", "Hiragino Mincho ProN", serif; margin: 0; }
small { display: block; color: #7a684c; font-size: 12px; margin-top: 2px; }
.dim { color: #8a7758; font-size: 12.5px; }
.good { color: #1f7a3a; font-weight: bold; }
.bad { color: #b83222; font-weight: bold; }
.warn { color: #a9620c; }

button {
  font: inherit; color: #3a2a17; background: #e6d3a3; border: 1px solid #8a6a38; border-radius: 4px;
  padding: 5px 11px; cursor: pointer; margin: 2px; white-space: nowrap;
}
button:hover:not(:disabled) { background: #f5e6bd; }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: #2f6f94; color: #fff; border-color: #1c4a66; font-weight: bold; }
button.primary:hover:not(:disabled) { background: #3b86b1; }
button.on { background: #7a5a2e; color: #fff; }

/* ---- 画面 ---- */
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(8, 16, 28, .68); z-index: 10; padding: 8px; }
.screen.clear { background: rgba(8, 16, 28, .15); }
#mapview { z-index: 20; }
#book { z-index: 25; }
#modal { z-index: 30; }
.panel {
  background: #f2e6c8 linear-gradient(180deg, rgba(255,255,255,.35), rgba(160,120,60,.08));
  border: 3px solid #7a5a2e; border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,.6), inset 0 0 0 1px #d9c08a;
  width: min(980px, 100%); max-height: 100%; overflow: auto; padding: 16px 20px;
}
.panel header { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; border-bottom: 2px solid #b79a62; padding-bottom: 8px; }
.panel header h2 { font-size: 26px; display: inline; margin-right: 10px; }
.sub { color: #7a684c; }
.status { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; }
.panel nav { margin: 10px 0 6px; }
.panel nav button { padding: 7px 18px; font-weight: bold; }
.panel section { min-height: 300px; }
.panel footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-top: 2px solid #b79a62; margin-top: 10px; padding-top: 8px; }
.panel footer .msg { flex: 1; min-height: 20px; }
.panel h3 { margin: 14px 0 4px; font-size: 16px; border-left: 4px solid #7a5a2e; padding-left: 8px; }
.acts { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }

.tbl { width: 100%; border-collapse: collapse; }
.tbl th { font-size: 12px; color: #7a684c; font-weight: normal; border-bottom: 1px solid #b79a62; padding: 3px 6px; }
.tbl td { padding: 4px 6px; border-bottom: 1px solid rgba(183,154,98,.45); text-align: center; }
.tbl .l { text-align: left; }
.tbl td small { display: inline; margin-left: 6px; }
.tbl td.b { white-space: nowrap; }
.tbl td.b button { padding: 2px 8px; font-size: 13px; }
.tbl tr.cur { background: rgba(122,90,46,.14); }
.tag { font-size: 11px; border-radius: 3px; padding: 1px 5px; color: #fff; margin-left: 3px; }
.tag.sp { background: #2f6f94; } .tag.hi { background: #b5482f; } .tag.q { background: #2e8b4e; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 6px; border-bottom: 1px solid rgba(183,154,98,.45); }
.row.hl { background: rgba(232,195,58,.25); }
.row .b { white-space: nowrap; }

/* ---- タイトル ---- */
#title {
  display: block; padding: 0; overflow-x: hidden; overflow-y: auto; isolation: isolate;
  color: #f7ecd5; background: #102b46;
}
#title::before {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background: url("img/title/title_bg.png") center center / cover no-repeat;
  image-rendering: pixelated;
}
#title::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, rgba(5,17,35,.34), transparent 40%, rgba(3,14,29,.24) 70%, rgba(3,14,29,.8)),
    radial-gradient(ellipse at center, transparent 40%, rgba(3,14,29,.3));
}
#title .title-content {
  width: min(1700px, 100%); min-height: 100%; margin: auto;
  display: flex; flex-direction: column; padding: clamp(24px, 5vh, 62px) clamp(24px, 6vw, 100px) 18px;
}
#title .title-logo { text-align: center; flex: none; }
#title .title-ornament { display: flex; align-items: center; justify-content: center; gap: 18px; color: #edcc87; margin-bottom: 8px; }
#title .title-ornament::before, #title .title-ornament::after { content: ""; width: 100px; height: 1px; background: linear-gradient(90deg, transparent, #e8c689); }
#title .title-ornament::after { transform: rotate(180deg); }
#title .title-ornament span { font-size: 28px; line-height: 1; text-shadow: 0 2px 8px #091b30; }
#title h1 {
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: clamp(42px, 4.8vw, 86px); font-weight: 700; line-height: 1.45; letter-spacing: .09em;
  color: #ffedbe; text-shadow: 0 2px 0 #6c4b27, 0 4px 6px #071b32, 0 0 22px rgba(3,14,29,.9);
  -webkit-text-stroke: .5px #e6bb70;
}
#title .title-subtitle {
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: clamp(14px, 1.4vw, 22px); letter-spacing: .14em; margin: 5px 0 0; color: #ffe7b3;
  text-shadow: 0 2px 4px #071627, 0 0 12px #071627;
}
#title .title-tagline { font-size: 13px; letter-spacing: .2em; margin: 18px 0 24px; text-shadow: 0 2px 4px #061526; }
#title .title-menu {
  width: 430px; max-width: 100%; margin: auto 0 0 auto; padding: 23px 28px 19px;
  background: linear-gradient(135deg, rgba(16,39,57,.95), rgba(6,23,40,.94));
  border: 1px solid #b99b64; border-radius: 3px;
  box-shadow: 0 12px 36px #03122180, inset 0 0 0 5px #081d2c, inset 0 0 0 6px #b99b6438;
}
#title .title-menu h2 { display: flex; align-items: center; gap: 14px; margin: 0 0 18px; color: #eed39c; text-align: center; font-size: 17px; font-weight: normal; letter-spacing: .22em; }
#title .title-menu h2::before, #title .title-menu h2::after { content: ""; height: 1px; flex: 1; background: #b99b6455; }
#title .title-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
#title .title-fields label { min-width: 0; font-size: 12px; letter-spacing: .08em; color: #deccaa; }
#title input, #title select {
  display: block; width: 100%; min-width: 0; height: 41px; margin-top: 7px; padding: 7px 10px;
  font: inherit; font-size: 15px; color: #f9edd4; border: 1px solid #a98c5b88; border-radius: 2px; background: #091c2d;
  color-scheme: dark;
}
#title .title-actions { margin-top: 20px; }
#title button {
  margin: 0; min-height: 43px; border-radius: 2px; font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  border: 1px solid #af925b; background: #132d42; color: #f3dfb6;
  transition: background .18s, box-shadow .18s;
}
#title #btn-new {
  display: block; width: 100%; min-height: 54px; font-size: 21px; letter-spacing: .15em;
  color: #2d251b; background: linear-gradient(#f2dfb1, #c8a569); border-color: #f0d29a;
  box-shadow: inset 0 0 0 3px #8b68333d, 0 3px 12px #0004;
}
#title #btn-new span { margin-left: 12px; }
#title #btn-new:hover { background: linear-gradient(#fff0c8, #e0bf84); box-shadow: 0 0 20px #e7c78c40; }
#title .title-secondary { display: flex; gap: 10px; margin-top: 10px; }
#title .title-secondary button { flex: 1; font-size: 15px; }
#title .title-secondary button:hover { background: #25475d; }
#title :is(button, input, select):focus-visible { outline: 2px solid #ffe0a1; outline-offset: 4px; }
#title .title-save { margin: 15px 0 0; font-size: 11px; line-height: 1.6; text-align: center; color: #c4c1b5; }
#title .title-note { margin-top: 22px; text-align: center; color: #dfd6c4; font-size: 12px; line-height: 1.7; letter-spacing: .05em; text-shadow: 0 1px 4px #000; }
@media (min-width: 1600px) and (min-height: 900px) {
  #title .title-menu { width: 470px; padding: 29px 34px 25px; margin-bottom: 30px; }
  #title .title-fields label { font-size: 13px; }
  #title .title-actions { margin-top: 24px; }
}
@media (max-width: 680px) {
  #title::before { background-position: 32% center; }
  #title::after { background: linear-gradient(#071b3055, #071b3010 40%, #03101de6); }
  #title .title-content { padding: 24px 18px 18px; min-height: 100%; }
  #title .title-ornament { margin-bottom: 12px; }
  #title .title-ornament::before, #title .title-ornament::after { width: 65px; }
  #title h1 { max-width: 390px; margin: auto; font-size: clamp(28px, 7vw, 45px); letter-spacing: .035em; }
  #title .title-subtitle { font-size: clamp(10px, 2.8vw, 15px); letter-spacing: 0; margin-top: 10px; }
  #title .title-tagline { font-size: 11px; letter-spacing: .07em; margin: 15px 0 30px; }
  #title .title-menu { margin: auto auto 0; padding: 21px 21px 18px; }
  #title .title-note { margin-top: 16px; font-size: 10px; letter-spacing: 0; }
}
@media (max-height: 650px) {
  #title .title-content { padding-top: 14px; }
  #title .title-ornament { display: none; }
  #title h1 { font-size: clamp(28px, 4vw, 52px); }
  #title .title-tagline { margin: 8px 0 18px; }
  #title .title-menu { margin-top: 12px; }
}

/* ---- 海図・モーダル ---- */
.panel.map { width: min(1400px, 100%); }
#worldmap { width: 100%; height: auto; max-height: calc(100vh - 170px); display: block; margin: 10px auto 0; border: 2px solid #7a5a2e; cursor: crosshair; image-rendering: pixelated; background: #131c26; touch-action: none; }
.panel.modal { width: min(560px, 100%); text-align: center; }
.panel.modal h2 { font-size: 24px; margin-bottom: 8px; color: #1c4a66; }
.panel.modal p { line-height: 1.7; }

/* ---- HUD ---- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; color: #f1f5f9; }
#hud button { pointer-events: auto; }
#topbar { position: absolute; top: 0; left: 0; right: 0; display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: center; justify-content: center; padding: 7px 12px; background: linear-gradient(180deg, rgba(8,16,28,.92), rgba(8,16,28,.6)); border-bottom: 1px solid rgba(201,168,92,.5); font-size: 14px; }
#topbar .bad { color: #ff8a75; }
#log { position: absolute; left: 12px; bottom: 44px; width: min(460px, 60vw); font-size: 13.5px; line-height: 1.55; text-shadow: 0 1px 2px #000, 0 0 4px #000; }
#log div { background: rgba(8,16,28,.5); padding: 1px 8px; border-radius: 3px; margin-top: 2px; }
#log div:nth-last-child(n+5) { opacity: .55; }
#log .good { color: #9dffb0; } #log .bad { color: #ff8a75; } #log .warn { color: #ffd27a; }
#help { position: absolute; left: 12px; bottom: 10px; font-size: 12px; opacity: .8; text-shadow: 0 1px 2px #000; }
#controls { position: absolute; right: 12px; bottom: 172px; width: 276px; }
#hud.nomini #controls { bottom: 12px; }
#sailinfo { background: rgba(8,16,28,.78); border: 1px solid rgba(201,168,92,.6); border-radius: 4px; padding: 6px 8px; text-align: center; margin: 2px; }
#minimap { position: absolute; right: 14px; bottom: 12px; width: 240px; height: 150px; border: 2px solid #c9a85c; border-radius: 4px; image-rendering: pixelated; background: #131c26; }
#btn-enter { position: absolute; left: 50%; top: 62%; transform: translateX(-50%); font-size: 17px; padding: 11px 24px; box-shadow: 0 4px 16px rgba(0,0,0,.5); }

@media (max-width: 720px) {
  #help { display: none; }
  #log { bottom: 12px; }
  .tbl.ships th:nth-child(7), .tbl.ships td:nth-child(7), .tbl.ships th:nth-child(2), .tbl.ships td:nth-child(2) { display: none; }
  .row { flex-wrap: wrap; }
  }

/* ---- 交易・探検・図鑑 ---- */
.pdesc { margin: 8px 2px 0; color: #5d4a2c; font-size: 13px; line-height: 1.6; }
small.in { display: inline; margin-left: 8px; }
.tbl td.l small { display: block; margin: 1px 0 0; }
.lv { margin: 5px 0 2px; }
.xp { display: inline-block; width: 150px; height: 9px; margin-left: 10px; background: #cdbb90; border: 1px solid #8a6a38; border-radius: 5px; overflow: hidden; vertical-align: middle; }
.xp i { display: block; height: 100%; background: #2f6f94; }
.row.stage { align-items: flex-start; }
.reqs { margin: 5px 0 4px; display: flex; flex-wrap: wrap; gap: 4px; }
.req { font-size: 12px; border-radius: 3px; padding: 1px 7px; border: 1px solid; }
.req.ok { color: #1f6a35; border-color: #8fbf9a; background: rgba(46,139,78,.12); }
.req.ng { color: #a12a1c; border-color: #d9a59c; background: rgba(184,50,34,.1); font-weight: bold; }
.found { color: #7a5a12; font-weight: bold; }
.hint { color: #2f6f94; font-size: 12.5px; }
.stype { font-size: 12px; color: #7a684c; margin-left: 8px; font-weight: normal; }
.find { text-align: left; background: rgba(232,195,58,.2); border: 1px solid #c9a85c; border-radius: 6px; padding: 8px 12px; margin: 8px 0; }
.find p { margin: 4px 0 0; }
.panel section.scroll { max-height: calc(100vh - 210px); overflow: auto; }
.panel header > div:last-child button { padding: 4px 9px; }
#sailinfo small { display: inline; color: #b9c7d6; }
.tbl th { white-space: nowrap; }

/* ---- 発見物のイラスト ---- */
.art { display: block; width: 100%; max-width: 360px; margin: 0 auto 8px; border: 2px solid #7a5a2e; border-radius: 6px; background: #e9dcb8; }
.art.th { width: 150px; flex: none; margin: 0; }
.row.site { justify-content: flex-start; align-items: flex-start; }

/* ---- 航海中の依頼表示 ---- */
#quests { position: absolute; left: 12px; top: 48px; width: min(300px, 46vw); font-size: 13px; line-height: 1.5; }
#quests:empty { display: none; }
#quests h4 { margin: 0; padding: 3px 9px; background: rgba(8,16,28,.82); border-radius: 4px 4px 0 0; color: #e8c33a; font-size: 12.5px; }
#quests div { background: rgba(8,16,28,.62); padding: 3px 9px; border-top: 1px solid rgba(255,255,255,.12); }
#quests div:last-child { border-radius: 0 0 4px 4px; }
#quests small { color: #b9c7d6; margin: 0; }
#quests .good { color: #9dffb0; } #quests .bad { color: #ffb39a; }
@media (max-width: 720px) { #quests { top: 78px; } }

/* ---- ゲージ・航海画面の操作盤 ---- */
.g { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.bar { display: inline-block; width: 54px; height: 8px; background: rgba(120,120,120,.35); border: 1px solid rgba(0,0,0,.45); border-radius: 4px; overflow: hidden; }
.bar u { display: block; height: 100%; background: #4fae5e; }
.g.bad .bar u { background: #e0523c; }
#topbar .where b { color: #ffe9a6; }
#topbar .gold b { color: #ffd84a; }
.cgrid { display: grid; grid-template-columns: 1fr 1fr 1fr; }
.cgrid button { padding: 5px 2px; font-size: 12px; margin: 1px; }
.sails { display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 13px; }
.sails i { width: 16px; height: 13px; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.45); border-radius: 2px 7px 7px 2px; }
.sails i.on { background: #fbf6e6; }
.sails b { font-size: 20px; margin-left: 8px; color: #fff; }
#banner { position: absolute; top: 15%; left: 50%; transform: translateX(-50%); text-align: center; opacity: 0; pointer-events: none; padding: 8px 46px;
  background: linear-gradient(90deg, rgba(8,16,28,0), rgba(8,16,28,.8) 22%, rgba(8,16,28,.8) 78%, rgba(8,16,28,0)); border-top: 1px solid rgba(201,168,92,.7); border-bottom: 1px solid rgba(201,168,92,.7); }
#banner b { display: block; font-family: "Yu Mincho", "Hiragino Mincho ProN", serif; font-size: 28px; letter-spacing: .2em; color: #fff; }
#banner small { color: #e8c33a; }
#banner.show { animation: banner 3.2s ease-out; }
@keyframes banner { 0% { opacity: 0; } 12% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; } }

/* ---- 街の画面 (街の絵いっぱいに施設が並ぶ) ---- */
#port { padding: 0; background: #0d1a2a; }
.tw { position: absolute; inset: 0; overflow: hidden; color: #f1f5f9; }
.scene { position: absolute; inset: 0; background: #1d5aa6; }
.scene img.sc { width: 100%; height: 100%; display: block; object-fit: cover; image-rendering: pixelated; }
.scene.empty { background: linear-gradient(180deg, #7fbdea 0, #d8eefc 52%, #63b552 52%, #479a3e 100%); display: flex; align-items: center; justify-content: center; }
.scene img.tw-img { width: min(38%, 420px); image-rendering: pixelated; margin-top: 4%; }
.scene::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(8,16,28,.6) 0, rgba(8,16,28,0) 20%, rgba(8,16,28,0) 72%, rgba(8,16,28,.7) 100%); }
.tw-top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 10px 14px; flex-wrap: wrap; }
.plate { background: linear-gradient(180deg, #f5e9c6, #e2cd9a); color: #3a2a17; border: 2px solid #7a5a2e; border-radius: 0 0 14px 14px; margin-top: -10px; padding: 12px 22px 8px; box-shadow: 0 4px 12px rgba(0,0,0,.45); }
.plate h2 { font-size: 26px; letter-spacing: .08em; }
.plate span { display: inline-block; margin-right: 12px; font-size: 12.5px; color: #7a684c; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; flex: 1; }
.chips .g { background: rgba(8,16,28,.78); border: 1px solid rgba(201,168,92,.65); border-radius: 999px; padding: 5px 12px; font-size: 13.5px; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.chips .g.bad { border-color: #ff8a75; color: #ffb39a; }
.chips .gold b { color: #ffd84a; }
.tw-spots { position: absolute; inset: 0; pointer-events: none; }
button.spot { position: absolute; pointer-events: auto; transform: translate(-50%, -50%); background: none; border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; align-items: center; gap: 0; animation: spot 2.8s ease-in-out infinite; }
button.spot:hover:not(:disabled) { background: none; }
button.spot i { position: relative; font-style: normal; font-size: 34px; width: 76px; height: 76px; line-height: 70px; text-align: center; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff8dc, #e8cf8e 70%, #c9a85c); border: 3px solid #7a5a2e; box-shadow: 0 0 0 3px rgba(255,255,255,.55), 0 6px 14px rgba(0,0,0,.55); transition: transform .12s; }
button.spot b { margin-top: -8px; position: relative; background: linear-gradient(180deg, #2f6f94, #1c4a66); color: #fff; border: 2px solid #f2e6c8; border-radius: 999px; padding: 3px 16px; font-size: 15px; box-shadow: 0 3px 8px rgba(0,0,0,.5); }
button.spot:hover i { transform: scale(1.12); }
button.spot:active i { transform: scale(.95); }
@keyframes spot { 0%, 100% { margin-top: 0; } 50% { margin-top: -7px; } }
.badge { position: absolute; top: -6px; right: -6px; min-width: 22px; height: 22px; line-height: 20px; border-radius: 11px; background: #e0392a; color: #fff; border: 2px solid #fff; font: bold 13px/18px sans-serif; text-align: center; font-style: normal; animation: badge 1s ease-in-out infinite; }
@keyframes badge { 50% { transform: scale(1.18); } }
.tw-toast { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); max-width: 92%; background: rgba(8,16,28,.85); border: 1px solid rgba(201,168,92,.7); border-radius: 999px; padding: 7px 22px; font-size: 14px; animation: toast .25s ease-out; }
.tw-toast .good { color: #9dffb0; } .tw-toast .bad { color: #ff8a75; } .tw-toast .warn { color: #ffd27a; }
@keyframes toast { from { opacity: 0; bottom: 80px; } }
.tw-bottom { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; padding: 10px 14px; }
.tw-bottom .menu { display: flex; gap: 6px; background: rgba(8,16,28,.8); border: 1px solid rgba(201,168,92,.65); border-radius: 16px; padding: 6px 8px; }
.tw-bottom .menu button { display: flex; flex-direction: column; align-items: center; min-width: 74px; background: none; border: 0; color: #f1f5f9; font-size: 12px; padding: 4px 6px; border-radius: 10px; }
.tw-bottom .menu button i { font-style: normal; font-size: 24px; line-height: 1.2; }
.tw-bottom .menu button:hover { background: rgba(255,255,255,.14); }
button.sail { display: flex; align-items: center; gap: 10px; text-align: left; padding: 10px 30px 10px 20px; border-radius: 999px; border: 3px solid #fff3c4; background: linear-gradient(180deg, #ffc94a, #e58a1c); color: #4a2a05; box-shadow: 0 6px 16px rgba(0,0,0,.55); }
button.sail:hover:not(:disabled) { background: linear-gradient(180deg, #ffd96e, #f09a2c); transform: scale(1.04); }
button.sail i { font-style: normal; font-size: 34px; }
button.sail b { font-size: 22px; letter-spacing: .2em; }
button.sail small { color: #6b3d08; margin: 0; }
.tinfo { font-size: 14px; line-height: 2; }
.tinfo b { display: inline-block; min-width: 9.5em; color: #7a5a2e; }
.npc { margin: 4px 0 8px; padding: 8px 12px; background: rgba(122,90,46,.12); border-left: 4px solid #7a5a2e; border-radius: 0 6px 6px 0; font-size: 13.5px; }
.npc b { display: inline-block; margin-right: 12px; font-family: "Yu Mincho", "Hiragino Mincho ProN", serif; font-size: 16px; }
.stat2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; }
.tbl.kv td { text-align: right; } .tbl.kv td.l { text-align: left; color: #7a684c; white-space: nowrap; }
.shipimg { float: right; width: 120px; image-rendering: pixelated; margin: -6px 0 0 8px; }
@media (max-width: 760px) { .stat2 { grid-template-columns: 1fr; } button.spot i { width: 58px; height: 58px; line-height: 52px; font-size: 26px; } button.spot b { font-size: 12.5px; padding: 2px 10px; } .tw-bottom .menu button { min-width: 54px; } button.sail { padding: 8px 18px 8px 12px; } #topbar { font-size: 12px; gap: 2px 10px; } .bar { width: 34px; } }

/* ---- 施設のウィンドウ ---- */
.fwin { position: fixed; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; padding: 14px 8px; background: rgba(8, 16, 28, .55); }
.panel.fac { position: relative; width: min(1020px, 100%); max-height: 100%; display: flex; flex-direction: column; overflow: visible; border-radius: 16px; }
.panel.fac.in { animation: fwin .22s ease-out; }
@keyframes fwin { from { transform: translateY(40px) scale(.96); } }
.panel.fac header { align-items: center; padding-right: 30px; }
.panel.fac header .status { font-size: 13px; gap: 10px; }
.panel.fac nav { margin: 8px 0 2px; display: flex; flex-wrap: wrap; gap: 4px; }
.panel.fac nav button { position: relative; display: flex; align-items: center; gap: 6px; margin: 0; padding: 6px 14px; border-radius: 999px; }
.panel.fac nav button i { font-style: normal; font-size: 18px; }
.panel.fac nav .badge { top: -7px; right: -5px; }
.panel.fac section { flex: 1; min-height: 120px; overflow: auto; padding-right: 4px; }
button.xbtn { position: absolute; top: -14px; right: -10px; width: 40px; height: 40px; padding: 0; border-radius: 50%; background: #b83222; color: #fff; border: 3px solid #fff; font-size: 18px; font-weight: bold; box-shadow: 0 3px 8px rgba(0,0,0,.5); z-index: 1; }
button.xbtn:hover:not(:disabled) { background: #d9442f; }
small.perk { color: #1c5a7a; }
#topbar .vday { color: #ffe9a6; margin-left: 10px; }
.cgrid #btn-go { grid-column: 1 / -1; font-size: 15px; padding: 8px; font-weight: bold; }
.gi { width: 32px; height: 32px; image-rendering: pixelated; vertical-align: middle; margin-right: 6px; float: left; }
.row .gi { float: left; }
/* ---- 航海: 天候と帆 ---- */
#topbar .wx.bad { color: #ff8a75; font-weight: bold; }
#topbar small.in { color: #b9c7d6; }
.adv { margin: 3px 0 1px; padding: 2px 6px; border-radius: 3px; background: rgba(255,255,255,.1); font-size: 12.5px; }
.adv.good { color: #9dffb0; } .adv.warn { color: #ffd27a; } .adv.bad { color: #fff; background: #b83222; font-weight: bold; }
#sailinfo small { display: block; }

/* ---- スマホ (横画面専用) ---- */
html, body { overscroll-behavior: none; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body { -webkit-user-select: none; user-select: none; touch-action: manipulation; }
input, select { -webkit-user-select: text; user-select: text; }
#sea { touch-action: none; height: 100dvh; }
#rotate { display: none; position: fixed; inset: 0; z-index: 99; background: #0d1a2a; color: #f1f5f9; align-items: center; justify-content: center; text-align: center; padding: 20px; }
#rotate i { display: block; font-style: normal; font-size: 64px; animation: rotate-hint 2.6s ease-in-out infinite; }
#rotate b { display: block; font-size: 20px; margin-top: 14px; }
#rotate small { color: #b9c7d6; font-size: 14px; margin-top: 6px; }
@keyframes rotate-hint { 0%, 20% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
@media (orientation: portrait) and (pointer: coarse) { #rotate { display: flex; } }
/* 切り欠きのある端末で、端の表示が隠れないように */
#topbar { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
#controls { right: max(12px, env(safe-area-inset-right)); }
#minimap { right: max(14px, env(safe-area-inset-right)); }
#log, #help, #quests { left: max(12px, env(safe-area-inset-left)); }
.tw-top, .tw-bottom { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
.screen { padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); }
#port { padding: 0; }

/* 高さの小さい横画面 (スマホを横に持ったとき) */
@media (max-height: 540px) {
  body { font-size: 13px; }
  #topbar { font-size: 11.5px; padding-top: 3px; padding-bottom: 3px; gap: 1px 10px; }
  #topbar .bar { width: 26px; height: 6px; }
  #topbar > span:nth-last-child(2) { display: none; }
  #quests { top: 30px; width: 210px; font-size: 11.5px; line-height: 1.35; }
  #quests h4 { font-size: 11px; padding: 1px 8px; }
  #quests small { font-size: 10.5px; }
  #log { bottom: 6px; width: 44vw; font-size: 11.5px; line-height: 1.4; }
  #log div:nth-last-child(n+4) { display: none; }
  #help { display: none !important; }
  #minimap { width: 132px; height: 82px; bottom: 6px; }
  #controls { bottom: 94px; width: 216px; }
  #hud.nomini #controls { bottom: 6px; }
  #sailinfo { padding: 3px 6px; }
  #sailinfo small { font-size: 10.5px; }
  .sails b { font-size: 16px; }
  .adv { font-size: 11px; margin: 1px 0; }
  .cgrid button { font-size: 11px; padding: 7px 1px; }
  .cgrid #btn-go { font-size: 13px; padding: 7px; }
  #btn-enter { top: 58%; font-size: 14px; padding: 9px 18px; }
  #banner { top: 12%; padding: 4px 34px; }
  #banner b { font-size: 19px; }
  /* 街 */
  .plate { padding: 12px 14px 4px; }
  .plate h2 { font-size: 18px; }
  .plate span { font-size: 10.5px; margin-right: 8px; }
  .tw-top { padding-top: 6px; }
  .chips { gap: 4px; }
  .chips .g { font-size: 11px; padding: 3px 8px; }
  .chips .bar { width: 26px; height: 6px; }
  button.spot i { width: 54px; height: 54px; line-height: 48px; font-size: 24px; }
  button.spot b { font-size: 12px; padding: 2px 10px; margin-top: -6px; }
  .tw-bottom { padding-top: 6px; padding-bottom: 6px; }
  .tw-bottom .menu { padding: 3px 5px; border-radius: 12px; }
  .tw-bottom .menu button { min-width: 58px; font-size: 10.5px; padding: 3px 4px; }
  .tw-bottom .menu button i { font-size: 18px; }
  button.sail { padding: 6px 18px 6px 12px; }
  button.sail i { font-size: 24px; }
  button.sail b { font-size: 17px; }
  button.sail small { display: none; }
  .tw-toast { bottom: 62px; font-size: 12px; padding: 4px 14px; }
  /* 施設のウィンドウと日誌は画面いっぱいに */
  .fwin { padding: 0; }
  .panel { padding: 8px 12px; }
  .panel.fac, #book .panel { width: 100%; height: 100%; max-height: 100%; border-radius: 0; border-width: 0; padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  #book { padding: 0; }
  #book .panel { display: flex; flex-direction: column; overflow: hidden; }
  button.xbtn { top: 5px; right: max(6px, env(safe-area-inset-right)); width: 34px; height: 34px; font-size: 15px; }
  .panel header { padding-bottom: 4px; gap: 6px; }
  .panel header h2 { font-size: 18px; }
  .panel.fac header { padding-right: 44px; }
  .panel.fac header .status { font-size: 11px; gap: 8px; }
  .panel.fac header .bar { width: 26px; }
  .panel nav, .panel.fac nav { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 4px; margin: 5px 0 2px; padding: 2px 0 3px; flex: none; }
  .panel nav button, .panel.fac nav button { padding: 5px 11px; font-size: 12px; margin: 0; flex: none; }
  .npc { display: none; }
  .panel section { min-height: 0; }
  .panel section.scroll { max-height: none; flex: 1; }
  .panel footer { margin-top: 4px; padding-top: 4px; }
  .panel footer .msg { font-size: 12px; }
  .panel h3 { margin: 9px 0 3px; font-size: 14px; }
  .row { padding: 5px 4px; gap: 8px; }
  .tbl td { padding: 3px 4px; }
  .row .b button, .tbl td.b button { padding: 6px 10px; font-size: 12.5px; }
  small { font-size: 11px; }
  .art.th { width: 110px; }
  .art { max-width: 250px; }
  /* 海図・メッセージ */
  .panel.map { padding: 6px 10px; }
  .panel.map header button { padding: 5px 8px; font-size: 12px; }
  #worldmap { max-height: calc(100dvh - 92px); margin-top: 5px; }
  #map-hint { margin: 3px 0 0; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .panel.modal h2 { font-size: 19px; margin-bottom: 4px; }
  .panel.modal p { line-height: 1.5; margin: 6px 0; }
}
@media (max-height: 540px) {
  /* タイトル */
  #title .title-content { padding-top: 6px; padding-bottom: 6px; }
  #title .title-ornament, #title .title-tagline, #title .title-note, #title .title-menu h2 { display: none; }
  #title h1 { font-size: clamp(22px, 7.5vh, 34px); }
  #title .title-subtitle { font-size: 11px; margin-top: 2px; }
  #title .title-menu { margin-top: 8px; margin-bottom: 0; padding: 10px 16px 8px; }
  #title .title-fields { gap: 10px; }
  #title input, #title select { padding-top: 5px; padding-bottom: 5px; min-height: 0; height: 32px; font-size: 14px; }
  #title .title-actions { margin-top: 8px; display: flex; gap: 8px; align-items: stretch; }
  #title #btn-new { flex: 1.3; min-height: 0; height: 40px; padding: 0 10px; font-size: 16px; margin: 0; }
  #title .title-secondary { flex: 1; margin-top: 0; gap: 6px; }
  #title .title-secondary button { min-height: 0; height: 40px; padding: 0 6px; font-size: 12.5px; margin: 0; }
  #title .title-save { margin-top: 5px; font-size: 10px; }
  /* 航海: 操作盤は小さな海図の左に置き、羅針盤を隠さない */
  #controls { right: calc(max(14px, env(safe-area-inset-right)) + 140px); bottom: 6px; width: 250px; }
  #hud.nomini #controls { right: max(12px, env(safe-area-inset-right)); }
  .cgrid { grid-template-columns: repeat(4, 1fr); }
  #sailinfo small:first-of-type { display: none; }
  #btn-enter { top: 22%; }
  #log { width: 36vw; }
}
