:root {
  --chrome-font: "Cormorant Garamond", Georgia, serif;
  --read-font: "Golos Text", system-ui, sans-serif;
  --ivory: #f1e2c8;
  --gilt: #c3995b;
}

body { font-family: var(--read-font); }
.topbar, .nav {
  background-image: linear-gradient(110deg,#15191bee,#2b2118e8 48%,#132127ed),url("../img/ui/wood.webp");
  border-color: #9d7744;
}
.brand { font-size: clamp(23px,3.1vw,33px); font-weight: 700; }
.top-action, .top-action:hover, .top-action:focus-visible,
.nav button, .nav button.active, .nav button:hover, .nav button:focus-visible {
  border-color: transparent;
  border-radius: 5px;
  background: none;
  box-shadow: none;
  transform: none;
}
.top-action { overflow: visible; }
.top-picto { width: 33px; height: 33px; object-fit: contain; filter: drop-shadow(0 3px 3px #0008); }
.nav {
  justify-content: center;
  gap: clamp(1px,1vw,12px);
  padding-inline: clamp(2px,2vw,20px);
}
.nav button { position: relative; gap: 3px; flex: 1 1 0; min-width: 0; max-width: 132px; }
.nav .nav-art { width: 53px; height: 50px; transform: none; filter: drop-shadow(0 3px 3px #000a); }
.nav button small { color: #e7d8be; font: 500 clamp(11px,1.18vw,14px)/1.1 var(--read-font); }
.nav button.active small { color: #ffdf9a; }
.nav button.active::before {
  content: "";
  position: absolute;
  bottom: 0;
  width: min(42%,44px);
  height: 2px;
  border-radius: 50%;
  background: #edc276;
  box-shadow: 0 0 7px #ffd78c85;
}
.nav button::after, .pictobtn::after, .scene-return::after { content: none; animation: none; }
.nav button:hover .nav-art, .pictobtn:hover img, .nav button:focus-visible .nav-art {
  transform: none;
  filter: drop-shadow(0 3px 3px #000a);
}

.woodbtn.pictobtn, .woodbtn.pictobtn:hover:not(:disabled) {
  min-height: 70px !important;
  border: 0;
  border-radius: 8px;
  background: none;
  box-shadow: none !important;
  transform: none;
  color: var(--pictogram-ink,#573b24);
  text-shadow: none;
}
.woodbtn.pictobtn span { font: 600 13px/1.2 var(--read-font); }
.pictobtn img { height: 52px; width: 55px; }
.action-unit .action-info { z-index: 4; }

@keyframes icon-arrival {
  0%,100% { transform: translateY(0) scale(1); filter: drop-shadow(0 3px 3px #0008); }
  40% { transform: translateY(-4px) scale(1.12); filter: drop-shadow(0 2px 6px #f2c374b0) brightness(1.16); }
}
@media (hover:hover) {
  .nav button:hover .nav-art, .top-action:hover .top-picto, .woodbtn.pictobtn:hover:not(:disabled) img {
    animation: icon-arrival .42s ease-out 1;
  }
}

.game-shell {
  --scene-art: url("../img/scenes/islands.webp?v=15.2");
  --scene-position: center 47%;
}
.sheet {
  --sheet-opening-gap: clamp(110px,22vh,232px);
}
.game-shell[data-scene="ships"] { --scene-art: url("../img/scenes/ships.webp?v=15.2"); }
.game-shell[data-scene="market"] { --scene-art: url("../img/scenes/market.webp?v=15.2"); }
.game-shell[data-scene="tavern"] { --scene-art: url("../img/scenes/tavern.webp?v=15.2"); }
.game-shell[data-scene="shop"] { --scene-art: url("../img/scenes/shop.webp?v=15.2"); }
.game-shell[data-scene="help"] { --scene-art: url("../img/scenes/help.webp?v=15.2"); }
.game-shell[data-scene="warehouse"] { --scene-art: url("../img/scenes/warehouse.webp?v=15.2"); }
.game-shell[data-scene="farm"] { --scene-art: url("../img/scenes/farm.webp?v=15.2"); }
.game-shell[data-scene="shipyard"] { --scene-art: url("../img/scenes/shipyard.webp?v=15.2"); }
.game-shell[data-scene="fort"] { --scene-art: url("../img/scenes/fort.webp?v=15.2"); }
.game-shell[data-scene="sawmill"] { --scene-art: url("../img/scenes/sawmill.webp?v=15.2"); }
.game-shell[data-scene="mine"] { --scene-art: url("../img/scenes/mine.webp?v=15.2"); }
.game-shell[data-scene="armory"] { --scene-art: url("../img/scenes/armory.webp?v=15.2"); }
.game-shell[data-scene="stela"] { --scene-art: url("../img/scenes/stela.webp?v=15.2"); }
.sheet #sheetContent {
  --pictogram-ink: #f0d4a4;
  position: relative;
  min-height: 0;
  max-width: 1100px;
  margin-block-start: var(--sheet-opening-gap);
  border: 1px solid #b78e53;
  border-radius: 14px;
  padding: clamp(14px,3vw,32px);
  background: linear-gradient(132deg,#192e34f5,#172229f8 66%,#1f2429f5);
  color: var(--ivory);
  box-shadow: 0 15px 45px #061019af, inset 0 0 0 3px #ad794348;
}
#sheetContent > h2, #sheetContent > .section-head h2,
#sheetContent h3, #sheetContent .scene-title h2 {
  color: #f6d9a3;
  text-shadow: none;
  font-family: var(--chrome-font);
}
#sheetContent > h2, #sheetContent > .section-head h2 { font-size: clamp(34px,4.5vw,56px); margin-block: 0 15px; }
#sheetContent p, #sheetContent .scene-island-name, #sheetContent .section-head > span { color: #e5d3b3; }
#sheetContent .service-tile p, #sheetContent .ship-side p, #sheetContent .item p { color: #513e29; }
#sheetContent .service-tile h3, #sheetContent .ship-side h3 { color: #553822; }
#sheetContent .captain-panel, #sheetContent .service-tile,
#sheetContent .item, #sheetContent .shop-card, .selection { --pictogram-ink: #513722; }
#sheetContent .building-scene-open { color: #f5dfb5; }
#sheetContent .building-scene-open b { font-size: 20px; }
#sheetContent .building-scene-open small { color: #ebdcc1; }
#sheetContent .inside-scene { min-height: 0; }
#sheetContent .scene-room {
  background: linear-gradient(#18212a0a,#111b2587), var(--scene-art) center 58%/cover;
}
#sheetContent .scene-primary-art { display: none; }
.scene-top, .scene-controls, .building-row { border-color: #be9a5a54; }
.scene-return { color: #f2dbb4; background: #273338; border-color: #a47949; }
.scene-title small { color: #e6bd7a; }
#sheetContent .scene-stocks span { color: #4a331e; }

#sheetContent .ship-profile {
  margin: 10px 0 0;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
}
.ship-profile::before { display: none; }
.ship-profile-layout { align-items: start; grid-template-columns: minmax(0,1.15fr) minmax(0,1fr); gap: clamp(16px,3vw,35px); }
.ship-side {
  padding: clamp(12px,2vw,22px);
  background: linear-gradient(145deg,#f8ebcdee,#eddbbceb),url("../img/ui/parchment.webp") center/cover;
  border: 1px solid #b48a55;
  border-radius: 9px;
  color: #493422;
}
.ship-profile-heading { margin: 0; padding: 0; align-items: baseline; }
#sheetContent .ship-profile-heading h3 { font-size: clamp(25px,3vw,37px); margin: 0; text-align: left; }
.ship-summary { padding: 8px 0; }
.ship-side .ship-summary-line { font-family: var(--read-font); font-size: 13px; }
.ship-profile .ship-command-row .pictobtn { min-height: 70px !important; }
.ship-profile .advanced-actions { color: #eddbc0; border-color: #b48a555e; }
.ship-profile .advanced-actions summary { color: #eddbc0; }

.ship-poster.tabletop-card {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: max-content minmax(0,1fr);
  grid-template-rows: auto 1fr;
  width: 100%;
  height: auto;
  min-height: 0;
  margin: 0;
  padding: 10px;
  gap: 0;
  color: #492f1b;
  background:
    radial-gradient(ellipse at 0 10%,#89502c8c,transparent 35%),
    radial-gradient(ellipse at 100% 100%,#8d542975,transparent 32%),
    linear-gradient(135deg,#c39a5b,#f4dcaa 23%,#ecd5a0 79%,#af8146),
    url("../img/ui/parchment.webp") center/cover;
  background-blend-mode: multiply,multiply,soft-light,normal;
  border: 2px solid #623f22;
  border-radius: 12px;
  box-shadow: 0 10px 25px #071016a8,inset 0 0 0 2px #e3b670,inset 0 0 0 5px #82542f;
}
.ship-poster.tabletop-card::after {
  z-index: 4;
  inset: 6px;
  background: none;
  border: 1px solid #ddb77b;
  border-radius: 6px;
}
.tabletop-title {
  grid-column: 1/-1;
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 7px 8px 11px;
  border: 1px solid #9c753f;
  border-bottom: 0;
  background: linear-gradient(90deg,#bf985e,#f8e5bb 19%,#f4e0b4 81%,#b48a51);
}
.tabletop-title span { color: #734c2b; font: 600 11px/1.2 var(--read-font); letter-spacing: .09em; text-transform: uppercase; }
.tabletop-title strong { color: #49301c; font: 700 clamp(28px,4vw,46px)/.94 var(--chrome-font); text-align: center; overflow-wrap: anywhere; }
.tabletop-art {
  position: relative;
  isolation: isolate;
  grid-column: 2;
  grid-row: 2;
  display: grid;
  place-items: center;
  min-height: clamp(290px,36vw,480px);
  padding: 4px;
  border: 1px solid #8d6235;
  background:
    radial-gradient(ellipse at 70% 12%,#f3d59c87,transparent 61%),
    linear-gradient(155deg,#0b3d51a0,#0c263aea), url("../img/ocean.webp") center/cover;
  box-shadow: inset 0 0 22px #061824be;
}
.tabletop-art .ship-illustration, .ship-poster.compact .ship-illustration {
  position: static;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  animation: none;
  filter: drop-shadow(1px 10px 6px #071622b4);
}
.ship-poster.compact { display: grid; place-items: center; }
.tabletop-card .corner-stats {
  position: static;
  display: grid;
  grid-column: 1;
  grid-row: 2;
  grid-template-rows: repeat(6,1fr);
  padding: 5px 6px;
  margin: 0;
  border: 1px solid #916c3a;
  border-right: 0;
  background: linear-gradient(115deg,#c29353,#f1d8a3 35%,#d9b781);
}
.tabletop-card .corner-stat {
  position: static;
  display: grid;
  grid-template-columns: 30px 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  align-content: center;
  gap: 0 6px;
  min-width: 0;
  padding: 3px 1px;
  border: 0;
  border-bottom: 1px solid #a5784780;
  border-radius: 0;
  color: #4a301c;
  background: transparent;
  box-shadow: none;
  text-shadow: none;
}
.tabletop-card .corner-stat:last-child { border-bottom: 0; }
.stat-medallion {
  display: grid;
  grid-row: 1/3;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid #e9c182;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 23%,#6e6748,#254148 74%);
  box-shadow: 0 0 0 1px #78502c,0 2px 3px #5f402769;
}
.stat-medallion img { width: 23px; height: 23px; object-fit: contain; }
.tabletop-card dt { font: 600 10px/1.2 var(--read-font); }
.tabletop-card dd { margin: 0; font: 700 clamp(18px,2.15vw,26px)/1 var(--chrome-font); font-variant-numeric: tabular-nums; }

#sea.ordering .selection { visibility: hidden; }
@media (max-width:760px) {
  .ship-profile-layout { grid-template-columns: 1fr; }
  .ship-poster.tabletop-card { max-width: 500px; margin-inline: auto; }
  .sheet { --sheet-opening-gap: 98px; }
}
@media (max-width:430px) {
  .nav { gap: 0; padding-inline: 2px; }
  .nav .nav-art { height: 39px; width: 39px; }
  .nav button small { font-size: clamp(8px,2.35vw,11px); letter-spacing: 0; }
  .top-picto { width: 25px; height: 25px; }
  .sheet #sheetContent { padding: 12px 9px 20px; }
  .ship-poster.tabletop-card { padding: 8px; }
  .tabletop-card .corner-stats { padding: 3px 4px; }
  .tabletop-card .corner-stat { grid-template-columns: 24px 1fr; column-gap: 5px; }
  .stat-medallion { width: 23px; height: 23px; }
  .stat-medallion img { width: 20px; height: 20px; }
  .tabletop-card dt { font-size: 9px; }
  .tabletop-art { min-height: 255px; }
}
@media (prefers-reduced-motion:reduce) {
 .nav button .nav-art,.top-action .top-picto,.woodbtn.pictobtn img { animation: none !important; }
}

@media (min-width:761px) {
  .sheet[data-view-key^="ships:"]:not([data-view-key="ships:list"]) {
    --sheet-opening-gap: clamp(44px,8vh,100px);
  }
  .tabletop-art {
    height: clamp(300px,41vh,430px);
    min-height: 0;
    overflow: hidden;
  }
}
