/* Tavern: a dark inn in the Witcher's world, late at night, where they play Gwent while the bard sings. Blackened oak
   walls, fog and a monster's claw marks, the embers of the hearth, bone-white type, tarnished gold and blood red,
   Gwent cards and their strength badges, a Gwent board on the table when nothing plays, wooden buttons, and a wolf
   medallion that hums while the music plays. */
:root[data-theme='tavern'] {
  --font: 'Palatino', 'Palatino Linotype', 'Book Antiqua', 'Iowan Old Style', Georgia, serif;
  --title-font: 'Trajan Pro', Cinzel, Copperplate, 'Copperplate Gothic Light', Optima, 'Palatino', serif;
  --radius: 3px;

  --bg: #0e0b08;
  --surface: #1d1712;
  --surface-deep: #080605;
  --card: rgba(22, 17, 13, 0.92); /* worn leather */
  --card-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  --line: #4a3c2c;
  --text: #e6dcc4; /* bone */
  --muted: #9b8f78;
  --accent: #c9a45c; /* tarnished gold */
  --accent-2: #a01818; /* blood */
  --on-accent: #1a1206;
  --ok: #9cbf6a;
  --err: #e0574a;

  --scheme: dark;
  --field: rgba(0, 0, 0, 0.4);
  --raised: rgba(255, 255, 255, 0.04);
  --hover: rgba(201, 164, 92, 0.12);

  --sender-0: #c9a45c;
  --sender-1: #a9c4d9; /* silver-blue */
  --sender-2: #e08a8a;
  --sender-3: #e8d48a;
  --sender-4: #b9a6dd;
  --sender-5: #e09a63;
  --sender-6: #8fc0b0;
  --sender-7: #cdb8a0;

  /* Blackened oak planks under a ceiling beam, fog drifting in, and three claw marks gouged into the wall. */
  --backdrop:
    linear-gradient(118deg, transparent calc(50% - 3px), rgba(150, 20, 20, 0.22) 50%, transparent calc(50% + 3px)) right 140px bottom 60px / 220px 320px no-repeat fixed,
    linear-gradient(118deg, transparent calc(50% - 3px), rgba(150, 20, 20, 0.22) 50%, transparent calc(50% + 3px)) right 110px bottom 70px / 220px 320px no-repeat fixed,
    linear-gradient(118deg, transparent calc(50% - 3px), rgba(150, 20, 20, 0.22) 50%, transparent calc(50% + 3px)) right 80px bottom 80px / 220px 320px no-repeat fixed,
    linear-gradient(180deg, #050403 0 22px, #1a120b 22px 26px, rgba(0, 0, 0, 0.6) 26px, transparent 60px) 0 0 / 100% 60px no-repeat,
    radial-gradient(1400px 400px at 50% 100%, rgba(150, 150, 160, 0.07), transparent 70%) fixed,
    radial-gradient(ellipse at 50% 30%, transparent 35%, rgba(0, 0, 0, 0.7) 100%) fixed,
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.6) 0 2px, transparent 2px 96px),
    repeating-linear-gradient(90deg, rgba(255, 210, 150, 0.015) 0 1px, transparent 1px 7px, rgba(0, 0, 0, 0.06) 7px 9px, transparent 9px 23px),
    linear-gradient(90deg, #17100a, #1e150d, #17100a, #1b130b, #17100a) 0 0 / 384px 100%,
    var(--bg);
}

/* The hearth's embers, bottom left, flickering on the walls. */
[data-theme='tavern'] body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(900px 600px at 0% 100%, rgba(220, 100, 30, 0.18), transparent 65%);
}

@media (prefers-reduced-motion: no-preference) {
  [data-theme='tavern'] body::before {
    animation: tavern-fire 4s ease-in-out infinite;
  }
}

@keyframes tavern-fire {
  0%,
  100% {
    opacity: 1;
  }
  20% {
    opacity: 0.8;
  }
  35% {
    opacity: 0.95;
  }
  55% {
    opacity: 0.75;
  }
  75% {
    opacity: 0.9;
  }
}

/* Carved capitals for the titles. */
[data-theme='tavern'] h1,
[data-theme='tavern'] h2,
[data-theme='tavern'] .brand {
  font-family: var(--title-font);
  font-weight: 400;
  letter-spacing: 0.08em;
  color: #efe6d0;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
}

[data-theme='tavern'] .brand {
  font-size: 1.3rem;
  text-transform: uppercase;
}

/* The bard's feathered cap. */
[data-theme='tavern'] .brand::after {
  content: '🪶';
  margin-left: -4px;
  font-size: 0.9em;
}

[data-theme='tavern'] h3 {
  font-variant: small-caps;
  letter-spacing: 0.12em;
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--accent);
}

/* The big initial: gold on blood red, in a steel frame. */
[data-theme='tavern'] .hero h1::first-letter {
  padding: 0 0.12em;
  margin-right: 0.04em;
  border: 2px solid #8f8f94;
  background: radial-gradient(circle at 30% 30%, #b02020, #5a0a0a);
  color: #f0cf6e;
  font-size: 1.3em;
}

/* Leather cards with a steel rule inside and a rivet in each corner. */
[data-theme='tavern'] .card {
  border-color: #5a4c38;
  background:
    radial-gradient(circle at 10px 10px, #c4c4c9 0 1.5px, #4a4a4e 2px 2.5px, transparent 3px),
    radial-gradient(circle at calc(100% - 10px) 10px, #c4c4c9 0 1.5px, #4a4a4e 2px 2.5px, transparent 3px),
    radial-gradient(circle at 10px calc(100% - 10px), #c4c4c9 0 1.5px, #4a4a4e 2px 2.5px, transparent 3px),
    radial-gradient(circle at calc(100% - 10px) calc(100% - 10px), #c4c4c9 0 1.5px, #4a4a4e 2px 2.5px, transparent 3px),
    var(--card);
  box-shadow:
    inset 0 0 0 5px rgba(22, 17, 13, 0.92),
    inset 0 0 0 6px rgba(143, 143, 148, 0.25),
    var(--card-shadow);
}

/* The home page and the dialogs are Gwent cards: a gilded frame with a strength badge (a ♫) in the corner. */
[data-theme='tavern'] .view.center .card,
[data-theme='tavern'] .modal .card {
  position: relative;
  border: 2px solid #c9a45c;
  border-radius: 10px;
  background: var(--card);
  box-shadow:
    inset 0 0 0 4px #16110d,
    inset 0 0 0 5px #7a5f2a,
    0 0 40px rgba(201, 164, 92, 0.08),
    var(--card-shadow);
}

[data-theme='tavern'] .view.center .card::before,
[data-theme='tavern'] .modal .card::before {
  content: '♫';
  position: absolute;
  top: -14px;
  left: -14px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #f0cf6e;
  font-size: 1.3rem;
  pointer-events: none;
  background: radial-gradient(circle at 35% 30%, #3a2a1a, #120d08 70%);
  box-shadow:
    inset 0 0 0 3px #c9a45c,
    inset 0 0 0 5px #2a1e10,
    0 4px 10px rgba(0, 0, 0, 0.6);
}

[data-theme='tavern'] .room-people {
  border-bottom: 1px solid rgba(160, 24, 24, 0.5);
}

/* Everyone at the table is a small Gwent card. */
[data-theme='tavern'] .people li {
  border: 1px solid #c9a45c;
  border-radius: 4px;
  background: linear-gradient(180deg, #2a2016, #15100b);
  box-shadow:
    inset 0 0 0 2px #15100b,
    inset 0 0 0 3px rgba(201, 164, 92, 0.3);
}

/* Up next is a hand of Gwent cards, the queue number in the strength badge. */
[data-theme='tavern'] .queue-play img {
  border: 2px solid #c9a45c;
  border-radius: 6px;
}

[data-theme='tavern'] .queue-play::before {
  top: 5px;
  left: 5px;
  min-width: 26px;
  height: 26px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: radial-gradient(circle at 35% 30%, #3a2a1a, #120d08 70%);
  box-shadow:
    inset 0 0 0 2px #c9a45c,
    0 2px 6px rgba(0, 0, 0, 0.6);
  color: #f0cf6e;
  font-family: var(--title-font);
  font-size: 0.85rem;
  z-index: 1;
}

/* Buttons are wooden boards: dark oak with its grain, bound in iron. */
[data-theme='tavern'] .btn {
  border-color: #0c0806;
  border-radius: 4px;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.12) 0 1px, transparent 1px 6px, rgba(255, 210, 150, 0.03) 6px 8px, transparent 8px 17px),
    linear-gradient(180deg, #3a2716, #24170d);
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 160, 0.1),
    inset 0 0 0 1px rgba(110, 110, 115, 0.35),
    0 2px 6px rgba(0, 0, 0, 0.5);
  color: var(--text);
  font-variant: small-caps;
  letter-spacing: 0.06em;
  font-size: 1.05em;
}

[data-theme='tavern'] .btn:hover:not(:disabled) {
  filter: brightness(1.12);
}

/* The main one is a lighter, oiled oak, its letters burnt in gold. */
[data-theme='tavern'] .btn.primary {
  border-color: #1a0f07;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.14) 0 1px, transparent 1px 6px, rgba(255, 210, 150, 0.05) 6px 8px, transparent 8px 17px),
    linear-gradient(180deg, #7a4f28, #4e3018);
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 160, 0.2),
    inset 0 0 0 1px rgba(201, 164, 92, 0.35),
    0 3px 10px rgba(0, 0, 0, 0.55);
  color: #f0cf6e;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

[data-theme='tavern'] .btn.primary:hover:not(:disabled) {
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 160, 0.2),
    inset 0 0 0 1px rgba(201, 164, 92, 0.5),
    0 4px 16px rgba(0, 0, 0, 0.6);
}

/* The screen is the table's edge: a thick rim of dark oak, bound in steel. */
[data-theme='tavern'] .screen {
  border: 2px solid #b9b9be;
  border-radius: 14px;
  box-shadow:
    0 0 0 8px #1e150d,
    0 0 0 10px #6e6e73,
    0 0 50px rgba(160, 24, 24, 0.12),
    0 30px 80px rgba(0, 0, 0, 0.7);
}

/* With no video, a Gwent board on the table: three rows, the opponent's cards face down on the top one and yours on
   the middle one. A card is 5% wide and 12.4% high (so 5:7 on the 16:9 screen): a gold frame (the two edge layers)
   around its back, all three layers at the same position. */
[data-theme='tavern'] .empty {
  --frame-x: linear-gradient(90deg, #c9a45c 0 9%, transparent 9% 91%, #c9a45c 91%);
  --frame-y: linear-gradient(#c9a45c 0 7%, transparent 7% 93%, #c9a45c 93%);
  --red: radial-gradient(circle, #d6a63e 0 12%, #7a1414 14%, #3a0808);
  --black: radial-gradient(circle, #b9b9be 0 12%, #2a2a2e 14%, #0e0e10);
  place-items: end center;
  padding-bottom: 4%;
  background:
    var(--frame-x) 40% 20% / 5% 12.4% no-repeat,
    var(--frame-y) 40% 20% / 5% 12.4% no-repeat,
    var(--red) 40% 20% / 5% 12.4% no-repeat,
    var(--frame-x) 47% 20% / 5% 12.4% no-repeat,
    var(--frame-y) 47% 20% / 5% 12.4% no-repeat,
    var(--red) 47% 20% / 5% 12.4% no-repeat,
    var(--frame-x) 54% 20% / 5% 12.4% no-repeat,
    var(--frame-y) 54% 20% / 5% 12.4% no-repeat,
    var(--red) 54% 20% / 5% 12.4% no-repeat,
    var(--frame-x) 45% 52% / 5% 12.4% no-repeat,
    var(--frame-y) 45% 52% / 5% 12.4% no-repeat,
    var(--black) 45% 52% / 5% 12.4% no-repeat,
    var(--frame-x) 55% 52% / 5% 12.4% no-repeat,
    var(--frame-y) 55% 52% / 5% 12.4% no-repeat,
    var(--black) 55% 52% / 5% 12.4% no-repeat,
    /* the rows, between brass rules */
    linear-gradient(rgba(201, 164, 92, 0.35) 0 1px, rgba(0, 0, 0, 0.35) 1px calc(100% - 1px), rgba(201, 164, 92, 0.35) calc(100% - 1px)) 50% 18% / 86% 22% no-repeat,
    linear-gradient(rgba(201, 164, 92, 0.35) 0 1px, rgba(0, 0, 0, 0.35) 1px calc(100% - 1px), rgba(201, 164, 92, 0.35) calc(100% - 1px)) 50% 50% / 86% 22% no-repeat,
    linear-gradient(rgba(201, 164, 92, 0.35) 0 1px, rgba(0, 0, 0, 0.35) 1px calc(100% - 1px), rgba(201, 164, 92, 0.35) calc(100% - 1px)) 50% 82% / 86% 22% no-repeat,
    /* a single candle's light on the dark oak table */
    radial-gradient(ellipse at 50% 40%, rgba(255, 170, 80, 0.12), transparent 65%),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.15) 0 1px, transparent 1px 9px, rgba(255, 210, 150, 0.02) 9px 11px, transparent 11px 26px),
    linear-gradient(#24190f, #120c07);
  color: #e6dcc4;
  font-family: var(--title-font);
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

/* The vinyl becomes the witcher's medallion: a silver disc with a wolf's head. */
[data-theme='tavern'] .vinyl {
  display: inline-grid;
  place-items: center;
  background: radial-gradient(circle at 35% 30%, #f2f2f4, #a5a5ab 45%, #4a4a50 80%);
  box-shadow:
    inset 0 0 0 2px #2a2a2e,
    0 0 0 1px #8f8f94;
}

[data-theme='tavern'] .vinyl::after {
  content: '🐺';
  display: block;
  width: auto;
  height: auto;
  background: none;
  line-height: 1;
  filter: grayscale(1) contrast(1.3) brightness(0.9);
}

[data-theme='tavern'] .vinyl.small {
  font-size: 16px;
}

[data-theme='tavern'] .vinyl.big {
  font-size: 66px;
  animation: none;
  box-shadow:
    inset 0 0 0 4px #2a2a2e,
    0 0 0 2px #8f8f94,
    0 10px 30px rgba(0, 0, 0, 0.6);
}

/* While the music plays, the medallion hums, as it does when there's magic about. */
@media (prefers-reduced-motion: no-preference) {
  [data-theme='tavern'] .vinyl.spinning {
    animation: tavern-hum 0.18s linear infinite;
  }
}

@keyframes tavern-hum {
  25% {
    transform: translate(0.6px, -0.4px) rotate(-1deg);
  }
  50% {
    transform: translate(-0.5px, 0.5px);
  }
  75% {
    transform: translate(0.4px, 0.3px) rotate(1deg);
  }
}
