/* Common wood, brass, and parchment surfaces. */
.game-shell { --brass-edge: #b9925c; --patinated-gold: #e0ba7e; --oak-shadow: #251c18; }
.topbar, .nav {
  background-image: linear-gradient(180deg,#50392446,#160f0e78),url("../img/ui/wood.webp");
  border-color: #af8955;
}
.nav button.active { border-radius: 12px; background: radial-gradient(ellipse at top,#79553b,#382720 75%); }
.sheet[data-scene] { isolation: isolate; }
.section-motion {
  position: absolute;
  z-index: -1;
  inset: 0 0 auto;
  height: clamp(130px,27vh,250px);
  overflow: hidden;
  pointer-events: none;
  mask-image: linear-gradient(#000 0 70%,transparent);
}
.section-glow {
  position: absolute;
  inset: -10%;
  background: radial-gradient(ellipse at 23% 44%,#e4c28c52,transparent 37%),
    radial-gradient(ellipse at 80% 34%,#9cbfc637,transparent 37%);
  animation: section-light 12s ease-in-out infinite alternate;
}
@keyframes section-light { from { transform: translate(-3%,-2%); opacity: .35; } to { transform: translate(5%,3%); opacity: .85; } }
.section-actor {
  position: absolute;
  bottom: 19%;
  width: 50px;
  height: 70px;
  background: url("../img/actors/warehouse_walk.png") 0 0/200px 70px no-repeat;
  opacity: .8;
  filter: brightness(.78) saturate(.72) drop-shadow(1px 7px 5px #0e0a06af);
  animation: actor-steps .86s steps(4) infinite, harbor-walk 23s linear infinite;
}
.section-actor.second { bottom: 29%; left: 70%; scale: .75; animation-delay: -.35s,-13s; }
@keyframes harbor-walk {
  0% { left: 9%; transform: scaleX(1); opacity: 0; }
  12%, 38% { opacity: .78; }
  49% { left: 73%; transform: scaleX(1); opacity: 0; }
  50% { left: 73%; transform: scaleX(-1); opacity: 0; }
  62%, 85% { opacity: .78; }
  100% { left: 9%; transform: scaleX(-1); opacity: 0; }
}
.sheet:is([data-scene="ships"],[data-scene="shipyard"],[data-scene="sawmill"]) .section-actor { background-image: url("../img/actors/shipyard_walk.png"); }
.sheet:is([data-scene="islands"],[data-scene="farm"],[data-scene="stela"]) .section-actor { background-image: url("../img/actors/farm_walk.png"); }
.sheet:is([data-scene="shop"],[data-scene="help"]) .section-actor { display: none; }
.sheet:is([data-scene="shop"],[data-scene="help"],[data-scene="tavern"]) .section-glow {
  background: radial-gradient(ellipse at 62% 43%,#f4b46080,transparent 40%);
  animation-duration: 7s;
}
.sheet:is([data-scene="shop"],[data-scene="help"]) .section-motion { height: 100%; mask-image: none; }

/* Island building cards. */
.building-tiles { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,192px),1fr)); gap: clamp(10px,1.8vw,22px); }
.building-tile {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #af8150;
  border-radius: 16px;
  background: linear-gradient(145deg,#573d2d,#392d25 67%,#26251f);
  box-shadow: inset 0 1px 2px #ffe5b455, inset 0 0 0 3px #543922, 0 6px 12px #090f15aa;
}
#sheetContent .building-tile .building-scene-open {
  position: relative;
  display: block;
  width: 100%;
  min-height: 0;
  height: clamp(119px,17vw,181px);
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-bottom: 1px solid #a67c4f;
  border-radius: 15px 15px 0 0;
  background: radial-gradient(ellipse at 50% 35%,#d3ab6b42,transparent 71%),linear-gradient(155deg,#514331,#242924);
  color: #f8e0b7;
  text-align: left;
}
#sheetContent .building-tile .building-scene-open img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 55%;
  border: 0;
  filter: saturate(.78);
  transition: transform .22s ease;
}
#sheetContent .building-tile .building-scene-open img.diorama {
  width: 100%;
  height: 84%;
  object-fit: contain;
  object-position: center bottom;
  padding: 7px 9px 6px;
  filter: saturate(.8) drop-shadow(0 5px 5px #211711a8);
}
.building-tile .building-scene-open:hover img { transform: scale(1.04); }
.building-tile .building-scene-open strong {
  position: absolute;
  z-index: 1;
  inset: auto 0 0;
  min-height: 33px;
  padding: 6px 9px 6px 40px;
  color: #ffe7be;
  background: linear-gradient(#5e4837ef,#302720fb);
  box-shadow: inset 0 1px #dcb67c6e;
  font: 700 clamp(16px,1.65vw,22px)/1.1 var(--chrome-font);
}
.building-level {
  position: absolute;
  z-index: 2;
  left: 8px;
  bottom: 6px;
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border: 1px solid #f0ca86;
  border-radius: 50%;
  background: radial-gradient(at 35% 20%,#f7da9f,#c18c52 62%,#845535);
  color: #3c2719;
  box-shadow: inset 0 1px 2px #fff5c4c1, 0 2px 3px #24140bd7;
  font: 800 13px var(--read-font);
}
.building-comparison { display: grid; gap: 5px; margin: 0; padding: 9px 10px; font: 500 12px/1.35 var(--read-font); }
.building-comparison div { display: grid; gap: 2px; border-radius: 5px; padding: 4px 6px; background: #221c185a; }
.building-comparison div+div { background: #58645147; }
.building-comparison dt { color: #d6b98e; font-size: 10px; }
.building-comparison dd { color: #fff0d4; margin: 0; overflow-wrap: anywhere; }
.building-comparison div+div dd { color: #d1e5be; }
.scene-controls .building-comparison { grid-template-columns: repeat(2,minmax(0,1fr)); margin-bottom: 10px; padding: 0; }
.building-tile-action { margin-top: auto; padding: 0 10px 10px; }
.building-upgrade, .building-lock {
  min-height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  padding: 4px 6px;
  border: 1px solid #cfa96f;
  border-radius: 8px;
  color: #fff0c6;
  font: 700 13px/1.15 var(--read-font);
  text-align: center;
  background: radial-gradient(ellipse at top,#7d89715e,transparent 70%),linear-gradient(#54614a,#293b34);
  box-shadow: inset 0 1px 2px #f7e1ac66, 0 2px 3px #211710;
}
.building-upgrade .icon { width: 18px; height: 18px; }
.building-lock { border-color: #8b7156; background: #2f2b25; color: #dbc9af; font-size: 11px; }
@media (max-width:550px) { .building-tiles { grid-template-columns: repeat(2,minmax(0,1fr)); } }

/* The mariner's book. */
.sheet[data-scene="help"] { --sheet-opening-gap: clamp(14px,4vh,44px); }
.sheet[data-scene="help"] #sheetContent,
.sheet[data-scene="shop"] #sheetContent { padding: 0; background: transparent; border: 0; box-shadow: none; }
.guide-book {
  color: #4d3322;
  padding: 9px 12px 12px;
  border: 1px solid #9c714a;
  border-radius: 13px;
  background: linear-gradient(140deg,#3e5145cc,#13261ff2),url("../img/ui/wood.webp");
  box-shadow: inset 0 0 0 3px #c4a37255, inset 0 0 0 6px #1b2b25, 0 17px 30px #100e0bc9;
}
.guide-toolbar, .guide-turn { display: flex; align-items: center; justify-content: space-between; gap: 7px; color: #f0d9ab; }
.guide-toolbar {
  margin: 0 1px 9px;
  padding: 4px 5px;
  border-radius: 7px;
  background: linear-gradient(#34453a,#202b24),url('../img/ui/wood.webp');
}
.guide-turn { margin: 12px 4px 0; }
.guide-contents {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  min-height: 34px;
  padding: 4px 10px;
  border: 1px solid #b78f5b;
  border-radius: 8px;
  color: #f7e0b4;
  background: linear-gradient(#6b5138,#3d2b21);
  box-shadow: inset 0 1px #f7d79d72,0 2px 4px #121713;
  font: 600 14px var(--read-font);
}
.guide-contents .icon { width: 18px; height: 18px; }
.guide-spread {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  border-radius: 4px 7px 7px 4px;
  background: #d8bf92;
  box-shadow: 0 1px #8a6d4d,0 3px #d4b181,0 5px #785f45,0 7px #c79f6f,0 11px 15px #1b1914b5;
  overflow: hidden;
}
.guide-page {
  padding: clamp(14px,3.1vw,43px);
  background: linear-gradient(90deg,#b9834f26,transparent 10% 88%,#6547334d),url("../img/ui/parchment.webp");
  border: 1px solid #9d724c;
}
.guide-page + .guide-page {
  background-image: linear-gradient(90deg,#6948306b,transparent 7% 88%,#95704528),url("../img/ui/parchment.webp");
  border-left-color: #794b30;
}
#sheetContent .guide-page h2 { margin: 0 0 12px; color: #57351e; line-height: 1; font-size: clamp(29px,5vw,61px); text-shadow: 0 1px 0 #fff2cd; }
#sheetContent .guide-page h3 { margin: 7px 0 5px; color: #674120; font-size: clamp(23px,3.1vw,36px); }
#sheetContent .guide-page p { color: #45342a; margin: 7px 0 13px; font: 500 clamp(13px,1.36vw,17px)/1.65 var(--read-font); }
#sheetContent .guide-cover p, #sheetContent .guide-page .guide-chapter { color: #825935; font: 700 14px var(--read-font); }
.guide-page figure { position: relative; margin: 0; padding: 5px; border: 1px solid #b18a57; border-radius: 8px; background: #7d4c2f18; }
.guide-page figure img, .guide-cover img {
  display: block;
  width: 100%;
  max-height: 300px;
  object-fit: cover;
  border-radius: 5px;
  filter: saturate(.78) sepia(.13);
}
.guide-cover img { margin-top: 8px; border: 1px solid #ab8057; }
.guide-page .ship-plate img { object-fit: contain; padding: 6px; }
.guide-page figcaption { text-align: center; padding: 5px 0 0; color: #654b35; font: italic 14px var(--chrome-font); }
.guide-index details { padding-bottom: 5px; margin-bottom: 4px; border-bottom: 1px solid #a2774b5c; }
.guide-index summary { cursor: pointer; color: #674120; font: 600 23px/1.05 var(--chrome-font); }
.guide-index ul { display: flex; flex-wrap: wrap; gap: 2px 12px; list-style: none; margin: 2px 0; padding-left: 14px; }
.book-link { border: 0; background: none; padding: 3px 0; color: #724420; text-decoration: underline; text-underline-offset: 3px; font: inherit; text-align: left; }
.guide-index li, .guide-links { font: 500 12px/1.35 var(--read-font); }
.guide-links { display: grid; justify-items: start; }
.guide-example, .guide-callout {
  padding: 6px 12px 3px;
  border: 1px solid #b38958;
  border-left: 3px solid #9e774c;
  border-radius: 6px;
  background: #d4ab6740;
}
.guide-loader { padding: 14px; color: #dec39a; }

.chest-preview { text-align: center; padding: 5px; }
.chest-preview img { max-width: min(100%,270px); max-height: 230px; object-fit: contain; filter: drop-shadow(0 7px 7px #633e3059); }
@media (max-width:550px) {
  .guide-spread { grid-template-columns: minmax(0,1fr); }
  .guide-page + .guide-page { border-left-color: #9d724c; }
  .guide-cover img { max-height: 155px; object-position: center 64%; }
}

/* Embossed slider tracks and a golden thumb. */
.slider-field { margin: 8px 0 13px; }
.slider-caption, .slider-controls { display: flex; align-items: center; gap: 8px; }
.slider-caption { justify-content: space-between; }
.dialog .slider-caption label { display: block; margin: 0; color: #67472b; font-weight: 600; }
.slider-caption output {
  flex: none;
  padding: 3px 8px;
  color: #ffe6af;
  background: linear-gradient(#6e5139,#3c2a1e);
  border: 1px solid #b58a55;
  border-radius: 6px;
  box-shadow: inset 0 1px #f8d9a175,0 2px 3px #654c383e;
  font: 600 13px var(--read-font);
  font-variant-numeric: tabular-nums;
}
.slider-controls { margin: 3px 0; }
.slider-controls .relief-icon { width: 30px; height: 30px; font: 700 18px system-ui; }
.dialog .slider-controls input[type="range"] {
  appearance: none;
  display: block;
  flex: 1;
  min-width: 0;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  cursor: ew-resize;
}
.slider-controls input::-webkit-slider-runnable-track {
  height: 12px;
  border: 1px solid #8b6540;
  border-radius: 12px;
  background: linear-gradient(90deg,#cda869 var(--fill,0%),#594537 var(--fill,0%));
  box-shadow: inset 0 2px 4px #21180fba,inset 0 -2px 2px #ebc88650,0 2px #ffe2ac;
}
.slider-controls input::-moz-range-track {
  height: 10px;
  border: 1px solid #8b6540;
  border-radius: 12px;
  background: linear-gradient(90deg,#cda869 var(--fill,0%),#594537 var(--fill,0%));
  box-shadow: inset 0 2px 4px #21180fba,0 2px #ffe2ac;
}
.slider-controls input::-webkit-slider-thumb {
  appearance: none;
  width: 23px;
  height: 23px;
  margin-top: -6px;
  border: 1px solid #9f6e37;
  border-radius: 50%;
  background: radial-gradient(circle at 33% 26%,#fff2c2 8%,#edc280 32%,#ab7545 76%);
  box-shadow: inset 0 1px 3px #fff5d4,0 2px 4px #342111c7;
}
.slider-controls input::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border: 1px solid #9f6e37;
  border-radius: 50%;
  background: radial-gradient(circle at 33% 26%,#fff2c2 8%,#edc280 32%,#ab7545 76%);
  box-shadow: inset 0 1px 3px #fff5d4,0 2px 4px #342111c7;
}
.recruit-destination {
  padding: 9px 12px;
  border: 1px solid #b58a55;
  border-radius: 8px;
  background: linear-gradient(#ffeac0,#ead3ab);
}
.recruit-destination span { display: block; font: 500 13px/1.5 var(--read-font); }
@media (prefers-reduced-motion:reduce) { .section-glow,.section-actor { animation: none; } }

/* Match the bottom navigation's face across the application. */
:root { --chrome-font: var(--read-font); }
#app, #app *, #overlay, #overlay *, #toast, #elementTip, #contactNotice { font-family: var(--read-font) !important; }
.section-heading {
  display: flex;
  align-items: center;
  gap: clamp(6px,1.1vw,13px);
  margin: 0 0 17px;
  padding: 0 0 9px;
  border-bottom: 1px solid #c6a37065;
}
#sheetContent .section-heading h2 {
  margin: 0;
  color: #f3dcb1;
  font-size: clamp(23px,3.4vw,39px);
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -.035em;
}
.section-emblem {
  display: grid;
  place-items: center;
  flex: none;
  width: clamp(38px,5.6vw,62px);
  aspect-ratio: 1;
  border: 1px solid #af8957;
  border-radius: 12px;
  background: radial-gradient(ellipse at 32% 17%,#85694c,#443b2e 68%,#28251f);
  box-shadow: inset 0 1px #e6c58b88,0 3px 4px #121716;
}
.section-emblem img { display: block; width: 85%; height: 85%; object-fit: contain; filter: drop-shadow(0 3px 3px #21100a); }
.section-heading small { margin-left: auto; color: #e8d5b5; font-size: 12px; text-align: right; }
#sheetContent .captain-roster h4 { margin: 1px 0 4px; color: #4a301f; font-size: 17px; }
#sheetContent .captain-roster p { margin: 4px 0; color: #614836; }
.captain-roster { color: #5a3c28; overflow-wrap:anywhere; }
.captain-traits { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.captain-roster .helm-action[aria-disabled="true"] { opacity: .63; cursor: default; }
#sheetContent .local-resources .resource-pill small { color: #674e35; }
#sheetContent .local-resources .resource-pill strong { color: #523921; }

.cargo-unload-row[hidden] { display: none; }
.cargo-unload-row { border-bottom: 1px solid #ad7d4d52; }
.dialog .cargo-unload-row .slider-caption label { display: flex; align-items: center; gap: 6px; margin-inline-end: auto; }
.cargo-unload-row .resource-icon { width: 23px; height: 23px; }
.dialog .cargo-unload-row input[type="number"] {
  width: min(27%, 100px);
  padding: 4px 6px;
  margin: 0;
  text-align: end;
  font-variant-numeric: tabular-nums;
}
.cargo-unload-row .slider-caption span { white-space: nowrap; color: #725033; }
#cargoUnloadForm :is([type="submit"], [data-unload-all]):disabled { opacity: .5; cursor: default; }
#unloadStatus { color: #6e4c31; font-size: .9em; margin: 8px 0 12px; }

.cargo-unload-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.cargo-unload-actions [type="submit"] { grid-column: 1 / -1; }
.ship-transfer-head {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid #ad7d4d75;
}
.ship-transfer-head > div { display: grid; gap: 3px; overflow-wrap: anywhere; }
.ship-transfer-head > div:last-child { text-align: end; }
.ship-transfer-head output { font-size: 13px; }
.ship-transfer-head .over-capacity, #shipTransferStatus { color: #963525; }
.ship-transfer-row { padding: 3px 0; margin: 0; }
.ship-transfer-label { display: flex; gap: 8px; align-items: center; }
.dialog .ship-transfer-label label { margin: 0; line-height: 1.1; }
.ship-transfer-label :is(.icon,.resource-icon) { width: 19px; height: 19px; }
.ship-transfer-controls { margin: 0; }
.ship-transfer-controls output, .dialog .ship-transfer-controls input[type="number"] {
  width: 5.2em;
  flex: none;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.dialog .ship-transfer-controls input[type="number"] { min-height: 28px; padding-block: 2px; }
.directory-filters {
  display: grid;
  grid-template-columns: minmax(0,3fr) minmax(6em,2fr);
  gap: 10px;
}
.directory-list { list-style: none; margin: 10px 0; padding: 0; }
.directory-entry { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; padding: 9px 0; border-bottom: 1px solid #ad7d4d52; }
.directory-entry .flag-stamp { flex: none; }
.directory-entry > strong { flex: 1; overflow-wrap: anywhere; }
/* Compact rankings only; keep clan and warehouse directories unchanged. */
#rankingsRows .directory-list { margin-block: 5px; }
#overlay .dialog #rankingsRows .directory-entry { padding-block: 4.5px; row-gap: 3.5px; font-size: 14.3px; line-height: 1.205; }
.directory-entry .woodbtn { padding: 5px 7px; min-height: 30px; font-size: 12px; }
.clan-list-card { border-top: 1px solid #ad7d4d52; padding-top: 10px; }
.clan-list-card p { overflow-wrap: anywhere; }
.action-confirmation > .confirmation-icon { margin: 0 auto 9px; }
.action-confirmation > p, .action-confirmation .build-time { text-align: center; }
.action-confirmation .resource-values { justify-content: center; }
.action-confirmation > .row { justify-content: center; }
.directory-entry > span .icon { width: 15px; height: 15px; vertical-align: middle; }
@media (min-width: 500px) {
  .cargo-unload-actions { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .cargo-unload-actions [type="submit"] { grid-column: auto; }
}
