/* Agge "tabletop" look shared by every game page, loaded after each page's own <style>.
   Same language as Deck Defense's miniature render: a dark card-room with a diamond lattice and a warm lamp,
   felt with fibre and a stitched border, wood rails with gold piping, chips with an edge, cards with real shadows.
   Only adds layers (pseudo-elements, shadows); table/card skins from the shops keep their colours. */
:root {
  --lk-gold: #d8b25a; --lk-gold-hi: #f6dc94; --lk-gold-lo: #8a6424;
  --lk-lamp: rgba(255, 224, 168, .16);
  --lk-noise: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .9 -.35'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='.16'/></svg>");
  --lk-grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='60'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='.004 .32' numOctaves='3' seed='4'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 1.4 -.55'/></filter><rect width='100%' height='100%' filter='url(%23g)'/></svg>");
}

/* ---------------------------------------------------------------- the room behind the table */
body::before, body::after { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1; }
body::before {
  background:
    radial-gradient(ellipse 60% 40% at 50% 0%, rgba(255, 196, 120, .1), transparent 70%),
    radial-gradient(ellipse 45% 55% at 0% 100%, rgba(255, 128, 64, .13), transparent 70%),
    radial-gradient(ellipse 45% 55% at 100% 100%, rgba(64, 84, 240, .14), transparent 70%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='56' height='56'><path d='M28 1L55 28L28 55L1 28Z' fill='none' stroke='%23ffc890' stroke-opacity='.06' stroke-width='1.2'/></svg>") center / 56px 56px;
}
body::after { background: radial-gradient(ellipse 80% 75% at 50% 45%, transparent 55%, rgba(0, 0, 0, .55) 100%); }

/* ---------------------------------------------------------------- felt: lamp pool, fibre, vignette */
.felt, .table, .sky, .dojo { isolation: isolate; }
.felt::after, .table::after, .sky::after, .dojo::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: -1; border-radius: inherit;
  background:
    var(--lk-noise),
    radial-gradient(ellipse 58% 48% at 50% 38%, var(--lk-lamp), rgba(255, 224, 168, .05) 50%, transparent 72%),
    radial-gradient(ellipse 85% 78% at 50% 42%, transparent 52%, rgba(0, 0, 0, .45) 100%);
}
.sky::after { background: radial-gradient(ellipse 85% 80% at 50% 45%, transparent 55%, rgba(0, 0, 0, .4) 100%); }
.dojo::after {
  background:
    radial-gradient(ellipse 50% 42% at 50% 42%, rgba(255, 214, 160, .12), transparent 70%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='56' height='56'><path d='M28 1L55 28L28 55L1 28Z' fill='none' stroke='%23c9b4ff' stroke-opacity='.07' stroke-width='1.2'/></svg>") center / 56px 56px,
    radial-gradient(ellipse 85% 80% at 50% 45%, transparent 50%, rgba(0, 0, 0, .5) 100%);
}

/* stitched border instead of a printed line */
.felt::before { border: 2px dashed color-mix(in srgb, var(--accent, var(--lk-gold)) 42%, transparent); inset: 9px; }
.table::before { border: 2px dashed rgba(246, 220, 148, .2); inset: 9px; }

/* ---------------------------------------------------------------- wood rail with gold piping */
.rim {
  background:
    var(--lk-grain),
    linear-gradient(180deg, rgba(255, 255, 255, .16), transparent 22%, transparent 70%, rgba(0, 0, 0, .3)),
    linear-gradient(180deg, var(--rim-hi), var(--rim) 55%, color-mix(in srgb, var(--rim) 60%, #000));
  box-shadow: 0 30px 60px rgba(0, 0, 0, .7), 0 6px 0 color-mix(in srgb, var(--rim) 55%, #000),
    inset 0 2px 0 rgba(255, 255, 255, .2), inset 0 -3px 8px rgba(0, 0, 0, .5);
}
.felt {
  box-shadow: 0 0 0 2px var(--lk-gold), 0 0 0 3px rgba(0, 0, 0, .55), 0 -1px 0 3px rgba(255, 240, 200, .25),
    inset 0 12px 40px rgba(0, 0, 0, .5), inset 0 0 0 1px rgba(0, 0, 0, .3);
}
/* Sabonete / Pife: the felt gets a wood frame and gold piping around it */
.table {
  border: 0; margin: 8px;
  box-shadow: 0 0 0 2px var(--lk-gold), 0 0 0 3px rgba(0, 0, 0, .6), 0 0 0 8px #5a3519, 0 0 0 9px #8a5a30,
    0 26px 50px rgba(0, 0, 0, .65), inset 0 10px 36px rgba(0, 0, 0, .45);
}
.table.tb-wood { margin: 0; box-shadow: 0 0 0 1px var(--lk-gold), 0 26px 50px rgba(0, 0, 0, .65), inset 0 10px 36px rgba(0, 0, 0, .45); }
.sky, .dojo {
  border-color: transparent;
  box-shadow: 0 0 0 1px rgba(246, 220, 148, .35), 0 0 0 4px rgba(10, 12, 28, .9), 0 0 0 5px rgba(246, 220, 148, .14), 0 26px 50px rgba(0, 0, 0, .6);
}
@media (max-width: 640px) {
  .table { margin: 7px; box-shadow: 0 0 0 2px var(--lk-gold), 0 0 0 3px rgba(0, 0, 0, .6), 0 0 0 7px #5a3519, 0 0 0 8px #8a5a30, 0 18px 36px rgba(0, 0, 0, .6), inset 0 8px 28px rgba(0, 0, 0, .45); }
}

/* ---------------------------------------------------------------- cards: contact shadow + soft drop, paper edge */
.card:not(.face-gilded):not(.empty), .card.face, .card.back {
  box-shadow: 0 1px 1px rgba(0, 0, 0, .35), 0 3px 6px rgba(0, 0, 0, .28), 0 14px 22px -8px rgba(0, 0, 0, .6),
    inset 0 0 0 1px rgba(0, 0, 0, .1), inset 0 -2px 0 rgba(0, 0, 0, .06), inset 0 1px 0 rgba(255, 255, 255, .9);
}
.face-gilded {
  box-shadow: 0 1px 1px rgba(0, 0, 0, .35), 0 3px 6px rgba(0, 0, 0, .28), 0 14px 22px -8px rgba(0, 0, 0, .6),
    inset 0 0 0 .2em #fffdf5, inset 0 0 0 .27em #c9a24a;
}

/* ---------------------------------------------------------------- chips: rim stripes on an edge, gloss on top */
.chip, .stack .mini, .bchip {
  background:
    radial-gradient(ellipse 62% 42% at 36% 24%, rgba(255, 255, 255, .34), transparent 70%),
    radial-gradient(circle, var(--c) 0 50%, rgba(255, 255, 255, .9) 51% 54%, var(--c) 55% 64%, transparent 65%),
    repeating-conic-gradient(from 10deg, #f4efe4 0 18deg, var(--c) 18deg 60deg);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .3), inset 0 -3px 3px rgba(0, 0, 0, .3), inset 0 2px 1px rgba(255, 255, 255, .3),
    0 3px 0 color-mix(in srgb, var(--c) 50%, #000), 0 4px 0 rgba(0, 0, 0, .45), 0 9px 12px rgba(0, 0, 0, .45);
}
.stack .mini { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .3), inset 0 -2px 2px rgba(0, 0, 0, .3), 0 3px 0 color-mix(in srgb, var(--c) 50%, #000), 0 5px 6px rgba(0, 0, 0, .45); }
/* chip tray: a wooden tray with a felt bed */
.chips {
  background: radial-gradient(ellipse 80% 120% at 50% 0%, rgba(255, 224, 168, .08), transparent 70%), var(--lk-noise), linear-gradient(#123d2e, #0a2a1f);
  border: 0;
  box-shadow: 0 0 0 2px var(--lk-gold-lo), 0 0 0 6px #4a2a14, 0 0 0 7px #7a4f2c, 0 14px 26px rgba(0, 0, 0, .55), inset 0 4px 12px rgba(0, 0, 0, .6);
}

/* ---------------------------------------------------------------- menus and dialogs: a gilded card on the table */
.panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, .05), transparent 30%), var(--lk-noise), var(--surface);
  border-color: color-mix(in srgb, var(--lk-gold) 32%, var(--line));
  box-shadow: 0 28px 60px rgba(0, 0, 0, .6), 0 0 0 1px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .08), inset 0 0 0 5px rgba(0, 0, 0, .12);
}
.panel h2 { text-shadow: 0 2px 0 rgba(0, 0, 0, .45), 0 0 26px rgba(246, 220, 148, .18); }

@media (prefers-reduced-transparency: reduce) { body::before { background: none; } }

/* the sticky action rail (Blackjack, Baccarat) fades out sideways instead of showing a navy box */
.rail {
  -webkit-mask: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
  mask: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
}
@media (max-width: 640px) { .rail { -webkit-mask: none; mask: none; } }
@media (max-width: 640px) { .rail { background: linear-gradient(to bottom, transparent, rgba(11, 13, 28, .72) 30%, rgba(11, 13, 28, .8)); } }
@media (max-height: 500px) and (orientation: landscape) { .table { margin: 5px; } }

/* menus taller than a small screen scroll inside the panel: a soft fade at the bottom says "there is more"
   and goes away at the end of the scroll (scroll-driven, so browsers without it simply show nothing) */
@supports (animation-timeline: scroll()) {
  .panel::after {
    content: ""; display: block; position: sticky; bottom: -32px; height: 84px; margin-top: -84px; pointer-events: none; opacity: 0;
    background: linear-gradient(to bottom, transparent, var(--surface, #161a3a) 58%);
    animation: lk-more linear both; animation-timeline: scroll(nearest block);
  }
  dialog.panel::after { content: none; }
  @keyframes lk-more { 0%, 82% { opacity: 1; } 100% { opacity: 0; } }
}
