/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Variables ── */
:root {
  --green:      #c1272d;
  --green-lt:   #d93025;
  --green-bg:   #fdecea;
  --navy:       #0d2137;
  --navy-lt:    #1a3a5c;
  --gray-100:   #f5f5f5;
  --gray-200:   #e0e0e0;
  --gray-500:   #9e9e9e;
  --gray-800:   #424242;
  --white:      #ffffff;
  --red:        #c62828;
  --red-bg:     #ffebee;
  --orange:     #e65100;
  --orange-bg:  #fff3e0;
  --zelena:     #2e7d32;
  --zelena-bg:  #e8f5e9;
  --blue:       #0d2137;
  --blue-bg:    #e8eef5;
  --radius:     12px;
  --shadow:     0 2px 10px rgba(0,0,0,.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray-100);
  color: var(--gray-800);
  min-height: 100vh;
}

/* ── Header ── */
header {
  background: var(--navy);
  color: var(--white);
  padding: .75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 3px solid var(--green);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.header-logo {
  height: 34px;
  width: auto;
  filter: brightness(0) invert(1);
  flex-shrink: 0;
}
.header-titles {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.header-sup {
  font-size: .6rem;
  letter-spacing: .07em;
  opacity: .65;
  text-transform: uppercase;
}
.header-name {
  font-size: 1.05rem;
  font-weight: 800;
}

header h1 { font-size: 1.2rem; font-weight: 700; }

/* ── Mode toggle button ── */
.btn-mode {
  background: rgba(255,255,255,.18);
  color: var(--white);
  border: 1.5px solid rgba(255,255,255,.4);
  border-radius: 999px;
  padding: .35rem .85rem;
  font-size: .8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
}
.btn-mode:hover   { background: rgba(255,255,255,.28); }
.btn-mode.is-admin { background: var(--white); color: var(--navy); border-color: var(--white); }

/* ── Header right side ── */
.header-right {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.header-user {
  font-size: .75rem;
  opacity: .8;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-logout, .btn-naslovna {
  background: transparent;
  color: rgba(255,255,255,.7);
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 999px;
  padding: .3rem .7rem;
  font-size: .75rem;
  cursor: pointer;
  transition: background .15s;
}
.btn-logout:hover, .btn-naslovna:hover { background: rgba(255,255,255,.12); color: var(--white); }

/* ── Auth screen ── */
#auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  background: var(--gray-100);
}
.auth-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem 1.5rem;
  width: 100%;
  max-width: 380px;
  text-align: center;
}
.auth-logo  { font-size: 2.5rem; margin-bottom: .25rem; }
.auth-title { font-size: 1.4rem; font-weight: 800; color: var(--navy); margin-bottom: .1rem; }
.auth-sub   { font-size: .78rem; color: var(--gray-500); margin-bottom: 1.5rem; }

.auth-tabs {
  display: flex;
  border-radius: 8px;
  overflow: hidden;
  border: 1.5px solid var(--gray-200);
  margin-bottom: 1.25rem;
}
.auth-tab {
  flex: 1;
  padding: .55rem;
  border: none;
  background: transparent;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--gray-500);
  transition: background .15s, color .15s;
}
.auth-tab.active {
  background: var(--navy);
  color: var(--white);
}

/* ── Main ── */
main {
  max-width: 540px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ── Card ── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}
.card h2 { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; }

/* ── Section title ── */
.section-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: .75rem;
}
.section-title small {
  font-size: .72rem;
  font-weight: 400;
  color: var(--gray-500);
  margin-left: .4rem;
}

/* ── Form ── */
.field {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  margin-bottom: .85rem;
}
.field label { font-size: .8rem; font-weight: 600; color: var(--gray-500); }
.field input,
.field select {
  padding: .65rem .85rem;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: .95rem;
  font-family: inherit;
  color: var(--gray-800);
  background: var(--white);
  transition: border-color .15s;
  width: 100%;
}
.field input:focus,
.field select:focus { outline: none; border-color: var(--green); }

/* ── Buttons ── */
.btn-primary {
  width: 100%;
  padding: .75rem;
  background: var(--green);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: .25rem;
  transition: background .15s;
}
.btn-primary:hover:not(:disabled) { background: var(--green-lt); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

/* ── Error ── */
.error {
  font-size: .82rem;
  color: var(--red);
  background: var(--red-bg);
  padding: .45rem .7rem;
  border-radius: 6px;
  margin-bottom: .5rem;
}
.hidden { display: none !important; }

/* ── Dashboard header ── */
#dashboard { display: flex; flex-direction: column; gap: .85rem; }
.dashboard-header h2 { font-size: 1rem; font-weight: 700; }

.count {
  display: inline-block;
  background: var(--green);
  color: var(--white);
  font-size: .7rem;
  font-weight: 700;
  padding: .1rem .45rem;
  border-radius: 999px;
  margin-left: .35rem;
  vertical-align: middle;
}

/* ── Filters ── */
.filters { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.filter {
  padding: .35rem .75rem;
  border: 1.5px solid var(--gray-200);
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 600;
  background: var(--white);
  cursor: pointer;
  transition: all .15s;
}
.filter:hover  { border-color: var(--green); color: var(--green); }
.filter.active { background: var(--green); color: var(--white); border-color: var(--green); }

/* ── Empty ── */
.empty {
  text-align: center;
  color: var(--gray-500);
  font-size: .9rem;
  padding: 1.5rem 0;
}

/* ── Children list ── */
#children-list { list-style: none; display: flex; flex-direction: column; gap: .65rem; }

.child-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: fadeIn .2s ease;
}
.child-card-main {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .9rem 1rem;
}
/* ── Tournament picker (inline, no modal) ── */
.btn-prijavi-t {
  width: 100%;
  padding: .45rem 1rem;
  background: none;
  border: none;
  border-top: 1px solid var(--gray-200);
  font-size: .8rem;
  font-weight: 700;
  color: var(--green);
  cursor: pointer;
  text-align: left;
  transition: background .15s;
}
.btn-prijavi-t:hover { background: var(--green-bg); }

.tournament-picker {
  border-top: 1px solid var(--gray-200);
  background: var(--gray-100);
  padding: .5rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.picker-t-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .6rem .75rem;
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: .85rem;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color .15s, background .15s;
  width: 100%;
}
.picker-t-btn:hover:not(.is-registered) { border-color: var(--green); background: var(--green-bg); }
.picker-t-btn.is-registered { opacity: .6; cursor: default; }
.picker-t-name { font-weight: 700; flex: 1; }
.picker-t-date { font-size: .75rem; color: var(--gray-500); flex-shrink: 0; }
.picker-t-check { font-size: .8rem; color: var(--green); font-weight: 700; flex-shrink: 0; }
/* ── Admin: spisak igrača ── */
.ai-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .6rem; }
.ai-count { display: inline-block; background: var(--gray-200, #e5e7eb); color: var(--gray-700, #374151);
  font-size: .72rem; font-weight: 800; border-radius: 999px; padding: .1rem .5rem; vertical-align: middle; }
.ai-csv { background: var(--crvena, #c1272d); color: #fff; border: none; border-radius: 8px;
  padding: .45rem .7rem; font-size: .76rem; font-weight: 700; cursor: pointer; white-space: nowrap; }
.ai-csv:hover { filter: brightness(.92); }
.ai-search { width: 100%; padding: .6rem .75rem; border: 1px solid var(--gray-300, #d1d5db);
  border-radius: 10px; font-size: .88rem; margin-bottom: .6rem; }
.ai-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .6rem; }
.ai-card { background: #fff; border-radius: 12px; padding: .8rem .9rem;
  box-shadow: 0 1px 4px rgba(0,0,0,.07); border-left: 6px solid var(--gray-200, #e5e7eb); }
.ai-card.tcat-CRVENI { border-left-color: #c62828; }
.ai-card.tcat-NARANDZASTI { border-left-color: #e65100; }
.ai-card.tcat-ZELENI { border-left-color: #2e7d32; }
.ai-top { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
.ai-emoji { font-size: 1.15rem; }
.ai-main { flex: 1 1 auto; min-width: 0; }
.ai-name { font-weight: 800; font-size: .95rem; color: var(--tamna, #0d2137); }
.ai-meta { font-size: .76rem; color: var(--gray-500, #6b7280); margin-top: .1rem; }
.ai-cats { display: flex; gap: .3rem; flex-wrap: wrap; }
.ai-del { background: none; border: none; cursor: pointer; font-size: .95rem; line-height: 1;
  padding: .3rem .35rem; border-radius: 8px; opacity: .55; transition: opacity .15s, background .15s; }
.ai-del:hover { opacity: 1; background: #fdecec; }
.ai-del:disabled { cursor: default; opacity: .4; }
.ai-parent { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  margin-top: .6rem; padding-top: .55rem; border-top: 1px dashed var(--gray-200, #e5e7eb); font-size: .8rem; }
.ai-plabel { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--gray-500, #6b7280); }
.ai-pval { font-weight: 700; color: var(--tamna, #0d2137); }
.ai-link { color: var(--crvena, #c1272d); text-decoration: none; font-weight: 600; }
.ai-link:hover { text-decoration: underline; }
.ai-turniri { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .5rem; }
.ai-turnir { font-size: .72rem; font-weight: 700; background: var(--gray-100, #f3f4f6);
  color: var(--gray-700, #374151); border-radius: 999px; padding: .15rem .5rem; }
.ai-noturnir { font-size: .72rem; color: var(--gray-500, #6b7280); font-style: italic; }
@media (max-width: 480px) {
  .ai-head { flex-direction: column; align-items: stretch; }
  .ai-csv { width: 100%; }
}

.picker-empty { font-size: .82rem; color: var(--gray-500); padding: .4rem .25rem; }
.picker-note {
  font-size: .78rem;
  line-height: 1.45;
  color: var(--gray-600, #4b5563);
  background: var(--gray-100, #f3f4f6);
  border-radius: 8px;
  padding: .5rem .6rem;
  margin: 0 0 .5rem;
}
.picker-note em { color: var(--gray-500); font-style: normal; }
.form-note {
  font-size: .78rem;
  line-height: 1.45;
  color: var(--gray-600, #4b5563);
  background: var(--gray-100, #f3f4f6);
  border-left: 3px solid var(--crvena, #c1272d);
  border-radius: 8px;
  padding: .5rem .6rem;
  margin: 0 0 .6rem;
}

.registration-confirm {
  padding: .5rem 1rem;
  font-size: .82rem;
  font-weight: 700;
  color: var(--green);
  background: var(--green-bg);
  border-top: 1px solid var(--gray-200);
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.child-emoji  { font-size: 1.6rem; flex-shrink: 0; }
.child-info   { flex: 1; min-width: 0; }
.child-name   { font-weight: 700; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.child-meta   { font-size: .78rem; color: var(--gray-500); margin-top: .15rem; }

/* ── Category badge ── */
.cat-badge {
  font-size: .7rem;
  font-weight: 700;
  padding: .2rem .55rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .4px;
  flex-shrink: 0;
}
.cat-CRVENI      { background: var(--red-bg);    color: var(--red); }
.cat-NARANDZASTI { background: var(--orange-bg);  color: var(--orange); }
.cat-ZELENI      { background: var(--zelena-bg);  color: var(--zelena); }

.btn-delete {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: .3rem;
  border-radius: 6px;
  transition: background .15s;
  flex-shrink: 0;
  line-height: 1;
}
.btn-delete:hover { background: var(--red-bg); }

/* ══════════════════════════════════════════════
   PHASE 2 STYLES
══════════════════════════════════════════════ */

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: .5rem;
  background: var(--white);
  border-radius: var(--radius);
  padding: .4rem;
  box-shadow: var(--shadow);
}
.tab {
  flex: 1;
  padding: .55rem;
  border: none;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
  background: none;
  color: var(--gray-500);
  transition: all .15s;
}
.tab.active { background: var(--green); color: var(--white); }

/* ── Tournament card ── */
.t-list { list-style: none; display: flex; flex-direction: column; gap: .75rem; }

.t-card {
  background: var(--white);
  border-left: 6px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: fadeIn .2s ease;
}
.tc-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  padding: 1rem;
}
.tc-name { font-weight: 700; font-size: .95rem; }
.tc-meta {
  font-size: .78rem;
  color: var(--gray-500);
  margin-top: .3rem;
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
}
.tc-reg-count {
  font-size: .75rem;
  color: var(--gray-500);
  padding: 0 1rem .7rem;
}

/* ── Prijavi button (parent) ── */
.btn-register {
  background: var(--green);
  color: var(--white);
  border: none;
  border-radius: 8px;
  padding: .45rem .9rem;
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s;
}
.btn-register:hover { background: var(--green-lt); }

/* ── Admin tournament card ── */
.t-card-admin .tc-actions {
  display: flex;
  gap: .5rem;
  align-items: center;
}
.btn-del-t {
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  padding: .3rem;
  border-radius: 6px;
  transition: background .15s;
  line-height: 1;
}
.btn-del-t:hover { background: var(--red-bg); }

.tc-stats {
  display: flex;
  gap: .75rem;
  padding: 0 1rem .75rem;
}
.tc-stat { font-size: .78rem; color: var(--gray-500); }

/* ── Expand section ── */
.tc-expand {
  border-top: 1px solid var(--gray-200);
  padding: .85rem 1rem;
  background: var(--gray-100);
}
.tc-expand-title {
  font-size: .75rem;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: .6rem;
}
.tc-players { list-style: none; display: flex; flex-direction: column; gap: .4rem; }
.tc-players li {
  font-size: .85rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.tc-player-age { color: var(--gray-500); font-size: .75rem; }
.tc-no-players { font-size: .85rem; color: var(--gray-500); }
.tc-player-row { cursor: pointer; transition: background .15s; border-radius: 6px; padding: .3rem .25rem; }
.tc-player-row:hover { background: var(--gray-100); }
.tc-player-expand { font-size: .65rem; color: var(--gray-500); margin-left: auto; flex-shrink: 0; }
.tc-player-detail { list-style: none; }
.player-detail-card {
  background: var(--gray-100);
  border-radius: 8px;
  padding: .6rem .75rem;
  margin: .15rem 0 .5rem 1.5rem;
  border-left: 3px solid var(--green);
}
.pd-row { display: flex; justify-content: space-between; padding: .25rem 0; font-size: .82rem; border-bottom: 1px solid var(--gray-200); }
.pd-row:last-child { border-bottom: none; }
.pd-label { color: var(--gray-500); font-weight: 600; }
.pd-val { font-weight: 600; color: var(--gray-800); text-align: right; }
.pd-val a { color: var(--navy); text-decoration: underline; }

.btn-result {
  margin-top: .85rem;
  width: 100%;
  padding: .6rem;
  background: var(--blue);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s;
}
.btn-result:hover:not(:disabled) { opacity: .85; }
.btn-result:disabled { opacity: .45; cursor: not-allowed; }

.tc-toggle {
  width: 100%;
  background: none;
  border: none;
  border-top: 1px solid var(--gray-200);
  padding: .6rem;
  font-size: .8rem;
  color: var(--gray-500);
  cursor: pointer;
  transition: background .15s;
}
.tc-toggle:hover { background: var(--gray-100); }

/* ── Ranking list ── */
.ranking-list { list-style: none; display: flex; flex-direction: column; gap: .6rem; }

.rank-item {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: .85rem 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  animation: fadeIn .2s ease;
}
.rank-pos  { font-size: 1.1rem; min-width: 2rem; text-align: center; flex-shrink: 0; }
.rank-emoji { font-size: 1.2rem; flex-shrink: 0; }
.rank-name { flex: 1; font-weight: 700; font-size: .95rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-pts  { font-weight: 700; font-size: .9rem; color: var(--green); flex-shrink: 0; }

/* ── Modal ── */
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 90;
}
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  pointer-events: none;
}
.modal:not(.hidden) { pointer-events: all; }

.modal-box {
  background: var(--white);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.25rem;
  animation: slideUp .22s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .75rem;
}
.modal-header h3 { font-size: 1rem; font-weight: 700; }
.modal-close {
  background: var(--gray-200);
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: .85rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s;
}
.modal-close:hover { background: var(--gray-500); color: var(--white); }

.modal-sub {
  font-size: .82rem;
  color: var(--gray-500);
  margin-bottom: 1rem;
}

/* ── Register modal list ── */
.modal-child-list { list-style: none; display: flex; flex-direction: column; gap: .5rem; }

.modal-child-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .75rem;
  border: 1.5px solid var(--gray-200);
  border-radius: 10px;
  transition: border-color .15s;
}
.modal-child-item.is-registered { background: var(--green-bg); border-color: var(--green); }

.mci-info { display: flex; align-items: center; gap: .5rem; flex: 1; min-width: 0; flex-wrap: wrap; }
.mci-emoji { font-size: 1.2rem; flex-shrink: 0; }
.mci-name  { font-weight: 700; font-size: .9rem; }
.mci-age   { font-size: .75rem; color: var(--gray-500); }

.btn-prijavi {
  background: var(--green);
  color: var(--white);
  border: none;
  border-radius: 8px;
  padding: .4rem .75rem;
  font-size: .8rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s;
}
.btn-prijavi:hover { background: var(--green-lt); }

.reg-badge {
  font-size: .78rem;
  font-weight: 700;
  color: var(--green);
  flex-shrink: 0;
}

/* ── Result modal ── */
.winner-btns {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.winner-btn {
  flex: 1;
  padding: .65rem .5rem;
  border: 2px solid var(--gray-200);
  border-radius: 8px;
  background: var(--white);
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.winner-btn:hover:not(:disabled) { border-color: var(--green); color: var(--green); }
.winner-btn.selected { background: var(--green); color: var(--white); border-color: var(--green); }
.winner-btn:disabled { opacity: .4; cursor: not-allowed; }
.vs-sep { font-size: .75rem; font-weight: 700; color: var(--gray-500); flex-shrink: 0; }

/* ── Existing results ── */
#existing-results { margin-top: 1rem; }
.existing-results-title {
  font-size: .78rem;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: .5rem;
}
.results-list { list-style: none; display: flex; flex-direction: column; gap: .4rem; }
.result-item {
  font-size: .85rem;
  background: var(--gray-100);
  border-radius: 8px;
  padding: .5rem .75rem;
}

/* ══════════════════════════════════════════════
   PHASE 3 – ROUND ROBIN
══════════════════════════════════════════════ */

/* Scrollable wrapper for wide tables on mobile */
.rr-wrap { overflow-x: auto; margin-bottom: 1rem; }

.rr-table {
  border-collapse: collapse;
  width: 100%;
  font-size: .82rem;
}
.rr-table th,
.rr-table td {
  border: 1px solid var(--gray-200);
  padding: .4rem .5rem;
  text-align: center;
  white-space: nowrap;
}
.rr-table thead th {
  background: var(--gray-100);
  font-weight: 700;
  font-size: .75rem;
}
.rr-row-hdr {
  background: var(--gray-100);
  font-weight: 700;
  text-align: left !important;
  font-size: .75rem;
}
.rr-diag {
  background: var(--gray-200);
  color: var(--gray-500);
}
/* Result cells */
.rr-win  { background: #e8f5e9; color: var(--green); font-weight: 700; }
.rr-loss { background: #fff3e0; color: var(--orange); }
.rr-empty { color: var(--gray-400); }
.rr-empty-admin {
  color: var(--gray-400);
  cursor: pointer;
  transition: background .12s;
}
.rr-empty-admin:hover { background: var(--green-bg); color: var(--green); }
.rr-cell { transition: background .12s; }
.rr-win.rr-cell:hover,
.rr-loss.rr-cell:hover { opacity: .8; cursor: pointer; }

/* Standings */
.rr-standings { margin-top: .5rem; }
.rr-stand-title {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--gray-500);
  margin-bottom: .5rem;
}
.rr-stand-list { list-style: none; display: flex; flex-direction: column; gap: .35rem; }
.rr-stand-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: .45rem .75rem;
  font-size: .85rem;
}
.rr-stand-pos  { min-width: 1.5rem; text-align: center; font-size: 1rem; }
.rr-stand-name { flex: 1; font-weight: 700; }
.rr-stand-stats { font-size: .75rem; color: var(--gray-500); }
.rr-stand-pts  { font-weight: 700; color: var(--green); }

/* Inline cell editor */
.rr-editor {
  background: var(--white);
  border: 1.5px solid var(--green);
  border-radius: var(--radius);
  padding: .9rem 1rem;
  margin-top: .75rem;
}
.rr-editor-title {
  font-size: .85rem;
  font-weight: 700;
  margin-bottom: .75rem;
}
.rr-editor-body { display: flex; flex-direction: column; gap: .6rem; }
.rr-score-inp {
  padding: .55rem .8rem;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: .95rem;
  font-family: inherit;
  width: 100%;
}
.rr-score-inp:focus { outline: none; border-color: var(--green); }
.rr-winner-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.rr-winner-label { font-size: .78rem; font-weight: 600; color: var(--gray-500); flex-shrink: 0; }
.rr-w-btn {
  padding: .4rem .85rem;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  background: var(--white);
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .12s;
}
.rr-w-btn:hover    { border-color: var(--green); color: var(--green); }
.rr-w-btn.selected { background: var(--green); color: var(--white); border-color: var(--green); }
.rr-editor-err  { margin-top: .4rem; }
.rr-editor-actions {
  display: flex;
  gap: .6rem;
  margin-top: .75rem;
  align-items: center;
}
.rr-editor-actions .btn-primary { margin: 0; }
.rr-cancel {
  background: none;
  border: none;
  font-size: .85rem;
  color: var(--gray-500);
  cursor: pointer;
  text-decoration: underline;
}

/* ── Propozicije ── */
.propozicije h2 { margin-bottom: .75rem; }
.prop-table { width: 100%; border-collapse: collapse; font-size: .85rem; margin-bottom: 1rem; }
.prop-table td { padding: .4rem .5rem; vertical-align: top; }
.prop-table td:first-child { color: var(--gray-500); white-space: nowrap; width: 90px; }
.prop-table tr:not(:last-child) td { border-bottom: 1px solid var(--gray-200); }
.prop-kategorije { display: flex; flex-direction: column; gap: .5rem; margin-bottom: .75rem; }
.prop-kat { padding: .5rem .75rem; border-radius: 8px; font-size: .82rem; }
.prop-kat strong { display: block; margin-bottom: .15rem; }
.prop-kat span { color: var(--gray-800); }
.prop-kat.crveni     { background: var(--red-bg); }
.prop-kat.narandzasti { background: var(--orange-bg); }
.prop-kat.zeleni     { background: #e8f5e9; }
.prop-napomena { font-size: .8rem; color: var(--gray-800); background: #fff8e1; padding: .5rem .75rem; border-radius: 8px; border-left: 3px solid #f9a825; }

/* ── Landing page ── */
#landing-page { background: var(--gray-100); min-height: 100vh; }

.landing-hero {
  background: var(--navy);
  color: var(--white);
  text-align: center;
  padding: 2.5rem 1rem 2rem;
  border-bottom: 4px solid var(--green);
}
.landing-logo   { height: 64px; filter: brightness(0) invert(1); margin-bottom: .75rem; }
.landing-title  { font-size: 1.8rem; font-weight: 900; letter-spacing: -.5px; margin-bottom: .25rem; }
.landing-subtitle { font-size: .85rem; opacity: .7; margin-bottom: 1.5rem; }
.hero-cta { display: flex; flex-direction: column; gap: .75rem; width: 100%; max-width: 320px; margin: 0 auto; }

.landing-content { max-width: 540px; margin: 0 auto; padding: 1.25rem 1rem 3rem; display: flex; flex-direction: column; gap: 1rem; }

.landing-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; }
.landing-section-title { font-size: 1rem; font-weight: 800; color: var(--navy); margin-bottom: .85rem; }

/* Statistika */
.stats-row { display: flex; gap: .5rem; margin-bottom: 1rem; }
.stat-box { flex: 1; background: var(--gray-100); border-radius: 10px; padding: .65rem .5rem; text-align: center; }
.stat-box span { display: block; font-size: 1.5rem; font-weight: 900; color: var(--navy); }
.stat-box small { font-size: .72rem; color: var(--gray-800); }
.stats-rank-title { font-size: .88rem; font-weight: 800; color: var(--navy); margin-bottom: .6rem; }

/* Datumi */
.landing-dates { display: flex; flex-direction: column; gap: .4rem; }
.date-item { display: flex; align-items: center; gap: .75rem; padding: .45rem .5rem; border-radius: 8px; background: var(--gray-100); font-size: .88rem; }
.date-item.final { background: #fff8e1; }
.date-num { width: 28px; height: 28px; border-radius: 50%; background: var(--navy); color: #fff; font-size: .72rem; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.date-item.final .date-num { background: #f9a825; font-size: .85rem; }

/* Kategorije */
.landing-cats { display: flex; flex-direction: column; gap: .5rem; margin-bottom: .75rem; }
.lcat { padding: .6rem .75rem; border-radius: 8px; font-size: .84rem; }
.lcat strong { display: block; margin-bottom: .1rem; }
.lcat span { color: var(--gray-800); font-size: .8rem; }
.lcat.crveni      { background: var(--red-bg); }
.lcat.narandzasti { background: var(--orange-bg); }
.lcat.zeleni      { background: #e8f5e9; }
.landing-napomena { font-size: .78rem; color: var(--gray-800); background: #fff8e1; padding: .45rem .65rem; border-radius: 8px; border-left: 3px solid #f9a825; }

/* Kontakt */
.landing-contacts { display: flex; flex-direction: column; gap: .6rem; }
.contact-item { display: flex; justify-content: space-between; align-items: center; font-size: .88rem; gap: .5rem; }
.contact-actions { display: flex; gap: .4rem; }
.contact-btn { padding: .35rem .7rem; border-radius: 999px; font-size: .78rem; font-weight: 700; text-decoration: none; white-space: nowrap; }
.contact-btn.call  { background: #e8f5e9; color: #2e7d32; }
.contact-btn.viber { background: #ede7f6; color: #5e35b1; }

/* CTA dugmad */
.landing-cta { display: none; }
.cta-btn { width: 100%; padding: 1rem; font-size: 1.05rem; font-weight: 800; border: none; border-radius: var(--radius); cursor: pointer; transition: opacity .15s; }
.cta-btn:hover { opacity: .9; }
.cta-igrac     { background: var(--green); color: #fff; }
.cta-igrac-sec { background: transparent; color: var(--white); border: 2px solid rgba(255,255,255,.5); }
.cta-admin     { background: var(--navy); color: #fff; border: 2px solid rgba(255,255,255,.2); }
.cta-install   { background: transparent; color: rgba(255,255,255,.6); border: 1px dashed rgba(255,255,255,.3); font-size: .88rem; }
.auth-switch { text-align: center; font-size: .82rem; color: var(--gray-500); margin-top: .75rem; }
.auth-switch-btn { background: none; border: none; color: var(--navy); font-weight: 700; cursor: pointer; font-size: .82rem; text-decoration: underline; }
.rank-link { background: none; border: none; color: var(--navy); font-weight: 700; cursor: pointer; font-size: .85rem; text-decoration: underline; padding: 0; }
.rank-link:hover { color: var(--green); }
.masters-tabs { display: flex; gap: .5rem; margin-bottom: 1rem; }
.masters-tab { flex: 1; padding: .5rem; border: 2px solid var(--navy); border-radius: var(--radius); background: transparent; color: var(--navy); font-weight: 700; font-size: .82rem; cursor: pointer; }
.masters-tab.active { background: var(--navy); color: #fff; }

/* ── Footer nav ── */
#footer-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 80;
  display: flex;
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -2px 8px rgba(0,0,0,.08);
}
.fnav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: .55rem .25rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray-500);
  transition: color .15s;
}
.fnav-btn.active { color: var(--green); }
.fnav-icon { font-size: 1.3rem; line-height: 1; }
.fnav-label { font-size: .68rem; font-weight: 700; letter-spacing: .02em; }

/* Padding da footer ne pokrije sadržaj */
body { padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px)); }

/* ── Knock-out bracket ── */
.ko-round { margin-bottom: .75rem; }
.ko-match {
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  margin-bottom: .4rem;
  overflow: hidden;
  transition: border-color .15s;
}
.ko-match.ko-played { border-color: var(--green); }
.ko-match.ko-bye { opacity: .6; padding: .5rem .75rem; display: flex; align-items: center; gap: .5rem; font-size: .85rem; }
.ko-bye-label { font-size: .78rem; color: var(--gray-500); }
.ko-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .45rem .75rem;
  font-size: .85rem;
  font-weight: 600;
}
.ko-row:first-child { border-bottom: 1px solid var(--gray-200); }
.ko-row.ko-winner { background: #e8f5e9; color: var(--green); font-weight: 800; }
.ko-row.ko-loser { color: var(--gray-500); font-weight: 400; }
.ko-score { font-size: .78rem; font-weight: 700; }
.ko-player-name { font-weight: 700; font-size: .85rem; }


/* ── Boja turnira po kategoriji ── */
.t-card.tcat-CRVENI      { border-left-color: #c62828; }
.t-card.tcat-NARANDZASTI { border-left-color: #e65100; }
.t-card.tcat-ZELENI      { border-left-color: #2e7d32; }


/* ── Maskota Pločko ── */
.landing-mascot {
  height: 86px; width: auto; display: block; margin: 0 auto .5rem;
  filter: drop-shadow(0 8px 18px rgba(0,0,0,.45));
}
@media (min-width: 560px) { .landing-mascot { height: 104px; } }


/* ── Uputstvo (kako se prijaviti) ── */
.howto { margin-bottom: 1.1rem; }
.howto:last-child { margin-bottom: 0; }
.howto-title {
  font-size: .82rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
  color: var(--red); margin-bottom: .5rem;
}
.howto-list { margin: 0 0 0 1.15rem; padding: 0; }
.howto-list li { font-size: .88rem; line-height: 1.55; color: var(--gray-800); margin-bottom: .4rem; }
.howto-note {
  margin-top: .6rem; font-size: .8rem; line-height: 1.5; color: var(--gray-500);
  background: var(--gray-100); border-radius: 8px; padding: .55rem .7rem;
}
