:root {
  color-scheme: light;
  --ink: #28180e;
  --panel: #f4dfb4;
  --panel-deep: #d4a75d;
  --sea: #1b7285;
  --sand: #eac06f;
  --green: #5d7e2a;
  --red: #b43a26;
  --blue: #1d5d8e;
  --shadow: 0 22px 60px rgba(30, 20, 10, 0.28);
}

* {
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background-color: #3b1e10;
  background-image: url("../assets/images/gui/table-background.png");
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.music-toggle {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  min-height: 46px;
  border: 2px solid rgba(255, 239, 198, 0.78);
  border-radius: 999px;
  color: #fff7dc;
  background: rgba(35, 23, 12, 0.9);
  box-shadow: 0 8px 18px rgba(12, 7, 4, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  font-size: 1.55rem;
  line-height: 1;
}

.music-toggle.active {
  color: #17394a;
  background: linear-gradient(#b9eefc, #5bb6d3);
  border-color: rgba(22, 70, 91, 0.82);
}

.music-toggle:hover,
.music-toggle:focus-visible {
  transform: translateY(-1px);
}

.app-shell {
  width: min(1360px, calc(100vw - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 180px;
  gap: 28px;
  align-items: center;
  padding: 24px 0;
}

.side-column {
  display: grid;
  gap: 16px;
  align-content: space-between;
  min-height: min(760px, calc(100vh - 48px));
}

.side-panel {
  position: relative;
  display: grid;
  gap: 12px;
  align-content: start;
  min-height: 300px;
  padding: 18px 18px 16px;
  border: 3px solid #1d1208;
  border-radius: 8px;
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 245, 198, 0.76), transparent 34%),
    radial-gradient(circle at 68% 78%, rgba(156, 93, 34, 0.16), transparent 34%),
    linear-gradient(135deg, rgba(255, 238, 179, 0.9), rgba(219, 157, 76, 0.78)),
    #e8bd75;
  box-shadow:
    inset 0 0 0 2px rgba(116, 67, 24, 0.58),
    inset 0 0 22px rgba(91, 48, 13, 0.26),
    var(--shadow);
}

.side-panel::before {
  content: "";
  position: absolute;
  inset: 8px;
  z-index: 0;
  border: 2px solid rgba(59, 33, 12, 0.72);
  border-radius: 6px;
  pointer-events: none;
}

.side-panel > * {
  position: relative;
  z-index: 1;
}

.eyebrow {
  display: flex;
  justify-content: center;
  margin: 0 0 8px;
  color: #ffe6aa;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
  text-shadow: 0 2px 0 rgba(60, 21, 8, 0.52);
}

.eyebrow span {
  position: relative;
  display: inline-grid;
  place-items: center;
  min-height: 30px;
  padding: 4px 24px;
  border: 2px solid #381609;
  background: linear-gradient(#c54628, #8f2519);
  box-shadow: inset 0 1px 0 rgba(255, 211, 134, 0.42), 0 3px 0 rgba(67, 25, 9, 0.34);
}

.eyebrow span::before,
.eyebrow span::after {
  content: "";
  position: absolute;
  top: 7px;
  width: 20px;
  height: 18px;
  border: 2px solid #381609;
  background: linear-gradient(#aa341f, #762017);
}

.eyebrow span::before {
  left: -20px;
  transform: skewY(-18deg);
}

.eyebrow span::after {
  right: -20px;
  transform: skewY(18deg);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  line-height: 0.95;
  text-align: center;
  text-shadow: 0 1px 0 rgba(255, 236, 181, 0.7);
}

h2 {
  margin-bottom: 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
}

.player-card-image {
  width: 42px;
  aspect-ratio: 1;
  border: 0;
  border-radius: 0;
  object-fit: cover;
  object-position: center;
  box-shadow: none;
}

.side-character-slot {
  display: grid;
  place-items: center;
  padding: 0;
}

.side-character-slot-top {
  align-self: start;
}

.side-character-slot-bottom {
  align-self: end;
}

.side-character-image {
  width: 100%;
  background: transparent;
  filter: drop-shadow(0 16px 26px rgba(19, 9, 3, 0.32));
  cursor: zoom-in;
  transition: transform 140ms ease, filter 140ms ease;
}

.side-character-image:hover,
.side-character-image:focus-visible {
  transform: translateY(-2px);
  outline: 3px solid rgba(255, 230, 122, 0.86);
  outline-offset: 3px;
  filter: drop-shadow(0 20px 32px rgba(19, 9, 3, 0.38));
}

.turn-box {
  min-height: 148px;
  padding: 16px;
  border: 2px solid #211306;
  border-radius: 8px;
  background:
    radial-gradient(circle at 20% 0%, rgba(110, 70, 35, 0.48), transparent 46%),
    rgba(36, 23, 13, 0.96);
  color: #fff1c9;
  box-shadow: inset 0 0 0 1px rgba(255, 232, 170, 0.08), 0 2px 0 rgba(70, 38, 13, 0.18);
}

.turn-box span {
  display: block;
  margin-bottom: 10px;
  font-size: 1.18rem;
  font-weight: 900;
}

.turn-box p {
  margin-bottom: 0;
  font-size: 1.06rem;
  font-weight: 750;
  line-height: 1.42;
}

.secondary-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  padding: 0 20px;
  border: 2px solid #321508;
  border-radius: 8px;
  color: #fff7dc;
  background: linear-gradient(#bd3b25, #8f2419);
  box-shadow: inset 0 1px 0 rgba(255, 208, 130, 0.38), 0 3px 0 rgba(60, 24, 8, 0.32);
  font-size: 1.18rem;
  text-shadow: 0 2px 0 rgba(58, 18, 6, 0.42);
}

.secondary-button span {
  color: #f5d46c;
  font-size: 1.1rem;
  text-shadow: 0 1px 0 #2a1608;
}

.secondary-button:hover,
.secondary-button:focus-visible {
  background: linear-gradient(#d04b2b, #98291d);
}

.board-area {
  display: grid;
  place-items: center;
  min-width: 0;
}

.board-stack {
  width: min(100%, calc(100vh - 140px), 820px);
  display: grid;
  gap: 8px;
}

.board-wrap {
  width: 100%;
  aspect-ratio: 1;
  padding: clamp(8px, 1.4vw, 14px);
  border-radius: 8px;
  background: rgba(60, 31, 13, 0.45);
  box-shadow: var(--shadow);
}

.sea-deck-panel {
  position: relative;
  display: grid;
  gap: 12px;
  justify-items: center;
  align-content: center;
  min-height: min(760px, calc(100vh - 48px));
}

.sea-deck-home,
.sea-card-reveal {
  display: grid;
  gap: 12px;
  justify-items: center;
  width: 100%;
}

.sea-deck-button {
  display: grid;
  justify-items: center;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: transparent;
  cursor: default;
}

.sea-deck-button:disabled {
  opacity: 1;
}

.sea-deck-panel.pending-discard .sea-deck-button {
  cursor: pointer;
}

.sea-deck-panel.pending-discard .sea-deck-card {
  filter:
    drop-shadow(0 0 0 rgba(255, 230, 112, 0.9))
    drop-shadow(0 0 22px rgba(255, 214, 74, 0.88))
    drop-shadow(0 18px 28px rgba(12, 7, 4, 0.34));
  animation: seaDeckPulse 1.2s ease-in-out infinite;
}

.sea-deck-panel.pending-discard .sea-deck-card::before {
  background: rgba(255, 236, 139, 0.88);
}

.sea-deck-panel.pending-discard .sea-deck-button:hover .sea-deck-card,
.sea-deck-panel.pending-discard .sea-deck-button:focus-visible .sea-deck-card {
  transform: translateY(-4px) rotate(-1deg);
}

.sea-deck-button:focus-visible {
  outline: 4px solid rgba(255, 230, 112, 0.86);
  outline-offset: 8px;
}

.sea-card-reveal {
  position: absolute;
  right: 0;
  z-index: 2;
}

.sea-deck-panel.revealed-for-player-2 .sea-card-reveal {
  top: 0;
}

.sea-deck-panel.revealed-for-player-1 .sea-card-reveal {
  bottom: 0;
}

.sea-deck-card {
  position: relative;
  display: block;
  width: 100%;
  max-width: 180px;
  aspect-ratio: 510 / 720;
  border-radius: 14px;
  filter: drop-shadow(0 18px 28px rgba(12, 7, 4, 0.34));
  transition: transform 160ms ease, filter 160ms ease;
}

.sea-deck-card::before,
.sea-deck-card::after {
  content: "";
  position: absolute;
  inset: 4px;
  z-index: 0;
  border-radius: 14px;
  background: rgba(223, 245, 255, 0.82);
  box-shadow: 0 2px 0 rgba(14, 55, 68, 0.32);
  transform: translate(7px, 7px) rotate(2deg);
}

.sea-deck-card::after {
  transform: translate(13px, 13px) rotate(4deg);
  opacity: 0.65;
}

.sea-deck-card img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  border: 3px solid rgba(20, 16, 12, 0.92);
  border-radius: 14px;
  object-fit: cover;
  background: #d9f5ff;
  box-shadow: 0 0 0 2px rgba(255, 239, 179, 0.52), 0 12px 24px rgba(12, 7, 4, 0.24);
}

.sea-deck-card.revealed::before,
.sea-deck-card.revealed::after {
  opacity: 0;
}

@keyframes seaDeckPulse {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-5px);
  }
}

.board-frame {
  --grid-top: 2.246%;
  --grid-right: 2.344%;
  --grid-bottom: 2.344%;
  --grid-left: 2.246%;
  --board-columns: 113fr 104fr 108fr 108fr 106fr 108fr 109fr 107fr 114fr;
  --board-rows: 97fr 108fr 110fr 107fr 109fr 104fr 107fr 108fr 127fr;
  display: grid;
  grid-template-columns: 28px 1fr;
  grid-template-rows: 1fr 28px;
  gap: 4px;
  width: 100%;
  height: 100%;
}

.row-labels,
.column-labels {
  color: #fff4d2;
  font-weight: 900;
  text-shadow: 0 2px 3px rgba(20, 10, 4, 0.65);
}

.row-labels {
  display: grid;
  grid-template-rows: var(--board-rows);
  grid-column: 1;
  grid-row: 1;
  padding: var(--grid-top) 0 var(--grid-bottom);
}

.column-labels {
  display: grid;
  grid-template-columns: var(--board-columns);
  grid-column: 2;
  grid-row: 2;
  padding: 0 var(--grid-right) 0 var(--grid-left);
}

.row-labels span,
.column-labels span {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  font-size: clamp(0.72rem, 1.5vw, 0.95rem);
  line-height: 1;
}

.board-hud {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(170px, 230px) minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 16px;
  row-gap: 2px;
  align-items: center;
  min-height: 76px;
  padding: 12px 18px;
  border: 3px solid #1d1208;
  border-radius: 8px;
  background:
    radial-gradient(circle at 18% 22%, rgba(255, 244, 191, 0.86), transparent 34%),
    radial-gradient(circle at 75% 62%, rgba(172, 97, 37, 0.16), transparent 36%),
    linear-gradient(135deg, rgba(255, 232, 170, 0.96), rgba(222, 157, 72, 0.82)),
    #e8bd75;
  box-shadow:
    inset 0 0 0 2px rgba(116, 67, 24, 0.52),
    inset 0 0 22px rgba(91, 48, 13, 0.22),
    0 10px 24px rgba(19, 9, 3, 0.2);
}

.board-hud::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(59, 33, 12, 0.46);
  border-radius: 6px;
  pointer-events: none;
}

.hud-clues {
  grid-column: 1 / -1;
  grid-row: 3;
  min-width: 0;
  color: #211306;
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-hud.active {
  border-color: #120a04;
  box-shadow:
    0 0 0 4px rgba(255, 230, 112, 0.72),
    0 0 26px rgba(255, 214, 74, 0.7),
    inset 0 0 0 2px rgba(116, 67, 24, 0.62),
    inset 0 0 24px rgba(91, 48, 13, 0.24),
    0 10px 24px rgba(19, 9, 3, 0.22);
}

.hud-player {
  grid-column: 1;
  grid-row: 1;
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  color: #1f130b;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.22rem;
  font-weight: 900;
  line-height: 1;
}

.hud-status {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  color: #4c2d11;
  font-size: 0.9rem;
  font-weight: 900;
  line-height: 1.12;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud-player::before {
  content: "";
  width: 27px;
  aspect-ratio: 1;
  flex: 0 0 auto;
  border: 3px solid #211306;
  border-radius: 999px;
  background: var(--red);
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.35), 0 2px 4px rgba(33, 17, 6, 0.28);
}

.player-two-hud .hud-player::before {
  background: var(--blue);
}

.hud-coins {
  grid-column: 2;
  grid-row: 1 / 3;
  position: relative;
  display: inline-flex;
  gap: 9px;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 7px 24px;
  border: 2px solid #4a2a11;
  border-radius: 6px;
  background:
    linear-gradient(90deg, rgba(139, 75, 26, 0.24), transparent 18%, transparent 82%, rgba(139, 75, 26, 0.24)),
    linear-gradient(#f6d68e, #d99c48);
  color: #211306;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.1rem;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px rgba(255, 239, 184, 0.6), 0 3px 0 rgba(88, 48, 17, 0.22);
}

.hud-coins::before,
.hud-coins::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 13px;
  height: 34px;
  border: 2px solid #4a2a11;
  background: linear-gradient(#f0c97a, #c48435);
  transform: translateY(-50%);
}

.hud-coins::before {
  left: -8px;
  border-right: 0;
  border-radius: 12px 0 0 12px;
}

.hud-coins::after {
  right: -8px;
  border-left: 0;
  border-radius: 0 12px 12px 0;
}

.coin-icon {
  width: 24px;
  aspect-ratio: 1;
  border: 2px solid #6d430d;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, rgba(46, 25, 6, 0.9) 0 16%, transparent 17%),
    radial-gradient(circle at 35% 30%, #fff3a6 0 14%, transparent 15%),
    linear-gradient(135deg, #f8d553, #c88a19);
  box-shadow: inset -2px -2px 0 rgba(115, 72, 10, 0.24), 0 2px 2px rgba(58, 31, 9, 0.26);
}

.hud-treasure {
  grid-column: 3;
  grid-row: 1 / 3;
  display: inline-flex;
  gap: 12px;
  align-items: center;
  justify-self: end;
  color: #211306;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.hud-treasure::after {
  content: "";
  width: 40px;
  height: 32px;
  flex: 0 0 auto;
  border: 3px solid #3a210e;
  border-radius: 7px 7px 4px 4px;
  background:
    linear-gradient(90deg, transparent 46%, rgba(61, 34, 13, 0.8) 47% 53%, transparent 54%),
    radial-gradient(circle at 50% 58%, #f2ce65 0 9%, #3a210e 10% 15%, transparent 16%),
    linear-gradient(#8d5226 0 42%, #5d3216 43% 100%);
  box-shadow: inset 0 2px 0 rgba(255, 203, 111, 0.3), 0 3px 5px rgba(38, 19, 6, 0.28);
}

.board-hud.carrying .hud-treasure {
  padding: 0;
  background: transparent;
  color: #8d2f22;
}

.board {
  --grid-line: rgba(40, 23, 12, 0.72);
  grid-column: 2;
  grid-row: 1;
  position: relative;
  display: grid;
  grid-template-columns: var(--board-columns);
  grid-template-rows: var(--board-rows);
  width: 100%;
  height: 100%;
  padding: var(--grid-top) var(--grid-right) var(--grid-bottom) var(--grid-left);
  overflow: hidden;
  border-radius: 6px;
  background: #2b6e7e;
  box-shadow: inset 0 0 0 2px rgba(33, 18, 8, 0.8);
}

.board::before,
.board::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.board::before {
  inset: 0;
  z-index: 0;
  background-image: url("../assets/images/board/board-map.png");
  background-size: cover;
  background-position: center;
}

.board::after {
  inset: var(--grid-top) var(--grid-right) var(--grid-bottom) var(--grid-left);
  z-index: 2;
  border: 0;
  background: none;
}

.cell {
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: rgba(13, 88, 118, 0.03);
}

.cell.island {
  background: rgba(243, 191, 84, 0.12);
}

.cell.available {
  background: rgba(255, 236, 144, 0.28);
}

.cell.move-target {
  background: rgba(136, 226, 156, 0.36);
}

.cell.dig-target {
  background: rgba(255, 205, 88, 0.48);
  box-shadow: inset 0 0 0 4px rgba(255, 246, 186, 0.8);
}

.cell.bottle-target {
  background: rgba(93, 161, 220, 0.42);
  box-shadow: inset 0 0 0 4px rgba(212, 234, 255, 0.78);
}

.cell.available:hover,
.cell.available:focus-visible {
  outline: 3px solid rgba(255, 250, 194, 0.96);
  outline-offset: -5px;
  background: rgba(255, 238, 136, 0.42);
}

.cell.move-target:hover,
.cell.move-target:focus-visible {
  background: rgba(143, 238, 166, 0.5);
}

.cell.dig-target:hover,
.cell.dig-target:focus-visible {
  background: rgba(255, 216, 99, 0.62);
}

.cell.bottle-target:hover,
.cell.bottle-target:focus-visible {
  background: rgba(102, 177, 238, 0.58);
}

.cell.unavailable {
  cursor: not-allowed;
}

.cell.unavailable::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(5, 48, 69, 0.28);
}

.cell.confirmed::before {
  content: "";
  position: absolute;
  inset: 24%;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px rgba(255, 244, 199, 0.75), 0 4px 12px rgba(20, 10, 4, 0.35);
}

.cell.player-1 {
  color: var(--red);
}

.cell.player-2 {
  color: var(--blue);
}

.cell.occupied {
  z-index: 4;
}

.cell.has-bottle {
  z-index: 3;
}

.cell.has-tile {
  z-index: 3;
}

.cell.occupied {
  z-index: 4;
}

.cell.tile-revealed {
  background: rgba(255, 224, 118, 0.24);
}

.island-tile {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  width: clamp(28px, 76%, 64px);
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 4px 7px rgba(18, 9, 3, 0.34));
  pointer-events: none;
}

.cell.tile-revealed .island-tile {
  width: clamp(30px, 82%, 68px);
  filter: drop-shadow(0 5px 9px rgba(18, 9, 3, 0.42));
}

.island-tile.clue-highlight {
  filter:
    drop-shadow(0 0 4px rgba(255, 243, 132, 0.95))
    drop-shadow(0 0 11px rgba(255, 225, 60, 0.85))
    drop-shadow(0 4px 7px rgba(18, 9, 3, 0.34));
}

.island-tile.clue-highlight-1 {
  filter:
    drop-shadow(0 0 4px rgba(255, 126, 103, 0.95))
    drop-shadow(0 0 12px rgba(255, 92, 72, 0.74))
    drop-shadow(0 4px 7px rgba(18, 9, 3, 0.34));
}

.island-tile.clue-highlight-2 {
  filter:
    drop-shadow(0 0 4px rgba(118, 204, 255, 0.95))
    drop-shadow(0 0 12px rgba(80, 184, 255, 0.78))
    drop-shadow(0 4px 7px rgba(18, 9, 3, 0.34));
}

.island-tile.clue-highlight-1.clue-highlight-2 {
  filter:
    drop-shadow(0 0 4px rgba(255, 243, 132, 0.95))
    drop-shadow(0 0 10px rgba(118, 204, 255, 0.78))
    drop-shadow(0 0 14px rgba(255, 92, 72, 0.55))
    drop-shadow(0 4px 7px rgba(18, 9, 3, 0.34));
}

.cell.tile-revealed .island-tile.clue-highlight {
  filter:
    drop-shadow(0 0 5px rgba(255, 243, 132, 0.95))
    drop-shadow(0 0 12px rgba(255, 225, 60, 0.85))
    drop-shadow(0 5px 9px rgba(18, 9, 3, 0.42));
}

.cell.active-occupied {
  background: rgba(255, 246, 186, 0.28);
}

.bottle {
  position: absolute;
  right: 9%;
  bottom: 9%;
  z-index: 4;
  width: clamp(15px, 28%, 26px);
  height: clamp(25px, 44%, 40px);
  border: 2px solid rgba(43, 24, 10, 0.72);
  border-radius: 45% 45% 36% 36%;
  background:
    linear-gradient(rgba(255, 255, 255, 0.42), transparent 40%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.34), transparent 42%),
    currentColor;
  box-shadow: 0 4px 9px rgba(19, 9, 3, 0.34), inset 0 0 0 3px rgba(255, 255, 255, 0.2);
  transform: rotate(14deg);
}

.bottle::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -30%;
  width: 44%;
  height: 34%;
  border: 2px solid rgba(43, 24, 10, 0.72);
  border-bottom: 0;
  border-radius: 5px 5px 0 0;
  background: currentColor;
  transform: translateX(-50%);
}

.bottle::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 40%;
  width: 56%;
  height: 26%;
  border-radius: 3px;
  background: rgba(255, 243, 196, 0.86);
  transform: translateX(-50%);
}

.bottle-1 {
  color: rgba(168, 66, 47, 0.9);
}

.bottle-2 {
  color: rgba(36, 90, 146, 0.9);
}

.character {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 5;
  display: block;
  width: clamp(28px, 48%, 46px);
  height: clamp(38px, 64%, 58px);
  color: #fff8d6;
  font-size: clamp(0.78rem, 1.6vw, 0.98rem);
  font-weight: 900;
  transform: translate(-50%, -50%);
  transition: transform 2s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: transform;
}

.character-moving {
  z-index: 8;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .character {
    transition: none;
  }
}

.character-on-island {
  left: 72%;
  top: 33%;
  width: clamp(22px, 34%, 34px);
  height: clamp(30px, 46%, 44px);
  font-size: clamp(0.68rem, 1.2vw, 0.82rem);
  transform: translate(-50%, -50%);
}

.cell.duel-stack .character-1 {
  left: 40%;
}

.cell.duel-stack .character-2 {
  left: 62%;
}

.cell.duel-stack .character-on-island {
  top: 34%;
}

.cell.dig-target .character-on-island,
.cell.tile-revealed .character-on-island {
  left: 76%;
  top: 28%;
  width: clamp(20px, 30%, 31px);
  height: clamp(28px, 42%, 40px);
}

.character-head,
.character-body {
  position: absolute;
  left: 50%;
  border: 0;
  background: inherit;
  box-shadow: 0 5px 12px rgba(19, 9, 3, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.2);
}

.character-head {
  top: 0;
  width: 50%;
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translateX(-50%);
}

.character-body {
  bottom: 0;
  display: grid;
  place-items: center;
  width: 78%;
  height: 62%;
  border-radius: 45% 45% 35% 35%;
  transform: translateX(-50%);
}

.character-body::before,
.character-body::after {
  content: "";
  position: absolute;
  top: 18%;
  width: 24%;
  height: 48%;
  border-radius: 999px;
  background: inherit;
  box-shadow: 0 4px 8px rgba(19, 9, 3, 0.2);
}

.character-body::before {
  left: -18%;
  transform: rotate(22deg);
}

.character-body::after {
  right: -18%;
  transform: rotate(-22deg);
}

.character-1 {
  background: #a8422f;
}

.character-2 {
  background: #245a92;
}

.treasure-badge {
  position: absolute;
  right: -8px;
  top: -10px;
  width: 22px;
  aspect-ratio: 1;
  border: 2px solid rgba(67, 35, 10, 0.8);
  border-radius: 5px;
  background:
    linear-gradient(90deg, transparent 43%, rgba(67, 35, 10, 0.7) 44% 56%, transparent 57%),
    linear-gradient(#f3c45b, #b87622);
  box-shadow: 0 3px 7px rgba(19, 9, 3, 0.35);
}

.treasure-badge::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -8px;
  width: 14px;
  height: 9px;
  border: 3px solid #7d4b18;
  border-bottom: 0;
  border-radius: 999px 999px 0 0;
  transform: translateX(-50%);
}

.bomb-badge {
  position: absolute;
  right: -11px;
  top: -13px;
  z-index: 7;
  display: grid;
  place-items: center;
  width: 26px;
  aspect-ratio: 1;
  border: 2px solid rgba(255, 232, 150, 0.9);
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 30%, #686868 0 12%, transparent 13%),
    #191919;
  color: #ffe896;
  font-size: 0.78rem;
  font-weight: 900;
  box-shadow: 0 4px 9px rgba(19, 9, 3, 0.45);
}

.bomb-badge::before {
  content: "";
  position: absolute;
  left: 61%;
  top: -8px;
  width: 12px;
  height: 9px;
  border-top: 3px solid #2b1b0e;
  border-radius: 999px 999px 0 0;
  transform: rotate(28deg);
}

.bomb-badge::after {
  content: "";
  position: absolute;
  right: -5px;
  top: -8px;
  width: 9px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #ffcb45;
  box-shadow: 0 0 0 3px rgba(196, 59, 32, 0.74), 0 0 12px rgba(255, 203, 69, 0.8);
}

.stunned-by-dynamite .character-body,
.stunned-by-dynamite .character-head {
  filter: saturate(0.72) brightness(0.9);
}

.cell.finished {
  background: rgba(255, 246, 186, 0.04);
}

.cell.finished.move-target {
  background: rgba(136, 226, 156, 0.42);
}

.cell.finished.dig-target {
  background: rgba(255, 205, 88, 0.5);
}

.cell.finished.bottle-target {
  background: rgba(93, 161, 220, 0.44);
}

.cell.finished.move-target:hover,
.cell.finished.move-target:focus-visible {
  background: rgba(143, 238, 166, 0.58);
}

.cell.finished.active-occupied {
  background: rgba(255, 246, 186, 0.32);
}

.intro-screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: clamp(14px, 3vw, 30px);
  background: inherit;
}

.intro-screen.hidden {
  display: none;
}

.intro-screen img {
  width: min(100%, 760px);
  max-height: calc(100vh - 34px);
  border: 4px solid rgba(255, 244, 197, 0.9);
  border-radius: 8px;
  object-fit: contain;
  box-shadow: 0 24px 80px rgba(0, 35, 71, 0.4);
}

.intro-screen button {
  position: fixed;
  left: 50%;
  bottom: clamp(18px, 5vh, 42px);
  transform: translateX(-50%);
  min-width: 168px;
  padding: 12px 28px;
  border: 3px solid #1d1208;
  border-radius: 8px;
  color: #fff7dc;
  background: linear-gradient(#d04b2b, #98291d);
  box-shadow: inset 0 1px 0 rgba(255, 211, 134, 0.42), 0 8px 18px rgba(12, 7, 4, 0.28);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.2rem;
}

.intro-screen button:hover,
.intro-screen button:focus-visible {
  background: linear-gradient(#e05b38, #a83222);
}

.privacy-screen,
.how-to-screen,
.setup-screen,
.duel-screen {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20, 25, 22, 0.64);
  backdrop-filter: blur(7px);
}

.setup-screen,
.how-to-screen,
.duel-screen {
  z-index: 7;
}

.mode-screen {
  position: fixed;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20, 25, 22, 0.68);
  backdrop-filter: blur(7px);
}

.character-screen {
  position: fixed;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20, 25, 22, 0.68);
  backdrop-filter: blur(7px);
}

.character-panel {
  width: min(780px, 100%);
  padding: 24px;
  border: 2px solid rgba(71, 40, 17, 0.55);
  border-radius: 8px;
  background: #f6e0ad;
  box-shadow: var(--shadow);
  text-align: center;
}

.character-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.character-option {
  display: grid;
  gap: 8px;
  align-content: start;
  min-height: 0;
  padding: 4px;
  border: 2px solid transparent;
  border-radius: 8px;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.character-option:hover,
.character-option:focus-visible {
  border-color: rgba(43, 24, 10, 0.38);
  background: transparent;
}

.character-option:disabled,
.character-option.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.6);
}

.character-option:disabled:hover,
.character-option.disabled:hover {
  border-color: transparent;
  background: transparent;
}

.character-option img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  filter: drop-shadow(0 12px 18px rgba(19, 9, 3, 0.28));
}

.character-option strong {
  font-size: 1.05rem;
}

.character-option span {
  color: #5f4120;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.28;
}

.mode-screen.hidden {
  display: none;
}

.mode-panel {
  width: min(470px, 100%);
  padding: 28px;
  border: 2px solid rgba(71, 40, 17, 0.55);
  border-radius: 8px;
  background: #f6e0ad;
  box-shadow: var(--shadow);
  text-align: center;
}

.mode-actions {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.mode-button {
  width: 100%;
  color: #fff7dc;
  background: #56351d;
}

.mode-button:hover,
.mode-button:focus-visible {
  background: #8d2f22;
}

.privacy-screen.hidden,
.how-to-screen.hidden,
.setup-screen.hidden,
.duel-screen.hidden {
  display: none;
}

.privacy-panel,
.how-to-panel,
.setup-panel,
.duel-panel {
  width: min(420px, 100%);
  padding: 26px;
  border: 2px solid rgba(71, 40, 17, 0.55);
  border-radius: 8px;
  background: #f6e0ad;
  box-shadow: var(--shadow);
  text-align: center;
}

.privacy-panel p:last-of-type,
.how-to-panel p:last-of-type,
.setup-panel p:last-of-type,
.duel-panel p:last-of-type {
  margin-bottom: 20px;
}

.privacy-panel button,
.how-to-panel button,
.setup-panel button,
.duel-panel button {
  width: 100%;
  color: #fff7dc;
  background: #8d2f22;
}

.duel-actions,
.duel-reward-actions {
  display: grid;
  gap: 10px;
}

.duel-rolls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.duel-rolls div {
  display: grid;
  gap: 8px;
  justify-items: center;
  padding: 12px;
  border: 2px solid rgba(43, 24, 10, 0.22);
  border-radius: 8px;
  background: rgba(255, 248, 221, 0.72);
}

.duel-rolls strong {
  font-size: 0.9rem;
}

.duel-rolls span {
  display: grid;
  place-items: center;
  width: 54px;
  aspect-ratio: 1;
  border: 3px solid #28180e;
  border-radius: 8px;
  color: #28180e;
  background: #fff7dc;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.65), 0 5px 10px rgba(19, 9, 3, 0.2);
  font-size: 1.7rem;
  font-weight: 900;
}

.duel-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.duel-actions button:last-child {
  color: #28180e;
  background: #e8c47c;
}

.duel-clue-option {
  display: grid;
  gap: 4px;
  justify-items: center;
}

.duel-clue-option span {
  font-size: 0.95rem;
  font-weight: 700;
}

.card-viewer {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(17, 10, 5, 0.78);
}

.card-viewer.hidden {
  display: none;
}

.card-viewer img {
  width: min(76vh, 680px, calc(100vw - 56px));
  max-height: calc(100vh - 56px);
  border: 3px solid rgba(255, 233, 167, 0.92);
  border-radius: 8px;
  object-fit: contain;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
}

.card-viewer-close {
  position: fixed;
  top: 18px;
  right: 18px;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  min-height: 46px;
  border: 2px solid rgba(255, 239, 198, 0.74);
  border-radius: 999px;
  color: #fff7dc;
  background: rgba(55, 31, 15, 0.92);
  font-size: 2rem;
  line-height: 1;
}

.card-viewer-close:hover,
.card-viewer-close:focus-visible {
  background: #8d2f22;
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
    align-items: start;
    padding: 16px 0 24px;
  }

  .side-panel {
    grid-template-columns: 1fr 1fr;
    min-height: 0;
  }

  .side-column {
    min-height: 0;
  }

  .side-title,
  .turn-box,
  .secondary-button {
    grid-column: 1 / -1;
  }

  .side-character-slot {
    min-height: 140px;
  }

  .side-character-image {
    width: min(100%, 180px);
  }

  .sea-deck-panel {
    min-height: 0;
    grid-template-columns: minmax(110px, 160px) minmax(0, 1fr);
    justify-content: center;
    align-items: center;
  }

  .sea-deck-card {
    max-width: 160px;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100vw - 18px, 1180px);
    gap: 14px;
  }

  .side-panel {
    grid-template-columns: 1fr;
    gap: 10px;
    min-height: 0;
    padding: 16px;
  }

  .turn-box {
    min-height: 142px;
  }

  .board-hud {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto auto;
    row-gap: 7px;
    min-height: 120px;
    padding: 12px;
  }

  .hud-player {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .hud-clues {
    grid-column: 1 / -1;
    grid-row: 3;
  }

  .hud-status {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .hud-coins {
    grid-column: 1;
    grid-row: 4;
    justify-self: start;
    min-height: 40px;
    padding-inline: 18px;
    font-size: 0.98rem;
  }

  .hud-treasure {
    grid-column: 2;
    grid-row: 4;
    font-size: 0.92rem;
  }

  .hud-treasure::after {
    width: 34px;
    height: 27px;
  }

  .side-character-slot {
    min-height: 124px;
  }

  .side-character-image {
    width: min(100%, 150px);
  }

  .sea-deck-panel {
    grid-template-columns: 1fr;
  }

  .sea-deck-card {
    max-width: 132px;
  }

  .character-options {
    grid-template-columns: 1fr;
  }
}
