/* =================================================================
   Tournament manager — reuses tokens/buttons from style.css.
   ================================================================= */

.trn { max-width: 720px; margin: 0 auto; }

/* ---------- the virtual table ---------- */
.trn__arena {
  position: relative;
  width: 100%;
  max-width: 420px;
  margin: 8px auto 40px;
  aspect-ratio: 1 / 1;
}
.trn__table {
  position: absolute;
  left: 16%; top: 16%; width: 68%; height: 68%;
  border-radius: 34% / 42%;
  background-image: linear-gradient(180deg, rgba(12,42,110,0.9), rgba(6,20,58,0.94));
  border: 3px solid var(--ink);
  box-shadow: 0 0 0 3px var(--gold), inset 0 0 0 2px rgba(255,211,77,0.2);
  display: flex; align-items: center; justify-content: center;
}
.trn__table-label {
  font-family: "Press Start 2P", monospace;
  font-size: 0.6rem; line-height: 1.6;
  color: var(--parchment); opacity: 0.6;
  letter-spacing: 0.05em; text-align: center; padding: 12px;
}
.trn__seat {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  width: 82px;
}
.trn__seat-num {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  font-family: "Press Start 2P", monospace; font-size: 0.5rem;
  color: var(--ink);
  background-image: linear-gradient(180deg, var(--gold), var(--orange));
  border: 2px solid var(--ink);
}
.trn__seat-name {
  max-width: 82px;
  font-size: 1rem; line-height: 1.15;
  color: var(--parchment); text-align: center;
  background: rgba(6,20,58,0.88);
  border: 2px solid rgba(255,211,77,0.4);
  padding: 3px 7px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- player list ---------- */
.trn__subhead {
  font-family: "Press Start 2P", monospace;
  font-size: clamp(0.72rem, 2vw, 0.85rem);
  color: var(--gold); text-shadow: 2px 2px 0 var(--ink);
  margin: 0 0 16px;
}
.trn__players { margin-bottom: 30px; }
.trn__plist { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.trn__empty { font-size: 1.15rem; color: var(--parchment); opacity: 0.6; padding: 6px 2px; }
.trn__prow {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  background: rgba(8,26,72,0.55);
  border: 2px solid rgba(255,211,77,0.22);
}
.trn__prow.is-dragging {
  opacity: 0.95;
  box-shadow: 0 0 0 2px var(--gold);
  background: rgba(22,74,168,0.6);
}
.trn__drag {
  flex: 0 0 auto;
  cursor: grab;
  touch-action: none;          /* let the handle own touch drags (no page scroll) */
  user-select: none; -webkit-user-select: none;
  color: var(--parchment); opacity: 0.5;
  font-size: 1.2rem; line-height: 1; padding: 4px 4px;
}
.trn__drag:active { cursor: grabbing; }
.trn__pidx {
  flex: 0 0 auto; width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  font-family: "Press Start 2P", monospace; font-size: 0.58rem;
  color: var(--ink);
  background-image: linear-gradient(180deg, var(--gold), var(--orange));
  border: 2px solid var(--ink);
}
.trn__pname { flex: 1 1 auto; font-size: 1.2rem; color: var(--parchment); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trn__premove {
  flex: 0 0 auto;
  background: transparent; border: 2px solid transparent;
  color: var(--parchment); font-size: 1rem; line-height: 1;
  padding: 6px 9px; cursor: pointer;
  transition: color 90ms, border-color 90ms;
}
.trn__premove:hover, .trn__premove:focus-visible { color: var(--red); border-color: rgba(228,35,15,0.6); outline: none; }

.trn__addform { display: flex; gap: 10px; }
.trn__input {
  flex: 1 1 auto; min-width: 0;
  font-family: "VT323", monospace; font-size: 1.35rem;
  color: var(--parchment);
  background: rgba(6,20,58,0.7);
  border: 3px solid var(--ink);
  box-shadow: inset 0 0 0 2px rgba(255,211,77,0.2);
  padding: 10px 14px;
}
.trn__input::placeholder { color: rgba(251,233,200,0.45); }
.trn__input:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.trn__addbtn { flex: 0 0 auto; }
.trn__adderr {
  color: var(--gold);
  font-size: 1.1rem;
  margin: 10px 0 0;
  min-height: 1.2em;
  text-shadow: 1px 1px 0 var(--ink);
}

/* ---------- action buttons ---------- */
.trn__actions { margin-top: 10px; }
.trn__actions > .btn { width: 100%; }
.trn__actions--sub { margin-top: 14px; }
.trn__actions--sub > .btn { width: auto; display: block; margin: 0 auto; }

/* ---------- rounds & matches ---------- */
.trn__round-head { font-size: clamp(1.2rem, 3.2vw, 1.8rem); margin: 0 0 22px; }
.trn__matches { display: flex; flex-direction: column; gap: 10px; margin-bottom: 26px; }

.trn__match {
  padding: 12px 18px;
  border: 3px solid var(--ink);
  background: rgba(8,26,72,0.6);
  cursor: pointer;
  transition: background-color 90ms, box-shadow 90ms;
}
.trn__match.is-pending { border-style: dashed; border-color: rgba(255,211,77,0.55); background: rgba(8,26,72,0.32); }
.trn__match.is-recorded { box-shadow: 0 0 0 2px var(--gold); }
.trn__match:hover, .trn__match:focus-visible { background: rgba(22,74,168,0.5); outline: none; }
.trn__match--bye { cursor: default; opacity: 0.85; }
.trn__match--bye:hover { background: rgba(8,26,72,0.6); }

/* name  vs  name — one horizontal line */
.trn__mtop { display: grid; grid-template-columns: 1fr auto 1fr; align-items: baseline; gap: 12px; }
.trn__mname { min-width: 0; font-size: 1.2rem; color: var(--parchment); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trn__mname--l { text-align: right; }
.trn__mname--r { text-align: left; }
.trn__vs { font-family: "VT323", monospace; font-size: 1.05rem; color: var(--parchment); opacity: 0.5; }

/* W | L | D result columns */
.trn__wld {
  display: grid;
  grid-template-columns: repeat(3, 3em);
  justify-content: center;
  column-gap: 0; row-gap: 0;
  margin-top: 8px;
}
.trn__wld-h { font-family: "Press Start 2P", monospace; font-size: 0.5rem; color: var(--gold); opacity: 0.7; text-align: center; padding: 0 2px; }
.trn__wld-v { font-family: "Press Start 2P", monospace; font-size: 0.95rem; color: var(--parchment); text-shadow: 2px 2px 0 var(--ink); text-align: center; padding: 2px; }
.trn__wld-h + .trn__wld-h, .trn__wld-v + .trn__wld-v { border-left: 2px solid rgba(255,211,77,0.28); }

.trn__byerow { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.trn__mhint {
  text-align: center;
  font-family: "Press Start 2P", monospace; font-size: 0.52rem;
  letter-spacing: 0.06em; color: var(--gold); opacity: 0.75;
  margin-top: 8px;
}
.trn__mbye-tag {
  flex: 0 0 auto;
  font-family: "Press Start 2P", monospace; font-size: 0.6rem;
  color: var(--ink); background: var(--gold);
  border: 2px solid var(--ink); padding: 5px 8px;
}

/* ---------- final standings ---------- */
.trn__legend { font-size: 1.05rem; color: var(--parchment); opacity: 0.62; margin: 0 0 18px; }
.trn__standings { padding: 4px; }
.trn__srow {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px;
  padding: 14px 18px;
}
.trn__srow + .trn__srow { border-top: 2px dashed rgba(255,211,77,0.25); }
.trn__srow--first { background: rgba(255,211,77,0.08); }
.trn__splace { flex: 0 0 auto; font-family: "Press Start 2P", monospace; font-size: 0.8rem; color: var(--gold); text-shadow: 2px 2px 0 var(--ink); }
.trn__sname { flex: 1 1 120px; font-size: 1.25rem; color: var(--parchment); overflow: hidden; text-overflow: ellipsis; }
.trn__smeta { flex: 0 0 auto; display: flex; align-items: baseline; gap: 16px; }
.trn__spts { font-family: "Press Start 2P", monospace; font-size: 0.68rem; color: var(--parchment); text-shadow: 2px 2px 0 var(--ink); white-space: nowrap; }
.trn__srec { font-size: 1.1rem; color: var(--gold); white-space: nowrap; }
.trn__somw { font-size: 1rem; color: var(--parchment); opacity: 0.6; white-space: nowrap; }

/* ---------- modal (record / confirm) ---------- */
.trn__overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(2,7,22,0.74);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.trn__modal { width: 100%; max-width: 420px; padding: clamp(22px, 4vw, 32px); }
.trn__mbody { display: block; }
.trn__mtitle {
  font-family: "Press Start 2P", monospace; font-size: 0.85rem;
  color: var(--gold); text-shadow: 2px 2px 0 var(--ink);
  margin: 0 0 22px;
}
.trn__confirm { font-size: 1.3rem; color: var(--parchment); line-height: 1.45; margin: 0 0 24px; }

.trn__step { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.trn__steplabel { font-size: 1.15rem; color: var(--parchment); }
.trn__stepctl { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; }
.trn__stepbtn {
  width: 42px; height: 42px; line-height: 1;
  font-family: "Press Start 2P", monospace; font-size: 0.95rem;
  color: var(--ink);
  background-image: linear-gradient(180deg, var(--gold), var(--orange));
  border: 2px solid var(--ink); cursor: pointer;
  transition: filter 90ms;
}
.trn__stepbtn:hover, .trn__stepbtn:focus-visible { filter: brightness(1.1); outline: none; }
.trn__stepval { font-family: "Press Start 2P", monospace; font-size: 1rem; color: var(--gold); min-width: 2ch; text-align: center; }

.trn__mactions { display: flex; gap: 12px; margin-top: 26px; }
.trn__mactions > .btn { flex: 1 1 auto; }

@media (max-width: 460px) {
  .trn__seat { width: 66px; }
  .trn__seat-name { max-width: 66px; font-size: 0.9rem; }
}
