/* The tournaments page as a game screen (views/tournamentsPartial.jsx).
   Built on the event page's pieces (public/event-hall.css: .ev-hall, .ev-hero,
   .ev-plate, .ev-cta, .ev-panel, .ev-steps) and the trophy hall's frame and
   ribbon (public/achievements-hall.css). Only what's tournament-specific lives
   here, scoped to .tn-hall. --tn-arena is each arena's own colour. */

.tn-hall { --tn-arena: #4a3a20; }

/* ── Hero ── */
.tn-hero {
  background:
    radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--tn-arena) 55%, transparent) 0%, transparent 70%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.45));
}
.tn-hero .tn-seal { position: absolute; }
.tn-hero-art {
  width: 140px;
  margin-top: 18px;
}
.tn-hero-count {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px 12px;
  margin: 0;
  font-size: 0.95rem;
  color: var(--ev-ink);
}
.tn-hero-count > i { color: var(--ev-gold); }
.tn-you-in {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(46, 125, 50, 0.85);
  border: 1px solid #7ee07e;
  color: #fff;
  font-weight: 800;
  font-size: 0.8rem;
}

/* The podium: 2nd · 1st · 3rd, the winner's step tallest. */
.tn-podium {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 120px));
  justify-content: center;
  align-items: end;
  gap: 6px;
  margin-top: 10px;
  width: 100%;
}
.tn-step {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  min-width: 0;
}
.tn-step-prize {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  min-height: 2.4em;
  font-weight: 800;
  font-size: 0.85rem;
  line-height: 1.15;
  color: #ffe27a;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}
.tn-step-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
  padding-top: 10px;
  border-radius: 8px 8px 2px 2px;
  border: 1px solid rgba(0, 0, 0, 0.55);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.35), 0 4px 10px rgba(0, 0, 0, 0.45);
  color: #2a1a05;
}
.tn-step-block i { font-size: 1.35rem; }
.tn-step-block b { font: 800 1rem/1 "Cinzel", serif; }
.tn-step-first .tn-step-block {
  height: 100px;
  background: linear-gradient(180deg, #ffe48a 0%, #f0b52e 55%, #c98a12 100%);
}
.tn-step-second .tn-step-block {
  height: 84px;
  background: linear-gradient(180deg, #f2f4f7 0%, #c3c8cf 55%, #8d949d 100%);
}
.tn-step-third .tn-step-block {
  height: 72px;
  background: linear-gradient(180deg, #f0c093 0%, #c98a52 55%, #8e5a2b 100%);
}

/* ── Live now ── */
.tn-live {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(150, 30, 20, 0.75), rgba(60, 14, 10, 0.75));
  border: 1px solid rgba(255, 120, 100, 0.55);
}
.tn-live-dot {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ff4a3a;
  box-shadow: 0 0 0 0 rgba(255, 74, 58, 0.7);
  animation: tnLivePulse 1.6s ease-out infinite;
}
.tn-live-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tn-live-text strong { font: 700 1rem/1.2 "Cinzel", serif; color: #fff2d6; }
.tn-live-text span { font-size: 0.85rem; color: #ffd9cf; }

/* ── Daily arenas ── */
.tn-arenas {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tn-arena {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--ev-edge);
  border-left: 5px solid var(--tn-arena);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--tn-arena) 30%, transparent), transparent 60%),
    rgba(0, 0, 0, 0.35);
  color: var(--ev-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.15s ease, background-color 0.15s ease;
}
.tn-arena:hover,
.tn-arena:focus-visible {
  outline: none;
  border-color: rgba(255, 210, 58, 0.6);
  border-left-color: var(--tn-arena);
  background-color: rgba(0, 0, 0, 0.5);
}
.tn-arena:active { transform: translateY(1px); }
.tn-arena.is-next { box-shadow: 0 0 0 1px rgba(255, 210, 58, 0.55), 0 0 14px rgba(255, 210, 58, 0.18); }
.tn-arena.is-live { box-shadow: 0 0 0 1px rgba(255, 100, 80, 0.7), 0 0 14px rgba(255, 74, 58, 0.25); }

.tn-arena-time {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 64px;
  padding: 6px 6px 4px;
  border-radius: 8px;
  background: linear-gradient(160deg, #5b6068 0%, #3a3e44 50%, #26292d 100%);
  border: 1px solid rgba(0, 0, 0, 0.6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 2px 4px rgba(0, 0, 0, 0.45);
}
.tn-arena-time b {
  font: 800 1.05rem/1.1 "Cinzel", serif;
  color: var(--ev-gold);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tn-arena-time small {
  font: 700 0.6rem/1.2 system-ui, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #b8bec7;
}
.tn-arena.is-live .tn-arena-time small { color: #ff8a7a; }

.tn-crest {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 40px;
  height: 46px;
  clip-path: polygon(0 0, 100% 0, 100% 62%, 50% 100%, 0 62%);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.28), rgba(0, 0, 0, 0.25)),
    var(--tn-arena);
  color: #ffe9b0;
  font-size: 1.05rem;
  padding-bottom: 6px;
  box-sizing: border-box;
}

.tn-arena-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.tn-arena-name {
  font: 700 1rem/1.2 "Cinzel", serif;
  color: var(--ev-ink);
}
.tn-arena-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  font-size: 0.82rem;
  color: var(--ev-ink-dim);
}
.tn-arena-meta i { color: var(--ev-gold); margin-right: 2px; }
.tn-arena-champ {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tn-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tn-tags:empty { display: none; }
.tn-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.25;
  max-width: 100%;
  box-sizing: border-box;
}
.tn-tag-prize { background: rgba(255, 210, 58, 0.18); border: 1px solid rgba(255, 210, 58, 0.55); color: #ffe27a; }
.tn-tag-deck { background: rgba(150, 120, 255, 0.18); border: 1px solid rgba(180, 160, 255, 0.5); color: #d6c8ff; }

.tn-arena-state {
  flex: 0 0 auto;
  color: var(--ev-ink-dim);
}
.tn-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.tn-chip-live { background: #c0392b; color: #fff; }
.tn-chip-in { background: rgba(46, 125, 50, 0.9); color: #fff; }
.tn-chip-off { background: rgba(255, 255, 255, 0.12); color: var(--ev-ink-dim); }

/* ── Rankings: a paper list like the event's notice board ── */
.tn-ranks {
  list-style: none;
  margin: 0;
  padding: 8px;
  border-radius: 10px;
  background:
    linear-gradient(rgba(249, 230, 190, 0.95), rgba(236, 210, 160, 0.95)),
    url("/gui/paper_texture.png") center / cover;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
  color: #3d2000;
}
.tn-rank {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto 52px;
  align-items: center;
  gap: 10px;
  padding: 7px 6px;
  border-bottom: 1px dashed rgba(90, 58, 18, 0.3);
}
.tn-rank:last-child { border-bottom: 0; }
.tn-rank.is-you { background: rgba(255, 210, 58, 0.35); border-radius: 6px; }
.tn-rank-pos {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(90, 58, 18, 0.15);
  font: 800 0.85rem/1 "Cinzel", serif;
}
.tn-rank-1 .tn-rank-pos { background: linear-gradient(180deg, #ffe48a, #c98a12); color: #3d2000; }
.tn-rank-2 .tn-rank-pos { background: linear-gradient(180deg, #f2f4f7, #8d949d); color: #222; }
.tn-rank-3 .tn-rank-pos { background: linear-gradient(180deg, #f0c093, #8e5a2b); color: #2a1503; }
.tn-rank-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}
.tn-rank-top .tn-rank-name { font-family: "Cinzel", serif; }
.tn-rank-record { font-size: 0.8rem; color: #6a4a1a; white-space: nowrap; }
.tn-rank-noshow { color: #a0402a; }
.tn-rank-elo {
  justify-self: end;
  font: 800 1rem/1 "Cinzel", serif;
  color: #8a5a12;
  font-variant-numeric: tabular-nums;
}
.tn-ranks-empty {
  margin: 0;
  padding: 16px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.3);
  text-align: center;
  color: var(--ev-ink-dim);
}

@media (max-width: 600px) {
  .tn-arena { gap: 9px; padding: 9px 10px; }
  .tn-arena-time { min-width: 0; padding: 5px 5px 3px; }
  .tn-arena-time b { font-size: 0.9rem; }
  .tn-arena-time small { font-size: 0.55rem; }
  .tn-arena-name { font-size: 0.92rem; }
  .tn-crest { display: none; }
  .tn-rank { grid-template-columns: 30px minmax(0, 1fr) 46px; }
  .tn-rank-record { grid-column: 2; grid-row: 2; margin-top: -6px; }
  .tn-rank-elo { grid-column: 3; grid-row: 1 / span 2; }
}

@keyframes tnLivePulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 74, 58, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(255, 74, 58, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 74, 58, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .tn-live-dot { animation: none; }
}
