/* Tournament View Styles with Dark Mode Support */

/* Tournament List Page Specific Styles - Dark Mode Overrides for Inline Styles */
body.dark .tournament-item.card {
  background: #262b30 !important;
  border-color: #3a4047 !important;
  color: #e2e6eb !important;
}

body.dark .tournament-item.card h3 {
  color: #fff !important;
}

body.dark .tournament-item.card small {
  color: #adb5bd !important;
}

body.dark .tournament-item.card div[style*="color:#666"] {
  color: #adb5bd !important;
}

body.dark .tournament-item.card div[style*="background:#fff"] {
  background: #1e1f22 !important;
  color: #adb5bd !important;
}

body.dark .tournament-item.card a[style*="color:#007bff"] {
  color: #4dabf7 !important;
}

body.dark .tournament-item.card a[style*="color:#28a745"] {
  color: #51cf66 !important;
}

/* Tournament List Styles */
.tournament-list {
  margin-bottom: 2rem;
}

/* Archive Section Enhancements */
.t-archive-wrapper {
  position: relative;
  margin-top: 3rem;
  padding: 2.25rem 1.5rem 2rem;
  background: #fff;
  border: 1px solid #d9e0e6;
  border-radius: 14px;
  box-shadow: 0 8px 26px -8px rgba(0,0,0,.08);
}
body.dark .t-archive-wrapper {
  background: #15181b;
  border-color: #262c32;
  box-shadow: 0 4px 14px -2px rgba(0,0,0,0.55);
}

.t-archive-wrapper .t-filter select,
.t-archive-wrapper .t-filter input[type="search"] {
  background: #fff;
}
body.dark .t-archive-wrapper .t-filter select,
body.dark .t-archive-wrapper .t-filter input[type="search"] {
  background: #262b30;
}

.archive-separator {
  position: relative;
  margin: 3rem 0 1.5rem;
  text-align: center;
}
.archive-separator::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 2px;
  background: linear-gradient(90deg,rgba(0,0,0,0) 0%, #cfd6dc 40%, #cfd6dc 60%, rgba(0,0,0,0) 100%);
}
body.dark .archive-separator::before {
  background: linear-gradient(90deg,rgba(0,0,0,0) 0%, #424c55 40%, #424c55 60%, rgba(0,0,0,0) 100%);
}
.archive-separator span {
  position: relative;
  display: inline-block;
  padding: .4rem 1rem;
  background: #fff;
  font-weight: 600;
  font-size: 1.05rem;
  color: #374047;
  letter-spacing:.5px;
  border:1px solid #d0d7dc;
  border-radius: 2rem;
  box-shadow: 0 2px 4px rgba(0,0,0,.05);
}
body.dark .archive-separator span {
  background: #1e1f22;
  color: #d5dae0;
  border-color:#2f353a;
  box-shadow: 0 2px 6px rgba(0,0,0,.65);
}

.t-filter { display:flex; gap:1rem; flex-wrap:wrap; align-items:flex-end; margin:0 0 1rem; }
/* Remove inherited form label margins so bottom edges align in filter row */
.t-filter label { display:flex; flex-direction:column; font-size:.85rem; font-weight:600; color:#444; margin:0; }
.t-filter label > * { /* small spacing between caption and control */
  margin-top:.35rem;
}
.t-filter select,
.t-filter input[type="search"]{
  height:40px; /* unify control height */
}
.t-filter .btn,
.t-filter a.btn{
  align-self:flex-end; /* align to bottom of row */
  height:40px; /* match selects */
  display:inline-flex;
  align-items:center;
  padding:0 .9rem; /* vertical padding handled by height */
}
body.dark .t-filter label { color:#cfd4dc; }
.t-filter select,.t-filter input[type="search"] { padding:.45rem .6rem; border:1px solid #b8c2c9; border-radius:6px; font-size:.95rem; min-width:120px; color:#222; }
body.dark .t-filter select,body.dark .t-filter input[type="search"] { border-color:#404c55; color:#e2e6eb; }
/* Placeholder Farbe */
.t-filter input[type="search"]::placeholder { color:#66727a; }
body.dark .t-filter input[type="search"]::placeholder { color:#7f8a93; }
.t-archive .t-list { display:grid; gap:1rem; margin:1rem 0 1.25rem; }
.t-archive .t-list .t-card { background:#fff; border:1px solid #d3dbe0; padding:1rem .9rem; border-radius:10px; position:relative; }
body.dark .t-archive .t-list .t-card { background:#262b30; border-color:#3a4047; }
.t-archive-actions { display:flex; gap:1rem; align-items:center; }
.t-status { font-size:.85rem; color:#555; }
body.dark .t-status { color:#b5bcc2; }
.t-status.error { color:#b02a37; }

@media (max-width:680px){
  .t-filter label { width:48%; }
  .t-filter select,.t-filter input[type="search"] { width:100%; }
}

.tournament-item {
  margin-bottom: 1.5rem;
  padding: 1rem;
  border: 1px solid #d3dbe0;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

body.dark .tournament-item {
  background: #262b30;
  border-color: #3a4047;
  color: #e2e6eb;
  box-shadow: 0 4px 14px -2px rgba(0,0,0,0.55);
}
.match-item { margin: 1.75rem 0; padding: 1rem; }

.tournament-card {
.match-item .match-edit-form { margin-top: 1.1rem !important; row-gap: .6rem; }
  margin-bottom: 1.5rem;
  padding: 1rem;
.match-item .match-admin-controls { 
  display:flex; 
  flex-wrap:wrap; 
  gap:1.1rem; 
  margin-top:1.25rem; 
  margin-bottom:1.25rem;
}
.match-item .match-admin-controls form { 
  display:flex; 
  align-items:center; 
  gap:.75rem; 
  flex-wrap:wrap;
  padding:.55rem 0; /* more air inside each row */
}
.match-item .match-admin-controls select { 
  min-width: 220px; 
  height: 40px; 
  padding:.45rem .6rem; 
  border:1px solid #b8c2c9; 
  border-radius:6px; 
  font-size:.95rem; 
}
body.dark .match-item .match-admin-controls select { border-color:#404c55; background:#262b30; color:#e2e6eb; }
.match-item .match-admin-controls input[type="search"],
.match-item .match-admin-controls input[type="number"]{
  height: 40px;
  padding:.45rem .6rem;
  border:1px solid #b8c2c9;
  border-radius:6px;
  font-size:.95rem;
}
body.dark .match-item .match-admin-controls input[type="search"],
body.dark .match-item .match-admin-controls input[type="number"]{ border-color:#404c55; background:#262b30; color:#e2e6eb; }
.match-item .match-admin-controls input.user-lookup{ min-width:200px; }
.match-item .match-admin-controls .pa-subtle{ margin: .2rem .15rem; }
.match-item .match-admin-controls .mini-btn { 
  height: 40px; 
  display:inline-flex; 
  align-items:center; 
  padding:0 .9rem; 
}

/* High-contrast Autocomplete popup (user-lookup) */
.ac-list { color:#1f2428; background:#fff; border:1px solid rgba(0,0,0,.18); border-radius:8px; box-shadow:0 10px 28px rgba(0,0,0,.14); }
.ac-item { color:#1f2428; padding:.4rem .55rem; cursor:pointer; }
.ac-item.is-hover, .ac-item:hover { background:#f2f4f7; }
.ac-empty { padding:.4rem .55rem; color:#6b737b; }
body.dark .ac-list { color:#e2e6eb; background:#1e1f22; border-color:#3a4047; box-shadow:0 10px 28px rgba(0,0,0,.55); }
body.dark .ac-item { color:#e2e6eb; }
body.dark .ac-item.is-hover, body.dark .ac-item:hover { background:#2a2f34; }
body.dark .ac-empty { color:#9aa3ab; }

/* Admin explain line gets extra breathing room */
.match-item > .pa-subtle { margin:.65rem 0; }
  border: 1px solid #d3dbe0;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
  /* clip inner accent band to outer radius so corners look continuous */
  overflow: hidden;
}

body.dark .tournament-card {
  background: #262b30;
  border-color: #3a4047;
  color: #e2e6eb;
  box-shadow: 0 4px 14px -2px rgba(0,0,0,0.55);
}

.tournament-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

@media (max-width: 600px) {
  .tournament-card-header {
    flex-direction: column;
    align-items: stretch;
  }
}

.tournament-card-header h3 {
  margin: 0;
  color: #333;
}

body.dark .tournament-card-header h3 {
  color: #fff;
}

/* Tournament icon image before titles */
.t-icon.t-laurel { display:inline-flex; vertical-align:middle; margin-right:.6rem; align-items:center; justify-content:center; }
.t-icon.t-laurel img { height:30px; width:auto; display:block; border-radius:0; box-shadow:none; }
.t-icon.t-laurel .icon-dark { display:none; }
body.dark .t-icon.t-laurel .icon-light { display:none; }
body.dark .t-icon.t-laurel .icon-dark { display:block; }

.tournament-card-header small {
  color: #666;
}

body.dark .tournament-card-header small {
  color: #adb5bd;
}

/* Mode pill (Einzel/Doppel) */
.mode-pill { display:inline-block; margin-left:.5rem; padding:.1rem .5rem; font-size:.8rem; border:1px solid #cfe0ff; color:#0d6efd; background:#eaf2ff; border-radius: 999px; font-weight:600; }
body.dark .mode-pill { border-color:#363c43; color:#4dabf7; background:#1e1f22; }

.tournament-card-date {
  text-align: right;
  font-size: 0.9em;
  color: #666;
}

body.dark .tournament-card-date {
  color: #adb5bd;
}

.t-deadline-date { color: #d63384; }
body.dark .t-deadline-date { color: #e16aa7; }
/* Small clock before deadline */
.t-deadline-date::before { content:"⏰"; margin-right:.35rem; }

@media (max-width: 600px) {
  .tournament-card-date {
    text-align: left;
    margin-top: 0.5rem;
  }
}

.tournament-card-info {
  margin: 0 0 0.75rem 0;
}

.tournament-card-description {
  margin: 0.5rem 0;
  padding: 0.5rem;
  background: #fff;
  border-left: 3px solid var(--primary);
  border-radius: 0 6px 6px 0;
  color: #495057;
  font-size: 0.9em;
  line-height: 1.4;
  border: 1px solid #d3dbe0;
}

body.dark .tournament-card-description {
  background: #1e1f22;
  color: #adb5bd;
  border-left-color: var(--primary);
  border-color: #3a4047;
}

/* Subtle criteria hint above actions */
.t-criteria-hint{ margin:.85rem 0 .8rem; padding:.45rem .6rem; background:#fffdf3; border:1px solid #ffeaa7; border-radius:8px; color:#856404; font-size:.9rem; }
/* If it follows the criteria chips row, add a touch more space above */
.tournament-card-criteria + .t-criteria-hint{ margin-top:1rem; }
body.dark .t-criteria-hint{ background:#2d271a; border-color:#5c4920; color:#ffcf70; }

.tournament-card-actions {
  margin: 0;
}

/* More vertical space between description and actions (2–3 lines) */
.tournament-card-description + .tournament-card-actions { margin-top: 2rem; }

/* Accent band for actions at the bottom of each tournament card */
.tournament-card-actions.t-actions {
  margin-left:-1rem; margin-right:-1rem; margin-bottom:-1rem; /* stretch to card edges */
  padding:.75rem 1rem; 
  background:linear-gradient(180deg,#fafbfc 0%, #f4f6f8 100%);
  border-top:1px solid #e4e8ec;
  /* remove inner rounding to avoid double-radius artifact at bottom */
  border-bottom-left-radius:10px; border-bottom-right-radius:10px;
  margin-top: 25px;
}
body.dark .tournament-card-actions.t-actions{
  background:linear-gradient(180deg,#202428 0%, #1a1f24 100%);
  border-top-color:#343a40;
}

/* If a join/leave form follows, continue the accent and move the rounded corners to the last row */
/* Join/Leave forms inherit the accent band to look continuous */
.t-join-form, .t-leave-form{
  margin-left:-1rem; margin-right:-1rem; margin-bottom:-1rem;
  padding:.75rem 1rem;
  background:linear-gradient(180deg,#fafbfc 0%, #f4f6f8 100%);
  border-top:1px solid #e4e8ec;
  border-bottom-left-radius:10px; border-bottom-right-radius:10px;
}
body.dark .t-join-form, body.dark .t-leave-form{
  background:linear-gradient(180deg,#202428 0%, #1a1f24 100%);
  border-top-color:#343a40;
}

/* Join/Leave forms spacing */
.t-join-form, .t-leave-form{ margin-top:1rem; }

/* Join/Leave button variants */
.t-btn-join{ background:#2e7d32; border:1px solid #2b6d2f; color:#fff; }
.t-btn-join:hover{ filter:brightness(1.08); }
body.dark .t-btn-join{ background:#2a6f2f; border-color:#255c29; color:#eaffea; }

.t-btn-leave{ background:#b23b3b; border:1px solid #9a3232; color:#fff; }
.t-btn-leave:hover{ filter:brightness(1.08); }
body.dark .t-btn-leave{ background:#8f2f2f; border-color:#7b2828; color:#ffecec; }

/* Inline form inside actions row */
.t-actions .t-action-form{ display:flex; align-items:center; gap:.5rem; margin-left:auto; }
.t-actions .t-action-form .t-inline-field{ font-size:.85rem; font-weight:600; color:#444; }
body.dark .t-actions .t-action-form .t-inline-field{ color:#cfd4dc; }
.t-actions .t-action-form select{ height:40px; padding:.45rem .6rem; border:1px solid #b8c2c9; border-radius:6px; font-size:.95rem; min-width:140px; color:#222; }
body.dark .t-actions .t-action-form select{ border-color:#404c55; color:#e2e6eb; background:#262b30; }

/* Make join/leave buttons look like actions but keep their colors */
.t-actions .qm-action.t-btn-join{ background:#2e7d32; border-color:#2b6d2f; color:#fff; }
.t-actions .qm-action.t-btn-leave{ background:#b23b3b; border-color:#9a3232; color:#fff; }
/* Ensure the inline-form button keeps its color against generic .qm-action styles */
.t-actions .t-action-form .qm-action.t-btn-join{ background:#2e7d32 !important; border-color:#2b6d2f !important; color:#fff !important; }
.t-actions .t-action-form .qm-action.t-btn-leave{ background:#b23b3b !important; border-color:#9a3232 !important; color:#fff !important; }
/* Override generic hover to keep green/red */
.t-actions .qm-action.t-btn-join:hover{ background:#296f2d !important; border-color:#265e29 !important; color:#fff !important; }
.t-actions .qm-action.t-btn-leave:hover{ background:#9d3333 !important; border-color:#882c2c !important; color:#fff !important; }
body.dark .t-actions .qm-action.t-btn-join{ background:#2a6f2f; border-color:#255c29; color:#eaffea; }
body.dark .t-actions .t-action-form .qm-action.t-btn-join{ background:#2a6f2f !important; border-color:#255c29 !important; color:#eaffea !important; }
body.dark .t-actions .qm-action.t-btn-join:hover{ background:#235f27 !important; border-color:#1f5222 !important; }
body.dark .t-actions .qm-action.t-btn-leave{ background:#8f2f2f; border-color:#7b2828; color:#ffecec; }
body.dark .t-actions .t-action-form .qm-action.t-btn-leave{ background:#8f2f2f !important; border-color:#7b2828 !important; color:#ffecec !important; }
body.dark .t-actions .qm-action.t-btn-leave:hover{ background:#7c2929 !important; border-color:#6a2323 !important; }

.tournament-card-actions a {
  color: var(--link-color, var(--primary));
  font-weight: 700;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: .35rem .6rem;
}

body.dark .tournament-card-actions a {
  color: var(--link-color);
}

/* Create form footer band under final submit button (visual separation like on list cards) */
.tm-create .tm-create-footer{
  margin-left:-1.1rem; margin-right:-1.1rem; margin-bottom:-1.1rem; /* stretch to section edges (match .pa-section padding) */
  margin-top: 50px;
  padding:.9rem 1rem;
  background:linear-gradient(180deg,#fafbfc 0%, #f4f6f8 100%);
  border-top:1px solid #e4e8ec;
  border-bottom-left-radius:16px; border-bottom-right-radius:16px; /* match .pa-section radius */
}
body.dark .tm-create .tm-create-footer{
  background:linear-gradient(180deg,#202428 0%, #1a1f24 100%);
  border-top-color:#343a40;
}

.tournament-card-actions a:hover {
  background: var(--primary-safe, var(--primary));
  color: var(--on-primary-safe, #fff);
  border-color: var(--primary-safe, var(--primary));
  text-decoration: none;
}

/* Align tournament actions with Quick Match topbar style */
.t-actions { display:flex; gap:.6rem; flex-wrap:wrap; align-items:center; margin-top:.35rem; }
.t-actions .qm-action { background:#fff; border:1px solid #d3dbe0; padding:.55rem .9rem; border-radius:10px; font-size:.75rem; font-weight:600; text-transform:uppercase; letter-spacing:.6px; color:#333; box-shadow:0 2px 4px rgba(0,0,0,.05); text-decoration:none; }
.t-actions .qm-action:hover { background:var(--primary-safe, var(--primary)); color:var(--on-primary-safe, #fff); border-color:var(--primary-safe, var(--primary)); text-decoration:none; }
body.dark .t-actions .qm-action { background:#1e1f22; border-color:#2c2f33; color:#d5dae0; }
body.dark .t-actions .qm-action:hover { background:var(--primary-safe, var(--primary)); border-color:var(--primary-safe, var(--primary)); color:var(--on-primary-safe, #fff); }

.t-actions .badge { margin-left:.25rem; }

/* Tournament Header Card */
.tournament-header {
  background: #fff;
  border: 1px solid #d3dbe0;
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

body.dark .tournament-header {
  background: #1e1f22;
  border-color: #3a4047;
  color: #d5dae0;
  box-shadow: 0 4px 14px -2px rgba(0,0,0,0.55);
}

.tournament-header-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.tournament-header h1 {
  margin: 0;
  color: #333;
}

body.dark .tournament-header h1 {
  color: #fff;
}

.tournament-date {
  text-align: right;
  font-size: 0.9em;
  color: #666;
}

/* Small spacer for joined badge placed under the date on the right */
.tournament-date .date-joined { margin-top: .35rem; }

body.dark .tournament-date {
  color: #aaa;
}

/* Small line under date for joined state */
.tournament-date-sub { margin: -.5rem 0 1rem 0; }
.joined-chip { display:inline-block; font-size:.9rem; font-weight:700; color:#155724; background:#d4edda; border:1px solid #c3e6cb; padding:.2rem .5rem; border-radius:999px; }
body.dark .joined-chip { color:#7ee7ba; background:#1d3a2b; border-color:#2d5a3d; }

.tournament-info {
  margin-bottom: 1rem;
}

.tournament-info p {
  margin: 0 0 0.75rem 0;
}

/* Status Badges */
.status-badge {
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-size: 0.9em;
  font-weight: 600;
  border: 1px solid transparent;
}

.status-badge.open {
  background: #eaf2ff;
  border-color: #cfe0ff;
  color: var(--link-color, #0d6efd);
}

.status-badge.running {
  background: #eaf7ef;
  border-color: #cfead7;
  color: #155724;
}

.status-badge.completed {
  background: #eaf7ef;
  border-color: #cfead7;
  color: #155724;
}

body.dark .status-badge.open {
  background: #1e1f22;
  border-color: #363c43;
  color: var(--link-color);
}

body.dark .status-badge.running {
  background: #1d3a2b;
  border-color: #2d5a3d;
  color: #7ee7ba;
}

body.dark .status-badge.completed {
  background: #1d3a2b;
  border-color: #2d5a3d;
  color: #7ee7ba;
}

/* Status badges for joined/pending on overview */
.badge { display:inline-block; padding:.2rem .5rem; border-radius:999px; font-weight:600; font-size:.85rem; border:1px solid transparent; }
.badge-joined { background:#eaf7ef; border-color:#cfead7; color:#155724; }
.badge-pending { background:#fff3cd; border-color:#ffe69c; color:#6f4f00; }
body.dark .badge-joined { background:#1d3a2b; border-color:#2d5a3d; color:#7ee7ba; }
body.dark .badge-pending { background:#3a3321; border-color:#5c4920; color:#ffcf70; }

/* Registration Deadline Notice */
.deadline-notice {
  margin: 0 0 0.75rem 0;
  color: #856404;
  background: #fffdf3;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid #ffeaa7;
}

body.dark .deadline-notice {
  background: #2d271a;
  color: #ffcf70;
  border-color: #5c4920;
}

/* Winner Notice */
.winner-notice {
  margin: 0 0 0.75rem 0;
  color: #155724;
  background: #eaf7ef;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  border: 1px solid #cfead7;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

body.dark .winner-notice {
  background: #1d3a2b;
  color: #7ee7ba;
  border-color: #2d5a3d;
  box-shadow: 0 4px 14px -2px rgba(0,0,0,0.55);
}

/* --- Tournament Manage (admin-like) helpers moved from sorted_style.css --- */
.tm-toolbar{display:flex;flex-wrap:wrap;gap:.5rem}
.tm-toolbar .btn, .tm-toolbar a.btn{display:inline-block;background:var(--secondary);color:#fff;text-decoration:none;border:1px solid rgba(0,0,0,.1);padding:.5rem .9rem;border-radius:6px;font-weight:600;letter-spacing:.3px}
.tm-toolbar .btn:hover, .tm-toolbar a.btn:hover{opacity:.9}
.tm-header{padding:1.1rem 1.2rem}
.tm-header .tm-chiprow{gap:.6rem; margin-bottom:.9rem}
.tm-header .pa-chip{font-size:.85rem; padding:.45rem .7rem; border-radius:16px}
.tm-header .tm-toolbar{margin-top:.2rem}
.tm-list{list-style:none;margin:0;padding:0}
.tm-list>li{display:flex;justify-content:space-between;align-items:center;padding:.45rem .6rem;border-bottom:1px solid #eef1f4}
body.dark .tm-list>li{border-color:#2a2f34}

/* Create tournament layout – simpler look */
.tm-create{padding:1rem 1.1rem}
.tm-create .pa-form-row{display:block}
.tm-create label{display:block}
.tm-create input[type="text"], .tm-create textarea, .tm-create select{width:100%;max-width:860px}
.tm-create textarea{min-height:140px}
.tm-create .pa-form-row + .pa-form-row{margin-top:.8rem}
.tm-actions{display:flex;gap:.4rem;margin-left:auto}
.tm-scroll{max-height:280px;overflow:auto}
.inline-form{display:inline}

/* Stronger breathing space on Manage page */
.tm-admin .pa-card{padding:1rem 1.1rem; margin-bottom:1rem}
.tm-admin .pa-section{padding:1.1rem 1.2rem; margin:1.2rem 0 1.4rem}
.tm-admin .tm-toolbar{gap:.8rem; margin-bottom:.6rem}
.tm-admin .pa-chiprow{gap:.65rem .8rem; margin-top:.6rem}
.tm-admin .pa-form-row{gap:.8rem}
.tm-admin h2{margin:1.2rem 0 .8rem}
.tm-admin h3{margin:4rem 0 .6rem}
.tm-admin .match-item{margin-bottom:1rem}
.tm-admin .match-edit-form select, 
.tm-admin .match-edit-form input[type="text"]{min-width:180px}

/* Improve spacing inside details/seed forms and below action buttons */
.tm-admin details.pa-details { margin: .6rem 0; }
.tm-admin details.pa-details[open] { padding-bottom: .2rem; }
.tm-admin details.pa-details .pa-form .pa-form-row + .pa-form-row { margin-top: .6rem; }
.tm-admin details.pa-details .pa-form .btn { margin-top: .6rem; }
.tm-admin .table + .pa-form-row { margin-top: .6rem; }

.winner-display {
  display: flex;
  align-items: center;
}

/* Tournament Description */
.tournament-description {
  margin: 0 0 1rem 0;
  background: #fff;
  border-left: 4px solid var(--primary);
  padding: 1rem;
  border-radius: 0 6px 6px 0;
  border: 1px solid #d3dbe0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

body.dark .tournament-description {
  background: #262b30;
  border-left-color: var(--primary);
  border-color: #3a4047;
  box-shadow: 0 4px 14px -2px rgba(0,0,0,0.55);
}

.tournament-description h4 {
  margin: 0 0 0.5rem 0;
  color: #495057;
  font-size: 1rem;
}

body.dark .tournament-description h4 {
  color: #e2e6eb;
}

.tournament-description-content {
  color: #6c757d;
  line-height: 1.5;
}

body.dark .tournament-description-content {
  color: #adb5bd;
}

/* Registration Section */
.registration-section {
  background: #fff;
  border: 1px solid #d3dbe0;
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

/* Kontaktbereich in Match-Karten */
.contact-block { margin-top: .6rem; }
.contact-details { margin: .25rem 0 0; }
.contact-summary { cursor: pointer; padding: .3rem 0; display:list-item; color: var(--link-color, #007bff); }
body.dark .contact-summary { color: var(--link-color); }
.contact-summary:hover { text-decoration: underline; }

/* Kontaktbereich: Marker vor dem Summary entfernen (nur Icon + Text) */
.contact-summary { display:block; list-style: none !important; }
.contact-summary::-webkit-details-marker { display: none; }
.contact-summary::marker { content: ""; }
.contact-block .contact-title { margin: .2rem 0 .2rem 0; font-size: .98rem; color: #333; }
.contact-block .contact-tip { margin: 0 0 .3rem; font-size: .85rem; color: #666; }
body.dark .contact-block .contact-title { color: #e6e9ee; }
body.dark .contact-block .contact-tip { color: #a9b2ba; }

/* Quickmatch Ergebnis-Form: Button Höhe an Select anpassen */
.qm-result-form{ align-items:flex-end !important; }
.qm-result-form select{ height:40px; margin:0; box-sizing:border-box; padding-top:0; padding-bottom:0; line-height:1.2; }
.qm-result-form .btn{ height:40px; box-sizing:border-box; display:inline-flex; align-items:center; padding:0 1.2rem; border-radius:10px; }
.qm-result-form label{ display:flex; flex-direction:column; gap:.35rem; margin:0 !important; }
/* Hinweis-Badge soll unterhalb erscheinen, nicht in der Button-Reihe */
.qm-result-form .mini-badge{ flex-basis:100%; order:9; margin-top:.45rem; }

.t-contact-grid { display: grid; grid-template-columns: 1fr; gap: .5rem; width: 100%; }

.t-contact-item { display: flex; flex-direction: column; align-items: flex-start; gap: .4rem; padding: .55rem .6rem; background: #fff; border: 1px solid #e1e6ea; border-radius: 8px; width: 100%; box-sizing: border-box; }
body.dark .t-contact-item { background: #262b30; border-color: #3a4047; }

.t-contact-name { font-weight: 600; color: #2c353c; overflow: visible; white-space: normal; word-break: break-word; }
body.dark .t-contact-name { color: #e6e9ee; }

.t-contact-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: .1rem; }
.t-btn-icon { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 8px; color: var(--link-color, var(--primary)); background: #f2f6ff; border: 1px solid #cfe0ff; transition: transform .08s ease, filter .12s ease; -webkit-tap-highlight-color: transparent; }
.t-btn-icon:hover { filter: brightness(1.05); transform: translateY(-1px); }
.t-btn-icon:active { transform: translateY(0); }
.t-btn-icon svg { display: block; width: 18px; height: 18px; }

/* Icon-Varianten */
.t-btn-icon.t-email { background: #f2f6ff; border-color:#cfe0ff; }
.t-btn-icon.t-tel { background: #eef9f1; border-color:#cfead7; color: #198754; }
.t-btn-icon.t-wa { background: #eefdf4; border-color:#cfead7; color:#198754; }

body.dark .t-btn-icon { background: #1e1f22; border-color: #363c43; color: var(--link-color); }
body.dark .t-btn-icon.t-tel, body.dark .t-btn-icon.t-wa { color: #7ee7ba; }

/* Mobile: größere Touch-Ziele */
@media (max-width: 520px){
  .t-contact-actions { gap: .65rem; }
  .t-btn-icon { width: 40px; height: 40px; border-radius: 10px; }
  .t-btn-icon svg { width: 20px; height: 20px; }
}

body.dark .registration-section {
  background: #1e1f22;
  border-color: #3a4047;
  color: #d5dae0;
  box-shadow: 0 4px 14px -2px rgba(0,0,0,0.55);
}

.registration-section h2 {
  margin: 0 0 1rem 0;
  color: #333;
}

body.dark .registration-section h2 {
  color: #fff;
}

.registration-form label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: bold;
}

body.dark .registration-form label {
  color: #cfd4dc;
}

.registration-form select,
.registration-form input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}

body.dark .registration-form select,
body.dark .registration-form input {
  background: #262b30;
  border-color: #3a4047;
  color: #e2e6eb;
}

.registration-btn {
  background: var(--secondary);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
}

.registration-btn:hover {
  filter: brightness(0.95);
}

/* Already Registered Notice */
.registered-notice {
  background: #d4edda;
  border: 1px solid #c3e6cb;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 2rem;
  color: #155724;
}

body.dark .registered-notice {
  background: #1d3a2b;
  border-color: #2d5a3d;
  color: #7ee7ba;
}

/* Participants Section */
.participants-section {
  background: #fff;
  border: 1px solid #d3dbe0;
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

body.dark .participants-section {
  background: #1e1f22;
  border-color: #3a4047;
  color: #d5dae0;
  box-shadow: 0 4px 14px -2px rgba(0,0,0,0.55);
}

.participants-section h2 {
  margin: 0 0 1rem 0;
  color: #333;
}

body.dark .participants-section h2 {
  color: #fff;
}

.participants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.participant-card {
  background: #fff;
  border: 1px solid #d3dbe0;
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  align-items: center;
}

body.dark .participant-card {
  background: #262b30;
  border-color: #3a4047;
}

.participant-info {
  flex: 1;
}

.participant-name {
  display: block;
  font-weight: bold;
  color: #333;
}

body.dark .participant-name {
  color: #fff;
}

/* Improve readability: slightly larger names in participants list */
.participant-name { font-size: 1.02rem; }

.participant-partner {
  color: #6c757d;
  display: block;
  font-size: 0.9em;
}

body.dark .participant-partner {
  color: #adb5bd;
}

.participant-seed {
  color: var(--link-color, #007bff);
  display: block;
  font-size: 0.9em;
}

body.dark .participant-seed {
  color: var(--link-color);
}

.empty-participants {
  color: #6c757d;
  font-style: italic;
}

body.dark .empty-participants {
  color: #adb5bd;
}

/* Tournament Bracket Section */
.bracket-section {
  background: #fff;
  border: 1px solid #d3dbe0;
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

body.dark .bracket-section {
  background: #1e1f22;
  border-color: #3a4047;
  color: #d5dae0;
  box-shadow: 0 4px 14px -2px rgba(0,0,0,0.55);
}

.bracket-section h2 {
  margin: 0 0 1rem 0;
  color: #333;
}

body.dark .bracket-section h2 {
  color: #fff;
}

.round-section { margin-bottom: 2rem; }

.round-header { color: #374047; margin: 0 0 1rem 0; padding: 0.25rem 0; border-bottom: 1px solid #d3dbe0; font-weight: 700; }
body.dark .round-header { color: #e2e6eb; border-bottom-color: #3a4047; }

.matches-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }

@media (max-width: 768px) {
  .matches-grid {
    grid-template-columns: 1fr;
  }
}


.match-card { background:#f7f9fb; border:0px solid #cfd6dc; border-radius:10px; padding:25px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }

.match-card.completed { border-top: none; }
.match-card.pending { border-top: none; }
body.dark .match-card { background:#262b30; border-color:#3a4047; box-shadow: 0 4px 14px -2px rgba(0,0,0,0.55); }
body.dark .match-card.completed { border-top: none; }
body.dark .match-card.pending { border-top: none; }

.match-players { margin-bottom: .75rem; }

.player-row { display:flex; align-items:center; justify-content:center; gap:.5rem; margin-bottom:.5rem; padding:.65rem .75rem; border-radius:8px; transition: background .2s ease, border-color .2s ease; }

.player-row:not(.winner) { background:#fff; border:1px solid #e6edf4; box-shadow: 0 1px 0 rgba(0,0,0,0.02); }
body.dark .player-row:not(.winner) { background:#1e1f22; border-color:#3a4047; }

.player-row.winner { background:#eaf7ef; border:1px solid #cfead7; box-shadow: none; font-weight:600; color:#155724; }
body.dark .player-row.winner { background:#1d3a2b; border-color:#2d5a3d; box-shadow: none; color:#7ee7ba; }

.player-display {
  display: flex;
  align-items: center;
}

/* Slightly larger avatars and names in match player rows */
.match-players .player-row img { width: 28px; height: 28px; border-radius: 50%; }
.player-row > span { font-size: 1.02rem; line-height: 1.25; text-align:center; }

.vs-divider { text-align:center; color:#6c757d; font-weight:600; margin:.25rem 0; font-size:1.1em; }
body.dark .vs-divider { color:#adb5bd; }

.match-score { text-align:center; margin-top:.5rem; padding:.45rem .6rem; background:#eaf2ff; border:1px solid #cfe0ff; border-radius:8px; color:#0d6efd; font-weight:600; }
body.dark .match-score { background:#1e1f22; border-color:#363c43; color:#4dabf7; }

.avatar-placeholder {
  width: 28px;
  height: 28px;
  margin-right: 0.5rem;
}

.match-schedule { color:#495057; margin-bottom:.5rem; display:flex; align-items:center; gap:.35rem; }
body.dark .match-schedule { color:#adb5bd; }

.match-result { color:#155724; font-weight:600; display:flex; align-items:center; margin-bottom:.5rem; }
body.dark .match-result { color:#7ee7ba; }

.match-pending { color:#856404; font-style:italic; margin-bottom:.5rem; }
body.dark .match-pending { color:#ffcf70; }

.match-actions { margin-top:1rem; background:#f9f9f9; border:1px solid #e6edf4; padding:.75rem .9rem; border-radius:8px; }
body.dark .match-actions { background:transparent; border:none; border-top:1px solid #3a4047; padding-top:1rem; padding-right:.75rem; }

.match-actions details {
  margin-bottom: 0.5rem;
}

.match-actions summary {
  cursor: pointer;
  padding: 0.3rem .9rem 0.3rem 0;
}

/* Stelle sicher, dass der native Marker für Summary sichtbar bleibt */
summary { list-style: disclosure-closed; }
details[open] > summary { list-style: disclosure-open; }

.match-actions summary:hover {
  text-decoration: underline;
}

/* In Match-Actions: Marker komplett entfernen (nur Icon + Text zeigen) */
.match-actions summary { list-style: none !important; }
.match-actions summary::-webkit-details-marker { display: none; }
.match-actions summary::marker { content: ""; }

.schedule-summary { color: var(--link-color, #007bff); }
body.dark .schedule-summary { color: var(--link-color); }
.result-summary { color: #28a745; }
body.dark .result-summary { color: #51cf66; }

.action-form {
  margin-top: 0.5rem;
}

.action-form-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.action-form input,
.action-form select {
  padding: 0.3rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}

body.dark .action-form input,
body.dark .action-form select {
  background: #262b30;
  border-color: #3a4047;
  color: #e2e6eb;
}

.action-btn { padding:.35rem .8rem; border:none; border-radius:6px; cursor:pointer; font-size:.92em; color:#fff; transition: filter .12s ease, transform .06s ease; }
.action-btn:active { transform: translateY(0); }
.result-btn { background: var(--secondary); }
.action-btn:hover { filter: brightness(0.95); }

.tournament-completed {
  background: #eaf7ef;
  border: 1px solid #cfead7;
  border-radius: 10px;
  padding: 1rem;
  margin-top: 1rem;
  text-align: center;
  color: #155724;
}

body.dark .tournament-completed {
  background: #1d3a2b;
  border-color: #2d5a3d;
  color: #7ee7ba;
}

/* Navigation Footer */
.tournament-navigation {
  background: #fff;
  border: 1px solid #d3dbe0;
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

body.dark .tournament-navigation {
  background: #262b30;
  border-color: #3a4047;
  box-shadow: 0 4px 14px -2px rgba(0,0,0,0.55);
}

.tournament-navigation a {
  color: var(--link-color, #007bff);
  text-decoration: none;
  margin-right: 1rem;
}

body.dark .tournament-navigation a {
  color: var(--link-color);
}

.tournament-navigation a:hover {
  text-decoration: underline;
}

.manage-link {
  color: var(--secondary) !important;
}

body.dark .manage-link {
 color: var(--link-color) !important;
}

/* Empty bracket state */
.empty-bracket {
  color: #6c757d;
  font-style: italic;
}

body.dark .empty-bracket {
  color: #adb5bd;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .tournament-header-content {
    flex-direction: column;
    align-items: stretch;
  }
  
  .tournament-date {
    text-align: left;
    margin-top: 0.5rem;
  }
  
  .participants-grid {
    grid-template-columns: 1fr;
  }
  
  .matches-grid {
    grid-template-columns: 1fr;
  }
  
  .winner-display {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .action-form-row {
    flex-direction: column;
  }
}
