:root {
  --ink: #e7f2ed;
  --muted: #99b7ba;
  --teal: #62dcc5;
  --gold: #f4c66b;
  --red: #ff8277;
  --panel: #102839ee;
  --line: #315367;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #081a29;
  color: var(--ink);
  font-family:
    system-ui,
    -apple-system,
    Segoe UI,
    sans-serif;
}
button {
  font: inherit;
  cursor: pointer;
}
#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}
#ui {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
#topbar {
  display: flex;
  gap: 9px;
  align-items: center;
  flex-wrap: wrap;
  padding: 12px 14px;
  background: linear-gradient(#071724ef, #07172450, transparent);
}
.brand {
  font-family: Georgia, serif;
  font-size: 23px;
  letter-spacing: 1px;
  color: var(--gold);
  font-weight: bold;
  text-shadow: 0 2px 8px #000;
}
.pill {
  background: #0a2437de;
  border: 1px solid #37576a;
  border-radius: 30px;
  padding: 7px 11px;
  font-size: 13px;
  backdrop-filter: blur(8px);
}
.pill b {
  color: #fff;
}
#leftInfo {
  position: absolute;
  top: 80px;
  left: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(310px, 65vw);
}
.info {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  box-shadow: 0 5px 20px #0018;
}
.info strong {
  color: var(--gold);
}
.info small {
  color: var(--muted);
}
#mission {
  line-height: 1.5;
}
#actions {
  position: absolute;
  right: 14px;
  top: 82px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}
button.action,
.btn {
  pointer-events: auto;
  background: #1c4252;
  color: var(--ink);
  border: 1px solid #4f8992;
  border-radius: 9px;
  padding: 9px 13px;
  font-weight: 700;
  box-shadow: 0 3px 9px #0004;
}
button.action:hover,
.btn:hover {
  background: #276075;
}
button.action:disabled,
.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.primary {
  background: #27766e !important;
  border-color: #58c6a6 !important;
}
.danger {
  background: #713e40 !important;
  border-color: #d07873 !important;
}
.gold {
  color: var(--gold);
}
#log {
  position: absolute;
  bottom: 20px;
  left: 14px;
  width: min(380px, calc(100vw - 28px));
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.toast {
  border: 1px solid #4a7480;
  background: #0b2538d9;
  border-radius: 8px;
  padding: 7px 10px;
  box-shadow: 0 5px 16px #0005;
  font-size: 12px;
  line-height: 1.35;
}
.toast.warn {
  border-color: #c68956;
  color: #ffe2a2;
}
.toast.bad {
  border-color: #d46d68;
  color: #ffd0c9;
}
#hint {
  position: absolute;
  bottom: 13px;
  right: 14px;
  background: #081f30cf;
  border: 1px solid #305065;
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 12px;
  color: #b1d6d6;
  max-width: 300px;
  text-align: right;
}
#overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: #030e18b9;
  pointer-events: auto;
  padding: 12px;
  backdrop-filter: blur(3px);
}
#overlay.show {
  display: flex;
}
.modal {
  width: min(1000px, 96vw);
  max-height: 93vh;
  overflow-y: auto;
  background: linear-gradient(140deg, #17374a, #091e2d);
  border: 1px solid #4d7b81;
  border-radius: 16px;
  box-shadow: 0 25px 90px #000b;
  padding: 22px;
}
.modal h1,
.modal h2 {
  font-family: Georgia, serif;
  color: var(--gold);
  margin: 0 0 10px;
}
.modal p {
  font-size: 14px;
  color: #b7d3d6;
  line-height: 1.5;
}
.modal header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.close {
  background: none;
  border: 1px solid #587780;
  color: #fff;
  border-radius: 8px;
  padding: 7px 10px;
}
.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.pane {
  background: #09223388;
  border: 1px solid #315469;
  border-radius: 12px;
  padding: 12px;
}
.pane h3 {
  margin: 0 0 9px;
  color: var(--teal);
  font-size: 15px;
}
.goods {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.goods th {
  text-align: left;
  color: #aac4c9;
  font-size: 11px;
  padding: 8px 4px;
  border-bottom: 1px solid #36576a;
}
.goods td {
  padding: 10px 4px;
  border-bottom: 1px solid #274456;
}
.goods td:last-child {
  text-align: right;
}
.goods .btn {
  padding: 7px 10px;
  margin: 2px;
  font-size: 12px;
  white-space: nowrap;
}
.goods .buy-btn {
  background: #176455;
  border: 1px solid #4ed0ae;
  color: #f1fff7;
}
.goods .sell-btn {
  background: #70501d;
  border: 1px solid #e9b866;
  color: #fff7e4;
}
.goods th.buy-heading {
  color: #81e6ca;
}
.goods th.sell-heading {
  color: #ffd18a;
}
.goods td.trade-buy,
.goods td.trade-sell {
  text-align: center;
}
.goods th.trade-buy,
.goods th.trade-sell {
  text-align: center;
}
.goods td.trade-buy {
  background: #1e765419;
}
.goods td.trade-sell {
  background: #b7842f12;
}
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #2a4c5a;
  padding: 10px 0;
  font-size: 13px;
}
.row:last-child {
  border: 0;
}
.row small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}
.full {
  width: 100%;
}
.sub {
  font-size: 12px;
  color: var(--muted);
}
.kbd {
  color: var(--gold);
  font-weight: bold;
}
.map-legend {
  color: #b4d6d9;
  font-size: 12px;
}
#start {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, #235064e8, #071522ef 75%);
  pointer-events: auto;
  text-align: center;
  padding: 20px;
}
#start.hide {
  display: none;
}
.start-card {
  max-width: 570px;
  background: #0b2335c9;
  border: 1px solid #567a7c;
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 25px 80px #0008;
}
.start-card h1 {
  font:
    700 clamp(38px, 7vw, 72px) Georgia,
    serif;
  color: #f5c978;
  margin: 0;
  text-shadow: 0 4px #542c1d;
}
.start-card h2 {
  font:
    normal 18px Georgia,
    serif;
  color: #b6dfd2;
  margin: 4px 0 20px;
  letter-spacing: 4px;
}
.start-card p {
  line-height: 1.7;
  color: #c6d7da;
}
.start-card button {
  font-size: 17px;
  padding: 14px 27px;
}
.footer {
  margin-top: 15px;
  font-size: 12px;
  color: #80a9b6;
}
#mobile {
  display: none;
  position: absolute;
  bottom: 110px;
  right: 20px;
  pointer-events: auto;
  grid-template-columns: repeat(3, 48px);
  grid-template-rows: repeat(2, 45px);
  gap: 4px;
}
#mobile button {
  border-radius: 10px;
  background: #17364ab9;
  color: white;
  border: 1px solid #4b7b87;
  font-size: 22px;
  touch-action: none;
}
#mobile .up {
  grid-column: 2;
  grid-row: 1;
}
#mobile .lt {
  grid-column: 1;
  grid-row: 2;
}
#mobile .dn {
  grid-column: 2;
  grid-row: 2;
}
#mobile .rt {
  grid-column: 3;
  grid-row: 2;
}
@media (max-width: 720px) {
  #topbar {
    gap: 5px;
    padding: 8px;
  }
  .brand {
    font-size: 18px;
    width: 100%;
  }
  .pill {
    font-size: 11px;
    padding: 5px 7px;
  }
  #leftInfo {
    top: 94px;
    left: 7px;
    max-width: 210px;
  }
  .info {
    font-size: 11px;
    padding: 8px;
  }
  #actions {
    top: 95px;
    right: 7px;
  }
  button.action {
    padding: 7px 8px;
    font-size: 11px;
  }
  #hint {
    display: none;
  }
  #mobile {
    display: grid;
  }
  #log {
    bottom: 10px;
    max-width: 230px;
  }
  .toast {
    font-size: 10px;
  }
  .two {
    grid-template-columns: 1fr;
  }
  .modal {
    padding: 14px;
  }
  .goods td {
    padding: 8px 2px;
  }
  .goods .btn {
    padding: 5px 7px;
  }
}

#fireBtn {
  border-color: #e9a969;
  color: #ffcf8e;
  background: #70402dbe;
}
#fireBtn:disabled {
  opacity: 0.45;
}
.captain {
  border: 1px solid #396271;
  border-radius: 10px;
  padding: 12px;
  margin: 10px 0;
  background: #123246;
}
.captain .row {
  gap: 12px;
}
.captain .row button {
  flex-shrink: 0;
}
.market-scroll {
  overflow-x: auto;
}
.goods td {
  white-space: nowrap;
}
.stockbar {
  height: 5px;
  width: 90px;
  background: #304b5d;
  border-radius: 9px;
  overflow: hidden;
  margin: 3px 0;
}
.stockbar i {
  display: block;
  height: 100%;
  background: #61c9ad;
}
.role-prod {
  color: #83e4af;
}
.role-cons {
  color: #ffcb8b;
}
.goods small {
  display: block;
  font-size: 10px;
  color: #a6bec4;
  margin-top: 3px;
}
