/* BLACK SAIL — mobile Pirate Tavern theme.
   Apply class="tavern" to the page root. Optional real textures can be
   supplied through --wood-image, --gold-image and --scene-image.
   Example: style="--scene-image:url('ship-background.png')".
   Components work on buttons, inputs, links and semantic HTML elements. */

.tavern {
  --ink: #100e0a;
  --wood: #17130e;
  --cream: #eee3cc;
  --muted: #aaa18f;
  --gold: #deb46b;
  --gold-light: #ffe1a0;
  --brass: #8d6939;
  --line: #7e6848;
  --danger: #ef5147;
  --success: #75cbaa;
  --wood-image: none;
  --gold-image: none;
  --scene-image: none;
  --radius: 9px;
  color: var(--cream);
  background-color: var(--ink);
  background-image: var(--wood-image),
    repeating-linear-gradient(2deg, transparent 0 4px, #b38b4920 5px, transparent 6px 13px),
    repeating-linear-gradient(177deg, #0005 0 1px, transparent 2px 8px),
    linear-gradient(100deg, #0a0907, #21190f 48%, #0b0a08);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 16px;
  line-height: 1.45;
  min-height: 100svh;
  color-scheme: dark;
  -webkit-tap-highlight-color: transparent;
}

.tavern *, .tavern *::before, .tavern *::after { box-sizing: border-box; }
.tavern button, .tavern input, .tavern select { font: inherit; }
.tavern a { color: inherit; }
.tavern button { cursor: pointer; }
.tavern-shell { width: 100%; max-width: 480px; margin-inline: auto; }
.tavern-content { padding: 22px 18px calc(106px + env(safe-area-inset-bottom)); }
.tavern-stack { display: grid; gap: 14px; }
.tavern-row { display: flex; align-items: center; gap: 12px; }
.tavern-row > * { min-width: 0; }
.tavern-row--between { justify-content: space-between; }
.tavern-muted { color: var(--muted); }
.tavern-success { color: var(--success); }
.tavern-danger { color: var(--danger); }
.tavern-amount { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Thin, uneven-looking aged brass edging and dark wooden inset. */
.tavern-panel, .tavern-field, .tavern-choice, .tavern-balance {
  position: relative;
  border: 1px solid var(--line);
  border-top-color: #b79862;
  border-right-color: #665139;
  border-bottom-color: #54412b;
  border-radius: var(--radius);
  background-image: var(--wood-image),
    repeating-linear-gradient(3deg, transparent 0 6px, #c69c4510 7px, transparent 8px 17px),
    linear-gradient(135deg, #211b14ec, #0c0c0bef 65%, #1b160fee);
  box-shadow: inset 0 0 0 2px #05050490, inset 0 1px 0 #e7c88a30,
    0 3px 8px #0006;
}
.tavern-panel { padding: 18px; }
.tavern-panel--riveted::before, .tavern-panel--riveted::after {
  content: ''; position: absolute; top: 7px; width: 5px; height: 5px;
  border-radius: 50%; background: radial-gradient(circle at 30% 25%, #ecd18c, #80602c 55%, #30200e);
  box-shadow: 0 1px 2px #000;
}
.tavern-panel--riveted::before { left: 7px; }
.tavern-panel--riveted::after { right: 7px; }

/* Scratches, patina, recessed lettering and polished worn edges. */
.tavern-button {
  display: inline-flex; justify-content: center; align-items: center;
  gap: 12px; min-height: 54px; padding: 12px 20px; width: 100%;
  position: relative; isolation: isolate; overflow: hidden;
  border: 1px solid #f1d296; border-radius: var(--radius);
  color: #181005; font-weight: 700; text-align: center;
  text-decoration: none; text-transform: uppercase; letter-spacing: .035em;
  background-image: var(--gold-image),
    radial-gradient(ellipse at 20% 20%, #ffe7ab88, transparent 40%),
    linear-gradient(105deg, #bd8d42, #e3b86e 36%, #c49649 72%, #e1b76b);
  box-shadow: inset 0 0 0 2px #57361375, inset 0 3px 3px #fff0be80,
    inset 0 -4px 5px #5a350b70, 0 4px 9px #0009;
  text-shadow: 0 1px 0 #fff0b65c;
  transition: filter .16s ease, transform .16s ease, box-shadow .16s ease;
}
.tavern-button::after {
  content: ''; pointer-events: none; position: absolute; inset: 5px;
  border: 1px solid #fff2b338; border-radius: 4px;
  background: radial-gradient(ellipse at 6% 80%, #38200025, transparent 25%),
    radial-gradient(ellipse at 91% 20%, #38200030, transparent 24%);
}
.tavern-button--secondary {
  color: var(--cream); border-color: var(--brass); text-shadow: 0 2px 2px #000;
  background-image: var(--wood-image), linear-gradient(130deg, #292016, #0b0b09 70%);
  box-shadow: inset 0 0 0 2px #05050580, inset 0 1px 0 #d4b47c35, 0 3px 8px #0007;
}
.tavern-button--small { min-height: 46px; width: 46px; padding: 8px; font-size: 26px; }
.tavern-button:active { transform: translateY(1px); filter: brightness(.9); }
.tavern-button:disabled { opacity: .45; cursor: not-allowed; }
.tavern :where(button, a, select):focus-visible {
  outline: 2px solid var(--gold-light); outline-offset: 4px;
}
@media (hover: hover) {
  .tavern-button:not(:disabled):hover { filter: brightness(1.12); }
}

.tavern-field { display: flex; align-items: center; gap: 12px; padding: 0 15px; min-height: 56px; }
.tavern-field input {
  color: var(--cream); background: transparent; border: 0; min-width: 0;
  width: 100%; padding: 15px 0; outline: none;
}
.tavern .tavern-field input:focus, .tavern .tavern-field input:focus-visible { outline: none; box-shadow: none; }
.tavern-field input::placeholder { color: #b7b0a3; opacity: 1; }
.tavern-field:focus-within { border-color: var(--gold-light); box-shadow: 0 0 0 2px #e1b36925; }
.tavern-field:has(input[aria-invalid='true']) { border-color: var(--danger); }
.tavern-field-action { border: 0; background: transparent; color: var(--cream); padding: 10px; min-height: 44px; min-width: 44px; }
.tavern-label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 14px; }
.tavern-icon { width: 24px; height: 24px; flex-shrink: 0; display: inline-block; color: currentColor; }

.tavern-header {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: #0b0a08eb; border-bottom: 1px solid #ad82463d;
}
.tavern-brand { color: var(--gold); font-size: clamp(21px, 6vw, 29px); line-height: 1; letter-spacing: .04em; text-decoration: none; }
.tavern-balance { display: flex; align-items: center; gap: 8px; padding: 7px 10px; font-size: 17px; white-space: nowrap; }
.tavern-menu { background: transparent; color: var(--gold); border: 0; min-width: 44px; min-height: 44px; }
.tavern-title { margin: 0 0 18px; font-weight: 400; font-size: clamp(30px, 9vw, 44px); line-height: 1.1; text-align: center; }
.tavern-divider { height: 1px; margin-block: 20px; background: linear-gradient(90deg, transparent, #ce9a50, #ffe0a2, #ce9a50, transparent); }
.tavern-media { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: #0c0906; }
.tavern-media--portrait { aspect-ratio: 9 / 16; }
.tavern-bet { display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; gap: 10px; margin-bottom: 18px; }
.tavern-bet input { width: 90px; background: transparent; border: 0; color: var(--cream); font-size: 24px; text-align: right; }
.tavern-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin-bottom: 18px; }
.tavern-choice { min-height: 76px; padding: 10px 5px; color: var(--cream); text-align: center; }
.tavern-choice small { display: block; color: var(--muted); margin-top: 3px; }
.tavern-choice[aria-pressed='true'], .tavern-choice.is-selected {
  border-color: var(--gold-light); background: linear-gradient(130deg, #67461870, #261a0ec7);
  box-shadow: inset 0 0 0 1px #dbb76b70, 0 0 12px #daa44716;
}
.tavern-choice[aria-pressed='true'] small { color: var(--gold); }
.tavern-result { text-align: center; font-size: 40px; margin: 8px 0 20px; }
.tavern-result strong { color: var(--gold); font-size: 1.25em; }
.tavern-result-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); text-align: center; }
.tavern-result-grid > div { padding: 12px 5px; }
.tavern-result-grid > div + div { border-left: 1px solid #b78b4438; }
.tavern-result-grid small { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; }
.tavern-list { display: grid; gap: 10px; }
.tavern-list-item { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 16px; min-height: 60px; text-decoration: none; }
.tavern-list-item small { display: block; color: var(--muted); font-size: 12px; }
.tavern-avatar { display: block; width: 124px; aspect-ratio: 1; object-fit: cover; border-radius: 50%; margin: 0 auto 16px; border: 3px double var(--gold); box-shadow: 0 0 0 5px #332414, 0 6px 22px #0009; }
.tavern-profile-name { text-align: center; font-size: 30px; margin: 0 0 6px; }
.tavern-wallet-amount { display: block; font-size: clamp(30px, 9vw, 44px); color: var(--gold-light); line-height: 1.2; }
.tavern-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.tavern-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; z-index: 20; display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: #100e0afa; border-top: 1px solid #b58d483f;
  box-shadow: 0 -10px 24px #0006;
}
.tavern-nav a { display: grid; justify-items: center; gap: 5px; min-height: 58px; padding: 6px; text-decoration: none; color: #aaa69d; font-size: 14px; border-top: 2px solid transparent; }
.tavern-nav a[aria-current='page'] { color: var(--gold-light); border-top-color: var(--gold); }
.tavern-nav .tavern-icon { width: 26px; height: 26px; }

.tavern-welcome {
  min-height: 100svh; padding: calc(30px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; justify-content: flex-end;
  background-image: linear-gradient(180deg, #0001 20%, #05040365 50%, #050403b3 100%), var(--scene-image);
  background-size: cover; background-position: center;
}
.tavern-welcome .tavern-brand { text-align: center; margin-bottom: auto; padding-bottom: 160px; }
.tavern-welcome .tavern-title { text-transform: uppercase; text-shadow: 0 3px 14px #000; }
.tavern-welcome-footer { text-align: center; font-size: 12px; color: var(--muted); margin-top: 20px; }
@media (max-width: 359px) {
  .tavern-header { padding-inline: 10px; gap: 5px; }
  .tavern-balance { font-size: 14px; padding: 6px; }
  .tavern-content { padding-inline: 12px; }
  .tavern-choice { font-size: 13px; }
  .tavern-actions .tavern-button { padding-inline: 9px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .tavern *, .tavern *::before, .tavern *::after { transition: none !important; animation: none !important; }
}
