:root { --paper:#efe3c4; --paper2:#e2d3ac; --ink:#2b1d10; --ink2:#5b4630; --wood:#3a2716; --wood2:#5a3d22; --brass:#c8a24f; --brass2:#8c6b2a; --us:#1f3566; --jp:#8c1c24; --good:#3d6b35; --bad:#9c2a1f; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #241810; color: var(--ink); font-family: Crimson, Georgia, serif; font-size: 16px; -webkit-tap-highlight-color: transparent; }
#app { position: fixed; inset: 0; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; display: block; }
.hidden { display: none !important; }
.btn { font-family: Crimson, Georgia, serif; font-size: 15px; font-weight: bold; color: #2b1d10; background: linear-gradient(#f4e7c4, #d9c592); border: 1px solid #6b5232; border-radius: 6px; padding: 7px 12px; cursor: pointer; box-shadow: 0 2px 0 #6b5232, 0 3px 6px rgba(0,0,0,.25); touch-action: manipulation; }
.btn:hover { background: linear-gradient(#fff3d4, #e6d29e); }
.btn:active { transform: translateY(1px); box-shadow: 0 1px 0 #6b5232; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: linear-gradient(#e2bd62, #b38b34); color: #241505; border-color: #5e4313; font-size: 17px; padding: 8px 18px; }
.btn.active { background: linear-gradient(#7d2a20, #5a1a13); color: #f6e7c4; border-color: #3a0f0a; }
.btn.small { padding: 5px 10px; font-size: 14px; }
.btn.tiny { padding: 1px 7px; font-size: 13px; box-shadow: none; }
.btn.round { width: 42px; height: 42px; border-radius: 50%; padding: 0; font-size: 22px; line-height: 40px; }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; text-decoration: underline; }
.hud { position: absolute; z-index: 5; }
#top { top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 14px; padding: 6px 12px; padding-top: max(6px, env(safe-area-inset-top)); background: linear-gradient(#4a321c, #2f2012); border-bottom: 2px solid var(--brass2); color: #f1e2bc; box-shadow: 0 3px 12px rgba(0,0,0,.5); }
#top .brand { display: flex; align-items: center; gap: 8px; font-family: PlayfairSC, Georgia, serif; font-size: 19px; letter-spacing: 1px; color: #f3d98f; }
#top .flag { width: 30px; height: 19px; display: inline-block; background-size: cover; border: 1px solid #000; }
#top .stat { display: flex; flex-direction: column; line-height: 1.05; font-size: 16px; }
#top .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; color: #c9b27c; }
#top .spacer { flex: 1; }
#zoom { right: 12px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
#panel { top: 64px; right: 10px; width: 360px; max-height: calc(100% - 140px); overflow: auto; background: var(--paper); background-image: radial-gradient(circle at 20% 10%, rgba(255,255,255,.4), transparent 60%), linear-gradient(var(--paper), var(--paper2)); border: 2px solid var(--wood2); border-radius: 8px; box-shadow: 0 8px 26px rgba(0,0,0,.55), inset 0 0 30px rgba(120,80,30,.18); padding: 12px 14px; }
#panel h2 { font-family: PlayfairSC, Georgia, serif; font-size: 20px; margin: 0 0 2px; display: flex; align-items: center; gap: 8px; }
#panel h3 { font-family: PlayfairSC, Georgia, serif; font-size: 14px; letter-spacing: 1px; margin: 12px 0 6px; color: var(--ink2); border-bottom: 1px solid rgba(90,60,30,.3); padding-bottom: 2px; }
#panel .meta { font-style: italic; color: var(--ink2); margin-bottom: 6px; }
#panel .kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 15px; }
#panel .kv b { color: var(--ink2); font-weight: normal; }
.orders { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.orders .btn { padding: 7px 4px; font-size: 14px; }
.doct { display: flex; flex-wrap: wrap; gap: 5px; }
.doct .btn { padding: 4px 8px; font-size: 13px; }
.ships { list-style: none; margin: 0; padding: 0; }
.ships li { display: grid; grid-template-columns: 18px 74px 1fr; align-items: center; gap: 6px; padding: 3px 2px; border-bottom: 1px dotted rgba(90,60,30,.25); font-size: 14px; }
.ships li img { width: 74px; height: 34px; object-fit: contain; }
.ships .nm { line-height: 1.1; }
.ships .cls { font-size: 12px; color: var(--ink2); font-style: italic; }
.hpbar { height: 5px; background: rgba(0,0,0,.18); border-radius: 3px; margin-top: 2px; overflow: hidden; }
.hpbar i { display: block; height: 100%; background: #4f8b47; }
.hpbar i.mid { background: #c4962f; } .hpbar i.low { background: #b2392b; }
.note { font-size: 13px; color: var(--ink2); font-style: italic; margin-top: 8px; }
.close { position: absolute; top: 8px; right: 10px; }
#hint { position: absolute; z-index: 6; left: 50%; transform: translateX(-50%); top: 66px; background: rgba(43,29,16,.92); color: #f6e7c4; padding: 8px 14px; border-radius: 20px; border: 1px solid var(--brass); font-size: 16px; box-shadow: 0 4px 12px rgba(0,0,0,.4); white-space: nowrap; max-width: 94vw; overflow: hidden; text-overflow: ellipsis; }
#log { left: 10px; bottom: 12px; width: 440px; max-height: 34%; display: flex; flex-direction: column; background: rgba(239,227,196,.95); border: 2px solid var(--wood2); border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.45); }
#log .loghead { font-family: PlayfairSC, Georgia, serif; padding: 4px 10px; border-bottom: 1px solid rgba(90,60,30,.3); display: flex; justify-content: space-between; align-items: center; }
#logBody { overflow: auto; padding: 4px 10px; font-size: 14px; }
#logBody p { margin: 3px 0; }
#logBody .d { color: var(--ink2); font-size: 12px; margin-right: 6px; font-family: Courier, monospace; }
.k-good { color: var(--good); } .k-bad { color: var(--bad); font-weight: bold; } .k-big { font-weight: bold; } .k-battle { color: #6b3a12; } .k-air { color: #3a4c6b; }
#tip { position: fixed; z-index: 50; pointer-events: none; max-width: 300px; background: #2b1d10; color: #f6e7c4; border: 1px solid var(--brass); border-radius: 6px; padding: 6px 9px; font-size: 14px; box-shadow: 0 4px 12px rgba(0,0,0,.45); }
.overlay { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; background: rgba(15,10,5,.65); }
.mbox { position: relative; width: min(720px, 94vw); max-height: 88vh; overflow: auto; background: linear-gradient(var(--paper), var(--paper2)); border: 3px solid var(--wood2); border-radius: 10px; padding: 18px 22px; box-shadow: 0 16px 40px rgba(0,0,0,.6), inset 0 0 40px rgba(120,80,30,.2); }
.mbox h2 { font-family: PlayfairSC, Georgia, serif; margin: 0 0 8px; font-size: 26px; }
.mbox h3 { font-family: PlayfairSC, Georgia, serif; margin: 14px 0 4px; font-size: 17px; }
.mbox p, .mbox li { font-size: 16px; line-height: 1.35; }
.mbox .row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; justify-content: flex-end; }
.report { border-left: 4px solid var(--brass2); padding: 4px 10px; margin: 8px 0; background: rgba(255,255,255,.25); }
.report.US { border-color: var(--us); } .report.JP { border-color: var(--jp); }
.report b { font-family: PlayfairSC, Georgia, serif; font-weight: normal; }
.slots { display: grid; gap: 8px; }
.slot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; background: rgba(255,255,255,.35); border: 1px solid rgba(90,60,30,.35); border-radius: 6px; }
/* battle */
#battle { background: rgba(8,6,4,.85); }
.bframe { width: min(1100px, 98vw); height: min(760px, 96vh); display: flex; flex-direction: column; background: #1c140c; border: 3px solid var(--brass2); border-radius: 10px; overflow: hidden; box-shadow: 0 20px 50px rgba(0,0,0,.7); }
.bhead { padding: 8px 14px; background: linear-gradient(#4a321c, #2f2012); color: #f3d98f; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
#bTitle { font-family: PlayfairSC, Georgia, serif; font-size: 21px; }
#bSub { font-style: italic; color: #d9c79a; }
.bstage { flex: 1; position: relative; min-height: 160px; }
#bcv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.bfoot { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 10px; padding: 8px 10px; background: linear-gradient(var(--paper), var(--paper2)); max-height: 42%; overflow: auto; }
.bforce { font-size: 13px; overflow: auto; }
.bforce h4 { margin: 0 0 4px; font-family: PlayfairSC, Georgia, serif; font-size: 14px; }
.bforce .s { display: flex; justify-content: space-between; gap: 6px; border-bottom: 1px dotted rgba(90,60,30,.3); }
.bforce .s.sunk { text-decoration: line-through; color: var(--bad); }
.bctl { text-align: center; }
.bctl .tacs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin: 4px 0 6px; }
.bctl .tacs .btn { font-size: 13px; padding: 6px 4px; }
.bctl .desc { font-size: 13px; font-style: italic; min-height: 34px; color: var(--ink2); }
.bctl .go { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
/* title */
#title { background: #1a120a; flex-direction: column; z-index: 30; }
#titleArt { position: absolute; inset: 0; width: 100%; height: 100%; }
.tbox { position: relative; width: min(760px, 94vw); max-height: 94vh; overflow: auto; text-align: center; background: rgba(239,227,196,.94); border: 3px solid var(--wood2); border-radius: 12px; padding: 18px 22px 20px; box-shadow: 0 20px 60px rgba(0,0,0,.7), inset 0 0 50px rgba(120,80,30,.25); }
.tbox h1 { font-family: PlayfairSC, Georgia, serif; font-size: 48px; margin: 2px 0 0; letter-spacing: 2px; color: #2b1d10; }
.tkick { font-style: italic; color: var(--ink2); }
.tsub { font-family: PlayfairSC, Georgia, serif; color: var(--jp); letter-spacing: 6px; margin-bottom: 10px; }
.choose { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0; }
.card { border: 2px solid rgba(90,60,30,.4); border-radius: 8px; padding: 8px; background: rgba(255,255,255,.35); cursor: pointer; text-align: left; font-family: inherit; font-size: 15px; color: inherit; }
.card.sel { border-color: var(--jp); background: rgba(255,240,200,.85); box-shadow: 0 0 0 2px rgba(140,28,36,.25); }
.card b { font-family: PlayfairSC, Georgia, serif; font-weight: normal; font-size: 17px; display: block; }
.card img { width: 100%; height: 56px; object-fit: contain; }
.card small { color: var(--ink2); }
.sc4 { grid-template-columns: repeat(2, 1fr); }
.seg { display: inline-flex; gap: 6px; margin: 4px 0 10px; flex-wrap: wrap; justify-content: center; }
.tlabel { font-family: PlayfairSC, Georgia, serif; font-size: 14px; letter-spacing: 1px; color: var(--ink2); margin-top: 8px; text-align: left; }
.tbtns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.credit { font-size: 12px; color: var(--ink2); margin-top: 10px; font-style: italic; }
@media (max-width: 820px) {
  .hide-sm { display: none !important; }
  #top { gap: 8px; padding: 5px 8px; }
  #top .ttl { display: none; }
  #top .stat { font-size: 14px; }
  .btn.primary { font-size: 15px; padding: 7px 10px; }
  #panel { top: auto; bottom: 0; left: 0; right: 0; width: auto; max-height: 46%; border-radius: 12px 12px 0 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
  #zoom { bottom: auto; top: 60px; right: 8px; }
  #zoom .btn.round { width: 38px; height: 38px; line-height: 36px; }
  #log { left: 6px; right: 6px; width: auto; bottom: 6px; max-height: 30%; }
  .bfoot { grid-template-columns: 1fr 1fr; max-height: 48%; }
  .bctl { grid-column: 1 / -1; order: -1; }
  .tbox h1 { font-size: 34px; }
  .choose { grid-template-columns: 1fr; }
  .card img { height: 44px; }
  #hint { top: 56px; font-size: 14px; }
}
.choose.levels { grid-template-columns: repeat(3, 1fr); }
.card.lvl { text-align: center; padding: 12px 10px; }
.card.lvl b { font-size: 20px; margin-bottom: 4px; }
@media (max-width: 600px) { .choose.levels { grid-template-columns: 1fr; } .card.lvl { padding: 8px; } }

.cheat-tag { display: inline-block; background: #8b1d14; color: #fbefd8; font-size: 11px; letter-spacing: .04em; padding: 2px 6px; border-radius: 3px; margin: 0 6px; vertical-align: middle; }
.btn.cheat, .cheat-txt { color: #8b1d14; } .btn.cheat { border-color: #8b1d14; }
.cheat-h { color: #8b1d14; }
#mbox.cheat-box { max-width: 760px; width: 94vw; }
.cheat-wrap { max-height: 60vh; overflow: auto; padding-right: 4px; }
.ctab { width: 100%; border-collapse: collapse; font-size: 13px; margin: 4px 0 8px; }
.ctab th { text-align: left; font-weight: normal; color: var(--ink2); border-bottom: 1px solid rgba(60,40,20,.3); }
.ctab td { padding: 2px 4px; border-bottom: 1px solid rgba(60,40,20,.1); }
.cnum { width: 64px; font: inherit; padding: 2px 4px; }
