/* ==================================================
   生態系ウォーズ — チーム対抗戦 トーナメント表
   ================================================== */

.tn-body {
  background: var(--bg);
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  overflow-x: hidden;
}

/* ---------- TOP BAR ---------- */
.tn-bar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  background: var(--ink); color: #F5EFE0;
  padding: 14px clamp(16px, 4vw, 40px);
  border-bottom: 3px solid var(--line);
}
.tn-bar::before {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,194,26,0.10) 1.2px, transparent 1.8px);
  background-size: 14px 14px; pointer-events: none;
}
.tn-back {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'DotGothic16', monospace; font-size: 12px;
  letter-spacing: 0.1em; color: var(--accent-yellow);
  text-decoration: none;
  border: 1.5px solid rgba(255,194,26,0.5);
  padding: 8px 14px; border-radius: 999px;
  transition: all 0.15s ease;
}
.tn-back:hover { background: var(--accent-yellow); color: var(--ink); }
.tn-bar-title {
  position: relative; z-index: 1;
  font-family: 'DotGothic16', monospace; font-size: 13px;
  letter-spacing: 0.16em; color: rgba(245,239,224,0.9);
}
.tn-bar-title strong { color: var(--accent-yellow); font-weight: 400; }
.tn-bar-spacer { flex: 1; }
.tn-bar-meta {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 12px;
}
.tn-bar-stat {
  font-family: 'DotGothic16', monospace; font-size: 11px;
  letter-spacing: 0.08em; color: rgba(245,239,224,0.7);
}
.tn-bar-stat b { color: var(--accent-yellow); font-size: 14px; }
.tn-bar-reset {
  font-family: 'DotGothic16', monospace; font-size: 11px;
  letter-spacing: 0.06em; color: #FFB4A0;
  background: transparent; border: 1.5px solid rgba(230,66,26,0.6);
  border-radius: 999px; padding: 7px 13px; cursor: pointer; white-space: nowrap;
  transition: all 0.15s ease;
}
.tn-bar-reset:hover { background: var(--accent-red); color: #fff; border-color: var(--accent-red); }

/* ==================================================
   SETUP PHASE — チーム名登録
   ================================================== */
.tn-setup {
  max-width: 980px; margin: 0 auto; padding: clamp(36px, 6vw, 72px) 6vw 100px;
}
.tn-setup-head { text-align: center; margin-bottom: 36px; }
.tn-setup-label {
  display: inline-block;
  font-family: 'DotGothic16', monospace; font-size: 12px;
  letter-spacing: 0.2em; color: var(--accent-orange);
  border: 2px solid var(--line); border-radius: 999px;
  padding: 6px 16px; background: var(--paper); margin-bottom: 18px;
}
.tn-setup-title {
  font-family: 'Zen Antique', serif; font-size: clamp(30px, 5vw, 48px);
  line-height: 1.12; margin: 0 0 14px;
}
.tn-setup-title .hl { color: var(--accent-orange); }
.tn-setup-sub {
  font-family: 'Zen Kaku Gothic New', sans-serif;
  font-size: 15px; line-height: 1.85; color: var(--ink-soft);
  max-width: 580px; margin: 0 auto;
}

.tn-teams-panel {
  background: var(--paper); border: 3px solid var(--line);
  border-radius: 20px; box-shadow: var(--shadow-hard-lg);
  padding: clamp(24px, 4vw, 40px);
}
.tn-teams-panel-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 22px; flex-wrap: wrap;
}
.tn-teams-panel-h {
  font-family: 'Zen Antique', serif; font-size: 22px; margin: 0; white-space: nowrap;
}
.tn-teams-count {
  font-family: 'DotGothic16', monospace; font-size: 13px;
  color: var(--muted); letter-spacing: 0.06em;
}
.tn-teams-count b { color: var(--accent-orange); font-size: 18px; }

.tn-team-rows {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (max-width: 680px) { .tn-team-rows { grid-template-columns: 1fr; } }

.tn-team-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-alt); border: 2.5px solid var(--line);
  border-radius: 14px; padding: 10px 12px;
  transition: border-color 0.15s ease;
}
.tn-team-row:focus-within { border-color: var(--accent-orange); }
.tn-team-seed {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center;
  font-family: 'Zen Antique', serif; font-size: 18px; color: #fff;
  border: 2px solid var(--line);
}
.tn-team-input {
  flex: 1; min-width: 0;
  font-family: 'Zen Kaku Gothic New', sans-serif; font-size: 16px; font-weight: 700;
  color: var(--ink); background: transparent; border: none; padding: 6px 2px;
}
.tn-team-input:focus { outline: none; }
.tn-team-input::placeholder { color: var(--muted); font-weight: 500; }
.tn-team-del {
  flex-shrink: 0; width: 32px; height: 32px; border-radius: 8px;
  background: transparent; border: 2px solid transparent; color: var(--muted);
  font-size: 18px; cursor: pointer; line-height: 1;
  display: grid; place-items: center;
  transition: all 0.12s ease;
}
.tn-team-del:hover { background: rgba(230,66,26,0.12); color: var(--accent-red); border-color: var(--accent-red); }
.tn-team-del:disabled { opacity: 0; pointer-events: none; }

.tn-setup-actions {
  display: flex; gap: 14px; flex-wrap: wrap; margin-top: 24px;
  align-items: center;
}
.tn-add-btn {
  cursor: pointer;
  font-family: 'Zen Kaku Gothic New', sans-serif; font-weight: 700; font-size: 14px;
  color: var(--ink); background: var(--bg);
  border: 2.5px dashed var(--line); border-radius: 999px;
  padding: 13px 22px;
  display: inline-flex; align-items: center; gap: 8px;
  transition: all 0.14s ease;
}
.tn-add-btn:hover:not(:disabled) { background: var(--accent-yellow); border-style: solid; }
.tn-add-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.tn-add-btn .plus { font-family: 'Zen Antique', serif; font-size: 20px; }

.tn-confirm-btn {
  margin-left: auto; cursor: pointer;
  font-family: 'Zen Antique', serif; font-size: 19px; color: #fff;
  background: var(--accent-orange); border: 3px solid var(--line);
  border-radius: 14px; padding: 15px 34px; box-shadow: var(--shadow-hard);
  display: inline-flex; align-items: center; gap: 10px; white-space: nowrap;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.tn-confirm-btn:hover:not(:disabled) { transform: translate(-2px,-2px); box-shadow: var(--shadow-hard-lg); }
.tn-confirm-btn:active:not(:disabled) { transform: translate(1px,1px); box-shadow: 2px 2px 0 var(--line); }
.tn-confirm-btn:disabled { opacity: 0.45; cursor: not-allowed; }
@media (max-width: 680px) {
  .tn-setup-actions { flex-direction: column; align-items: stretch; }
  .tn-confirm-btn { margin-left: 0; justify-content: center; }
  .tn-add-btn { justify-content: center; }
}

.tn-setup-hint {
  margin-top: 26px; padding: 18px 22px;
  background: var(--paper); border: 2px dashed var(--line); border-radius: 14px;
  font-family: 'Zen Kaku Gothic New', sans-serif;
  font-size: 13px; line-height: 1.85; color: var(--ink-soft);
}
.tn-setup-hint b { color: var(--ink); }

/* ==================================================
   READY / RUNNING — bracket stage
   ================================================== */
.tn-stage {
  padding: clamp(24px, 3vw, 40px) clamp(16px, 3vw, 44px) 80px;
}

/* control strip above bracket */
.tn-controls {
  max-width: 1500px; margin: 0 auto 28px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.tn-controls-title {
  font-family: 'Zen Antique', serif; font-size: clamp(22px, 3vw, 32px);
  margin: 0; line-height: 1.1;
}
.tn-controls-title small {
  display: block; font-family: 'DotGothic16', monospace; font-size: 11px;
  letter-spacing: 0.14em; color: var(--muted); margin-top: 6px;
}
.tn-controls-spacer { flex: 1; }
.tn-shuffle-btn {
  cursor: pointer;
  font-family: 'Zen Antique', serif; font-size: 18px; color: var(--ink);
  background: var(--accent-yellow); border: 3px solid var(--line);
  border-radius: 999px; padding: 13px 28px; box-shadow: var(--shadow-hard);
  display: inline-flex; align-items: center; gap: 10px; white-space: nowrap;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.tn-shuffle-btn:hover:not(:disabled) { transform: translate(-2px,-2px); box-shadow: var(--shadow-hard-lg); }
.tn-shuffle-btn:active:not(:disabled) { transform: translate(1px,1px); box-shadow: 2px 2px 0 var(--line); }
.tn-shuffle-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.tn-shuffle-btn .ico { font-size: 20px; }
.tn-edit-btn {
  cursor: pointer;
  font-family: 'DotGothic16', monospace; font-size: 12px; letter-spacing: 0.04em;
  color: var(--ink); background: var(--paper);
  border: 2.5px solid var(--line); border-radius: 999px; padding: 12px 20px; white-space: nowrap;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.tn-edit-btn:hover { transform: translate(-1px,-1px); box-shadow: var(--shadow-hard); }

/* pre-draw banner (teams confirmed, not yet shuffled) */
.tn-predraw {
  max-width: 1100px; margin: 0 auto;
  background: var(--ink); color: #F5EFE0;
  border: 3px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow-hard-lg);
  padding: clamp(32px, 5vw, 56px); text-align: center;
  position: relative; overflow: hidden;
}
.tn-predraw::before {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,194,26,0.10) 1.2px, transparent 1.8px);
  background-size: 16px 16px; pointer-events: none;
}
.tn-predraw-inner { position: relative; z-index: 1; }
.tn-predraw-label {
  font-family: 'DotGothic16', monospace; font-size: 12px;
  letter-spacing: 0.2em; color: var(--accent-yellow); margin-bottom: 16px;
}
.tn-predraw-title {
  font-family: 'Zen Antique', serif; font-size: clamp(26px, 4vw, 40px);
  line-height: 1.2; margin: 0 0 16px; color: #F5EFE0;
}
.tn-predraw-title .hl { color: var(--accent-yellow); }
.tn-predraw-sub {
  font-family: 'Zen Kaku Gothic New', sans-serif; font-size: 14px;
  line-height: 1.85; color: rgba(245,239,224,0.8); max-width: 560px; margin: 0 auto 28px;
}
.tn-predraw-chips {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 32px;
}
.tn-predraw-chip {
  font-family: 'Zen Kaku Gothic New', sans-serif; font-weight: 700; font-size: 14px;
  color: #fff; border: 2px solid rgba(0,0,0,0.4); border-radius: 999px;
  padding: 8px 16px; display: inline-flex; align-items: center; gap: 7px;
}
.tn-predraw-chip .seed {
  font-family: 'DotGothic16', monospace; font-size: 10px;
  opacity: 0.85;
}
.tn-predraw-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.tn-bigdraw-btn {
  cursor: pointer;
  font-family: 'Zen Antique', serif; font-size: 22px; color: var(--ink);
  background: var(--accent-yellow); border: 3px solid var(--line);
  border-radius: 16px; padding: 18px 44px; box-shadow: var(--shadow-hard-lg);
  display: inline-flex; align-items: center; gap: 12px; white-space: nowrap;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.tn-bigdraw-btn:hover { transform: translate(-3px,-3px); box-shadow: 11px 11px 0 var(--line); }
.tn-bigdraw-btn:active { transform: translate(2px,2px); box-shadow: 3px 3px 0 var(--line); }
.tn-bigdraw-btn .ico { font-size: 26px; animation: tn-wiggle 1.6s ease-in-out infinite; }
@keyframes tn-wiggle {
  0%, 100% { transform: rotate(-12deg); }
  50% { transform: rotate(12deg); }
}
.tn-predraw-ghost {
  cursor: pointer;
  font-family: 'DotGothic16', monospace; font-size: 12px; letter-spacing: 0.06em;
  color: rgba(245,239,224,0.85); background: transparent;
  border: 2px solid rgba(245,239,224,0.4); border-radius: 16px; padding: 18px 26px;
  transition: all 0.14s ease;
}
.tn-predraw-ghost:hover { background: rgba(245,239,224,0.1); }

/* ==================================================
   BRACKET
   ================================================== */
.tn-bracket-wrap {
  max-width: 1500px; margin: 0 auto;
  overflow-x: auto; padding: 8px 4px 24px;
  -webkit-overflow-scrolling: touch;
}
.tn-bracket {
  display: flex; align-items: stretch;
  min-height: 460px;
  min-width: min-content;
}
.tn-round {
  display: flex; flex-direction: column;
  flex: 1 0 var(--col-w, 220px);
  min-width: var(--col-w, 220px);
}
.tn-round-head {
  text-align: center; margin-bottom: 14px; padding: 0 8px;
}
.tn-round-name {
  font-family: 'Zen Antique', serif; font-size: 17px; line-height: 1.1;
  color: var(--ink);
}
.tn-round-en {
  font-family: 'DotGothic16', monospace; font-size: 10px;
  letter-spacing: 0.12em; color: var(--muted); margin-top: 3px;
}
.tn-round-col {
  flex: 1; display: flex; flex-direction: column;
}

/* each match occupies an equal-height slot — connector math relies on this */
.tn-slot {
  flex: 1; position: relative;
  display: flex; flex-direction: column; justify-content: center;
  padding: 6px 0;
}

/* outgoing connector (right) — only for rounds that feed another */
.tn-round.has-next .tn-slot::after {
  content: ''; position: absolute;
  right: calc(var(--gap, 38px) / -2 - 2px); top: 50%;
  width: calc(var(--gap, 38px) / 2); height: 3px;
  background: var(--line);
}
.tn-round.has-next .tn-slot:nth-child(odd)::before {
  content: ''; position: absolute;
  right: calc(var(--gap, 38px) / -2 - 2px); top: 50%; bottom: 6px;
  width: 3px; background: var(--line);
}
.tn-round.has-next .tn-slot:nth-child(even)::before {
  content: ''; position: absolute;
  right: calc(var(--gap, 38px) / -2 - 2px); bottom: 50%; top: 6px;
  width: 3px; background: var(--line);
}
/* incoming connector (left) for rounds beyond the first */
.tn-round.has-prev .tn-slot .tn-match::before {
  content: ''; position: absolute;
  left: calc(var(--gap, 38px) / -2 - 2px); top: 50%;
  width: calc(var(--gap, 38px) / 2 + 2px); height: 3px;
  background: var(--line);
}

/* match card */
.tn-match {
  position: relative;
  background: var(--paper); border: 3px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow-hard);
  margin: 0 var(--gap, 38px) 0 0;
  overflow: hidden;
}
.tn-round:last-child .tn-match { margin-right: 0; }
.tn-match-no {
  font-family: 'DotGothic16', monospace; font-size: 9px;
  letter-spacing: 0.1em; color: var(--muted);
  padding: 4px 10px 2px; border-bottom: 1.5px dashed var(--line);
}

/* team chip (clickable) */
.tn-chip {
  display: flex; align-items: center; gap: 9px;
  width: 100%; box-sizing: border-box;
  padding: 11px 12px; cursor: pointer; border: none; background: transparent;
  font-family: 'Zen Kaku Gothic New', sans-serif; text-align: left;
  transition: background 0.14s ease;
  position: relative;
}
.tn-chip + .tn-chip { border-top: 2px solid var(--line); }
.tn-chip:not(.is-tbd):not(.is-bye):hover { background: var(--bg-alt); }
.tn-chip-swatch {
  flex-shrink: 0; width: 18px; height: 18px; border-radius: 5px;
  border: 2px solid var(--line);
}
.tn-chip-name {
  flex: 1; min-width: 0; font-weight: 700; font-size: 14px; color: var(--ink);
  line-height: 1.25;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tn-chip-mark {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; font-size: 14px;
  border: 2px solid transparent; color: transparent;
}

/* winner / loser / tbd states */
.tn-chip.is-win .tn-chip-name { color: var(--ink); }
.tn-chip.is-win {
  background: var(--accent-yellow);
}
.tn-chip.is-win:hover { background: var(--accent-yellow); }
.tn-chip.is-win .tn-chip-mark {
  background: var(--ink); color: var(--accent-yellow); border-color: var(--line);
}
.tn-chip.is-lose { opacity: 0.5; }
.tn-chip.is-lose .tn-chip-name { text-decoration: line-through; text-decoration-thickness: 2px; color: var(--muted); }
.tn-chip.is-tbd { cursor: default; }
.tn-chip.is-tbd .tn-chip-name { color: var(--muted); font-weight: 500; font-style: italic; }
.tn-chip.is-tbd .tn-chip-swatch { background: transparent; border-style: dashed; }
.tn-chip.is-bye { cursor: default; }
.tn-chip.is-bye .tn-chip-name { color: var(--muted); font-family: 'DotGothic16', monospace; font-size: 11px; letter-spacing: 0.08em; }
.tn-chip.is-bye .tn-chip-swatch { background: repeating-linear-gradient(45deg, var(--muted) 0 3px, transparent 3px 6px); border-color: var(--muted); }

/* a settled match (winner chosen) gets a subtle tag */
.tn-match.is-decided { box-shadow: 4px 4px 0 var(--accent-orange); }

/* win pop animation */
@keyframes tn-winpop {
  0% { transform: scale(1); }
  35% { transform: scale(1.06); }
  100% { transform: scale(1); }
}
.tn-chip.just-won { animation: tn-winpop 0.45s cubic-bezier(.34,1.56,.64,1); }

/* champion column */
.tn-champ-col {
  flex: 0 0 260px; min-width: 260px;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding-left: 8px;
}
.tn-champ-box {
  position: relative;
  background: linear-gradient(180deg, #2A2017, var(--ink));
  border: 3px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow-hard-lg);
  padding: 26px 22px; text-align: center; width: 100%;
  overflow: hidden;
}
.tn-champ-box::before {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,194,26,0.12) 1.2px, transparent 1.8px);
  background-size: 15px 15px; pointer-events: none;
}
.tn-champ-shield {
  position: relative; z-index: 1;
  width: 96px; margin: 0 auto 10px;
  filter: drop-shadow(3px 4px 0 rgba(0,0,0,0.4));
}
.tn-champ-shield.is-empty { opacity: 0.25; filter: grayscale(1); }
.tn-champ-label {
  position: relative; z-index: 1;
  font-family: 'DotGothic16', monospace; font-size: 11px;
  letter-spacing: 0.16em; color: var(--accent-yellow); margin-bottom: 8px;
}
.tn-champ-name {
  position: relative; z-index: 1;
  font-family: 'Zen Antique', serif; font-size: 22px; line-height: 1.2;
  color: #F5EFE0; word-break: break-word;
}
.tn-champ-name.is-tbd { color: rgba(245,239,224,0.4); font-size: 15px; }

@media (max-width: 900px) {
  .tn-champ-col { flex-basis: 200px; min-width: 200px; }
}

/* ==================================================
   DRAW OVERLAY — ガチャ抽選演出
   ================================================== */
.tn-draw-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(15, 11, 7, 0.94);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transition: opacity 0.25s ease, visibility 0.25s ease;
}
.tn-draw-overlay.is-open { opacity: 1; visibility: visible; }
.tn-draw-overlay::before {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,194,26,0.1) 1.4px, transparent 2px);
  background-size: 18px 18px; pointer-events: none;
  animation: tn-bgshift 8s linear infinite;
}
@keyframes tn-bgshift { from { background-position: 0 0; } to { background-position: 18px 18px; } }

.tn-draw-label {
  font-family: 'DotGothic16', monospace; font-size: 14px; letter-spacing: 0.24em;
  color: var(--accent-yellow); margin-bottom: 28px; position: relative; z-index: 1;
}
.tn-draw-capsule {
  position: relative; z-index: 1;
  width: min(720px, 92vw); height: 200px;
  border: 4px solid var(--accent-yellow); border-radius: 24px;
  background: var(--ink); overflow: hidden;
  box-shadow: 0 0 0 6px rgba(255,194,26,0.18), 0 24px 60px rgba(0,0,0,0.6);
  display: grid; place-items: center;
}
.tn-draw-capsule.is-spinning { animation: tn-capshake 0.3s ease-in-out infinite; }
@keyframes tn-capshake {
  0%, 100% { transform: translate(0,0) rotate(0); }
  25% { transform: translate(-2px,1px) rotate(-0.4deg); }
  75% { transform: translate(2px,-1px) rotate(0.4deg); }
}
.tn-draw-pair {
  display: flex; align-items: center; gap: clamp(12px, 3vw, 32px);
  padding: 0 20px;
}
.tn-draw-team {
  font-family: 'Zen Antique', serif; font-size: clamp(20px, 3.2vw, 32px);
  color: #fff; max-width: 40vw; text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tn-draw-vs {
  font-family: 'Zen Antique', serif; font-size: clamp(20px, 3vw, 30px);
  color: var(--accent-orange); flex-shrink: 0;
}
.tn-draw-bracketno {
  font-family: 'DotGothic16', monospace; font-size: 12px; letter-spacing: 0.14em;
  color: var(--accent-yellow); margin-top: 22px; position: relative; z-index: 1;
}
.tn-draw-skip {
  margin-top: 36px; position: relative; z-index: 1;
  font-family: 'DotGothic16', monospace; font-size: 12px; letter-spacing: 0.06em;
  color: rgba(245,239,224,0.7); background: transparent;
  border: 1.5px solid rgba(245,239,224,0.4); border-radius: 999px;
  padding: 10px 22px; cursor: pointer; transition: all 0.14s ease;
}
.tn-draw-skip:hover { background: rgba(245,239,224,0.12); color: #fff; }

/* ==================================================
   CHAMPION OVERLAY — 優勝の派手な演出
   ================================================== */
.tn-win-overlay {
  position: fixed; inset: 0; z-index: 210;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transition: opacity 0.4s ease, visibility 0.4s ease;
  background: radial-gradient(ellipse at center, rgba(42,32,23,0.97), rgba(15,11,7,0.99));
  overflow: hidden;
}
.tn-win-overlay.is-open { opacity: 1; visibility: visible; }
.tn-win-rays {
  position: absolute; top: 50%; left: 50%;
  width: 200vmax; height: 200vmax; transform: translate(-50%,-50%);
  background: repeating-conic-gradient(from 0deg,
    rgba(255,194,26,0.12) 0deg 8deg, transparent 8deg 16deg);
  animation: tn-spin 28s linear infinite;
  pointer-events: none;
}
@keyframes tn-spin { to { transform: translate(-50%,-50%) rotate(360deg); } }

.tn-win-card {
  position: relative; z-index: 2; text-align: center;
  padding: 20px; max-width: 760px;
  transform: scale(0.8); opacity: 0;
  transition: transform 0.5s cubic-bezier(.34,1.56,.64,1), opacity 0.4s ease;
}
.tn-win-overlay.is-open .tn-win-card { transform: scale(1); opacity: 1; }
.tn-win-label {
  font-family: 'DotGothic16', monospace; font-size: clamp(12px, 1.8vw, 16px);
  letter-spacing: 0.3em; color: var(--accent-yellow); margin-bottom: 18px;
}
.tn-win-shield {
  width: clamp(150px, 22vw, 230px); margin: 0 auto 6px;
  filter: drop-shadow(0 0 30px rgba(255,194,26,0.5)) drop-shadow(4px 8px 0 rgba(0,0,0,0.4));
  animation: tn-shield-float 3s ease-in-out infinite;
}
@keyframes tn-shield-float {
  0%, 100% { transform: translateY(0) rotate(-1.5deg); }
  50% { transform: translateY(-12px) rotate(1.5deg); }
}
.tn-win-crown {
  font-size: clamp(40px, 7vw, 70px); line-height: 1; margin-bottom: 4px;
  animation: tn-crown-pop 0.6s cubic-bezier(.34,1.56,.64,1) 0.3s both;
}
@keyframes tn-crown-pop { from { transform: scale(0) rotate(-30deg); } to { transform: scale(1) rotate(0); } }
.tn-win-champ-of {
  font-family: 'DotGothic16', monospace; font-size: clamp(12px, 1.6vw, 15px);
  letter-spacing: 0.2em; color: rgba(245,239,224,0.75); margin: 14px 0 10px;
}
.tn-win-name {
  font-family: 'Zen Antique', serif; font-size: clamp(40px, 8vw, 90px);
  line-height: 1.05; color: var(--accent-yellow);
  text-shadow: 4px 4px 0 var(--accent-red), 0 0 40px rgba(255,194,26,0.4);
  word-break: break-word; margin-bottom: 8px;
}
.tn-win-sub {
  font-family: 'Zen Kaku Gothic New', sans-serif; font-size: clamp(14px, 2vw, 18px);
  color: rgba(245,239,224,0.85); line-height: 1.7; margin-bottom: 34px;
}
.tn-win-sub b { color: #fff; }
.tn-win-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.tn-win-btn {
  cursor: pointer;
  font-family: 'Zen Antique', serif; font-size: 17px; color: var(--ink);
  background: var(--accent-yellow); border: 3px solid #F5EFE0;
  border-radius: 14px; padding: 14px 30px; white-space: nowrap;
  transition: transform 0.12s ease;
}
.tn-win-btn:hover { transform: translateY(-2px); }
.tn-win-btn.ghost { background: transparent; color: #F5EFE0; border-color: rgba(245,239,224,0.5); }

/* confetti */
.tn-confetti {
  position: fixed; inset: 0; z-index: 220; pointer-events: none; overflow: hidden;
}
.tn-confetti i {
  position: absolute; top: -24px; width: 12px; height: 18px;
  opacity: 0; will-change: transform;
  animation: tn-fall linear forwards;
}
@keyframes tn-fall {
  0% { transform: translateY(-10vh) rotate(0deg); opacity: 1; }
  100% { transform: translateY(108vh) rotate(720deg); opacity: 1; }
}

@media (max-width: 760px) {
  .tn-stage { padding: 20px 12px 60px; }
  .tn-bracket { min-height: 360px; }
}

/* ==================================================
   VIEW TABS — トーナメント表 / 順位表
   ================================================== */
.tn-tabs {
  display: inline-flex; background: var(--bg-alt);
  border: 2.5px solid var(--line); border-radius: 999px;
  padding: 4px; gap: 4px; box-shadow: var(--shadow-hard);
}
.tn-tabs button {
  cursor: pointer; border: none; background: transparent;
  font-family: 'Zen Kaku Gothic New', sans-serif; font-weight: 700; font-size: 14px;
  color: var(--muted); border-radius: 999px; padding: 9px 20px;
  white-space: nowrap; transition: all 0.14s ease;
}
.tn-tabs button:hover { color: var(--ink); }
.tn-tabs button.is-active {
  background: var(--ink); color: var(--accent-yellow);
}

/* ==================================================
   RANKING — 順位表
   ================================================== */
.tn-ranking { max-width: 920px; margin: 0 auto; }
.tn-rank-note {
  font-family: 'DotGothic16', monospace; font-size: 11px;
  letter-spacing: 0.06em; color: var(--muted);
  text-align: center; margin-bottom: 22px; line-height: 1.7;
}
.tn-rank-list { display: flex; flex-direction: column; gap: 10px; }

.tn-rank-row {
  display: grid; grid-template-columns: 70px 1fr auto auto; gap: 16px;
  align-items: center;
  background: var(--paper); border: 3px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow-hard);
  padding: 14px 20px;
  transition: transform 0.12s ease;
}
.tn-rank-num {
  width: 54px; height: 54px; border-radius: 14px;
  display: grid; place-items: center;
  font-family: 'Zen Antique', serif; font-size: 26px; line-height: 1;
  color: var(--ink); background: var(--bg-alt);
  border: 2.5px solid var(--line);
}
.tn-rank-num .tie {
  font-family: 'DotGothic16', monospace; font-size: 9px;
  position: absolute; transform: translateY(20px);
}
.tn-rank-team { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tn-rank-swatch {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 6px;
  border: 2px solid var(--line);
}
.tn-rank-name {
  font-family: 'Zen Kaku Gothic New', sans-serif; font-weight: 700;
  font-size: 18px; color: var(--ink); line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tn-rank-label {
  font-family: 'Zen Antique', serif; font-size: 15px; color: var(--ink-soft);
  white-space: nowrap;
}
.tn-rank-wins {
  font-family: 'DotGothic16', monospace; font-size: 12px; color: var(--muted);
  white-space: nowrap; min-width: 54px; text-align: right;
}
.tn-rank-wins b { color: var(--accent-orange); font-size: 16px; }

/* tier accents */
.tn-rank-row.is-rank1 {
  background: linear-gradient(180deg, #2A2017, var(--ink)); color: #F5EFE0;
  border-color: var(--line); box-shadow: var(--shadow-hard-lg);
  position: relative; overflow: hidden;
}
.tn-rank-row.is-rank1::before {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,194,26,0.12) 1.2px, transparent 1.8px);
  background-size: 14px 14px; pointer-events: none;
}
.tn-rank-row.is-rank1 .tn-rank-num {
  background: var(--accent-yellow); color: var(--ink); position: relative; z-index: 1;
}
.tn-rank-row.is-rank1 .tn-rank-name { color: var(--accent-yellow); font-size: 22px; position: relative; z-index: 1; }
.tn-rank-row.is-rank1 .tn-rank-label { color: #F5EFE0; position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; }
.tn-rank-row.is-rank1 .tn-rank-shield { width: 30px; vertical-align: middle; }
.tn-rank-row.is-rank1 .tn-rank-wins { color: rgba(245,239,224,0.7); position: relative; z-index: 1; }

.tn-rank-row.is-rank2 .tn-rank-num { background: #D8CCB4; }
.tn-rank-row.is-rank3 .tn-rank-num { background: #D89B5A; color: #fff; }

.tn-rank-row.is-alive { border-style: dashed; box-shadow: none; }
.tn-rank-row.is-alive .tn-rank-num {
  background: var(--accent-yellow); color: var(--ink); font-size: 20px;
}
.tn-rank-row.is-alive .tn-rank-label { color: var(--accent-orange); }
.tn-rank-row.is-alive .tn-rank-name { color: var(--ink); }

.tn-rank-stage {
  display: block; font-family: 'DotGothic16', monospace; font-size: 10px;
  color: var(--muted); letter-spacing: 0.04em; margin-top: 3px; font-weight: 400;
}

@media (max-width: 600px) {
  .tn-rank-row { grid-template-columns: 56px 1fr auto; gap: 12px; padding: 12px 14px; }
  .tn-rank-num { width: 46px; height: 46px; font-size: 22px; }
  .tn-rank-name { font-size: 16px; }
  .tn-rank-wins { display: none; }
}
