/* ============================================================================
 * Statistik des Abends (client/tagesstatistik.css)
 * Granit-Optik passend zur Historie. Alles unter .ts gekapselt.
 * ==========================================================================*/

.ts {
  --ts-stone: #1d1d20;
  --ts-slab: #27272b;
  --ts-grout: #0e0e10;
  --ts-gold: #d6b25e;
  --ts-gold-hi: #f0d68e;
  --ts-gold-lo: #8f6e2a;
  --ts-chalk: #e6e1d6;
  --ts-ash: #a19d95;
  --ts-line: rgba(230, 225, 214, 0.07);
  --ts-serif: "Cinzel", "Trajan Pro", Georgia, serif;
  --ts-sans: "Alegreya Sans", "Segoe UI", system-ui, sans-serif;
  --ts-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='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .55 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='.2'/></svg>");
  --ts-mottle: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='420' height='420'><filter id='m'><feTurbulence type='fractalNoise' baseFrequency='.018' numOctaves='4' seed='7'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .9 -.3'/></filter><rect width='100%25' height='100%25' filter='url(%23m)' opacity='.6'/></svg>");
  --ts-bevel: inset 0 1px 0 rgba(255, 255, 255, 0.07), inset 0 -2px 0 rgba(0, 0, 0, 0.45);

  position: fixed;
  inset: 0;
  z-index: 7000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3vh 2vw;
  background: rgba(4, 4, 5, 0.82);
  font-family: var(--ts-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ts-chalk);
  -webkit-font-smoothing: antialiased;
}
.ts *,
.ts *::before,
.ts *::after {
  box-sizing: border-box;
}
.ts[hidden] {
  display: none;
}

.ts-panel {
  width: min(1040px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background-color: var(--ts-stone);
  background-image: var(--ts-noise), var(--ts-mottle),
    radial-gradient(120% 80% at 50% 0%, rgba(255, 255, 255, 0.04), transparent 60%);
  border: 1px solid var(--ts-grout);
  border-radius: 3px;
  box-shadow: var(--ts-bevel), 0 0 0 3px #161618, 0 0 0 4px rgba(214, 178, 94, 0.32),
    0 30px 80px rgba(0, 0, 0, 0.75);
  overflow: hidden;
  animation: ts-open 240ms cubic-bezier(0.2, 0.9, 0.2, 1) both;
}
.ts-panel:focus {
  outline: none;
}
@keyframes ts-open {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Kopf */
.ts-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 22px 28px 18px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0));
  border-bottom: 2px solid var(--ts-grout);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
}
.ts-head > div {
  flex: 1;
  min-width: 0;
}
.ts h2,
.ts h3,
.ts h4 {
  margin: 0;
  font-family: var(--ts-serif);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.85), 0 1px 0 rgba(255, 255, 255, 0.1);
}
.ts h2 {
  font-size: 1.9rem;
  line-height: 1.15;
  color: var(--ts-gold);
}
.ts h3 {
  font-size: 1.1rem;
  color: var(--ts-gold);
  margin-bottom: 12px;
}
.ts h4 {
  font-size: 0.86rem;
  color: var(--ts-chalk);
  margin-bottom: 10px;
}
.ts-head p {
  margin: 4px 0 0;
  color: var(--ts-ash);
}
.ts-close {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 3px;
  border: 1px solid var(--ts-grout);
  background: rgba(0, 0, 0, 0.35);
  color: var(--ts-ash);
  font-size: 1rem;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.ts-close:hover {
  color: var(--ts-chalk);
}
.ts button:focus-visible {
  outline: 2px solid var(--ts-gold);
  outline-offset: 2px;
}

/* Inhalt */
.ts-body {
  overflow-y: auto;
  padding: 24px 28px 34px;
}
.ts-sec + .ts-sec {
  margin-top: 22px;
}
.ts-empty {
  color: var(--ts-ash);
  margin: 0;
}
.ts-card {
  padding: 18px 20px;
  background-color: var(--ts-slab);
  background-image: var(--ts-noise), linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(0, 0, 0, 0.08));
  border: 1px solid var(--ts-grout);
  border-radius: 3px;
  box-shadow: var(--ts-bevel), 0 4px 10px rgba(0, 0, 0, 0.45);
}
.ts-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin: 0 9px 1px 1px;
  border-radius: 1px;
  transform: rotate(45deg);
  vertical-align: middle;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6);
}

/* Trumpf-Balken */
.ts-trump {
  display: flex;
  height: 34px;
  gap: 3px;
  padding: 3px;
  border-radius: 2px;
  background: var(--ts-grout);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.8), 0 1px 0 rgba(255, 255, 255, 0.06);
}
.ts-trump i {
  font-style: normal;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 1px;
  font-family: var(--ts-serif);
  font-weight: 700;
  font-size: 0.9rem;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  background-image: var(--ts-noise);
  background-blend-mode: multiply;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), inset 0 -2px 0 rgba(0, 0, 0, 0.3);
  filter: saturate(0.78) brightness(0.92);
}
.ts-trump i.wiz {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}
.ts-trump i.narr {
  color: #1b1b1b;
  text-shadow: none;
}

/* Glück und teuerste Runde */
.ts-duo {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 18px;
}
.ts-luck {
  display: grid;
  grid-template-columns: 1fr 74px 74px;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.5);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.035);
}
.ts-luck.h {
  padding-top: 0;
  color: var(--ts-ash);
  font-family: var(--ts-serif);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.ts-luck span:nth-child(n + 2) {
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.ts-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 2px;
  font-family: var(--ts-serif);
  font-weight: 700;
  font-size: 0.64rem;
  letter-spacing: 0.04em;
  vertical-align: middle;
}
.ts-badge.good {
  background: #2f4a37;
  color: #b9e2c3;
  box-shadow: inset 0 0 0 1px #4f7a5b;
}
.ts-badge.bad {
  background: #4e2d2b;
  color: #f0bcb6;
  box-shadow: inset 0 0 0 1px #7e4a46;
}
.ts-big {
  font-family: var(--ts-serif);
  font-weight: 700;
  font-size: 3rem;
  line-height: 1;
  color: #d9675e;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.9), 0 1px 0 rgba(255, 255, 255, 0.1);
}
.ts-costly p {
  margin: 8px 0 0;
  color: var(--ts-ash);
}
.ts-costly strong {
  color: var(--ts-chalk);
}

/* Kacheln */
.ts-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.ts-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px 40px;
  align-items: center;
  gap: 10px;
  margin: 7px 0;
  font-size: 0.9rem;
}
.ts-row .n {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ts-ash);
}
.ts-row.top .n {
  color: var(--ts-chalk);
}
.ts-track {
  height: 10px;
  border-radius: 1px;
  background: #19191b;
  overflow: hidden;
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.85), 0 1px 0 rgba(255, 255, 255, 0.05);
}
.ts-track b {
  display: block;
  height: 100%;
  border-radius: 1px;
  background: linear-gradient(180deg, #7d7d83, #55555b 60%, #3f3f44);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.ts-row.top .ts-track b {
  background: linear-gradient(180deg, var(--ts-gold-hi), var(--ts-gold) 55%, var(--ts-gold-lo));
}
.ts-row .v {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.ts-row.top .v {
  color: var(--ts-gold);
  font-weight: 700;
}

@media (max-width: 820px) {
  .ts {
    padding: 0;
  }
  .ts-panel {
    height: 100%;
    border-radius: 0;
  }
  .ts-head,
  .ts-body {
    padding-left: 16px;
    padding-right: 16px;
  }
  .ts-duo,
  .ts-tiles {
    grid-template-columns: 1fr;
  }
}
@media (prefers-reduced-motion: reduce) {
  .ts-panel {
    animation: none;
  }
}
