/* ========================================
   MATCH ARENA - COMPLETE CSS
   File: fun.css
======================================== */

:root {
  --bg: #080d19;
  --bg-soft: #0e1628;
  --panel: #121d32;
  --panel-light: #192740;
  --border: #293955;
  --text: #f4f7ff;
  --muted: #9eacc5;
  --gold: #ffc857;
  --gold-hover: #ffdb83;
  --blue: #477bff;
  --blue-hover: #3567ec;
  --green: #26c281;
  --red: #ff5d70;
  --radius: 16px;
  --shadow: 0 12px 35px rgba(0, 0, 0, 0.25);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at top left, rgba(43, 75, 135, 0.18), transparent 38%),
    radial-gradient(ellipse at bottom right, rgba(128, 76, 20, 0.12), transparent 35%),
    var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease,
    opacity 0.18s ease;
}

button:active {
  transform: scale(0.98);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1,
h2,
h3,
h4 {
  line-height: 1.25;
}

h1 {
  font-size: clamp(1.5rem, 3vw, 2rem);
}

h2 {
  font-size: clamp(1.25rem, 2.5vw, 1.65rem);
}

h3 {
  font-size: 1.08rem;
}

p {
  color: var(--muted);
}

[hidden] {
  display: none !important;
}

/* LOGIN */

.auth-panel {
  width: min(92%, 440px);
  margin: 9vh auto 40px;
  padding: 38px 30px;
  text-align: center;
  background: linear-gradient(145deg, #172641, #0f192c);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.auth-panel .logo {
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  margin: 0 auto 18px;
  border-radius: 22px;
  background: rgba(255, 200, 87, 0.12);
  border: 1px solid rgba(255, 200, 87, 0.35);
  font-size: 40px;
}

.auth-panel h1 {
  margin-bottom: 10px;
  color: var(--gold);
}

.auth-panel p {
  margin-bottom: 22px;
}

/* BUTTONS */

.primary,
.secondary,
.danger,
.type-btn,
.tab {
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 750;
}

.primary {
  color: #111827;
  background: var(--gold);
  border-color: var(--gold);
}

.primary:hover {
  background: var(--gold-hover);
  border-color: var(--gold-hover);
}

.secondary {
  color: var(--text);
  background: #202e47;
  border-color: #354764;
}

.secondary:hover {
  background: #2a3b58;
}

.danger {
  color: #fff;
  background: #a72d43;
  border-color: #d74960;
}

.danger:hover {
  background: #c33850;
}

.full {
  width: 100%;
}

/* HEADER */

.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 20px max(4%, calc((100% - 1250px) / 2));
  background: rgba(11, 19, 34, 0.92);
  border-bottom: 1px solid var(--border);
}

.topbar h1 {
  margin: 0 0 5px;
  color: var(--gold);
}

.topbar p {
  margin: 0;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.coins {
  padding: 9px 14px;
  color: var(--gold);
  background: rgba(255, 200, 87, 0.1);
  border: 1px solid rgba(255, 200, 87, 0.3);
  border-radius: 10px;
  white-space: nowrap;
}

.coins strong {
  color: #fff;
  font-size: 1.05rem;
}

/* MAIN LAYOUT */

.container {
  width: min(1250px, 92%);
  margin: 0 auto;
  padding: 28px 0 60px;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 25px;
  margin-bottom: 28px;
  padding: clamp(22px, 4vw, 40px);
  background:
    linear-gradient(110deg, rgba(34, 57, 97, 0.95), rgba(19, 30, 51, 0.95));
  border: 1px solid #304568;
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.hero > div {
  max-width: 720px;
}

.hero .eyebrow {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 2px;
}

.hero h2 {
  margin-bottom: 12px;
  font-size: clamp(1.7rem, 4vw, 2.7rem);
}

.hero p {
  margin-bottom: 0;
  max-width: 600px;
}

/* PANELS */

.panel {
  margin-bottom: 25px;
  padding: clamp(18px, 3vw, 28px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel > h2 {
  margin-bottom: 22px;
}

.panel > h3 {
  margin-bottom: 16px;
}

/* GAME MODE */

.type-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0 15px;
}

.type-btn {
  color: var(--text);
  background: #1a2942;
  border-color: #354966;
}

.type-btn:hover {
  background: #243755;
  border-color: var(--gold);
}

.type-btn.selected {
  color: #161b27;
  background: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(255, 200, 87, 0.13);
}

#adminModeArea {
  margin: 14px 0;
  padding: 14px;
  background: rgba(255, 93, 112, 0.06);
  border: 1px dashed rgba(255, 93, 112, 0.35);
  border-radius: 12px;
}

#adminModeArea .muted {
  margin-bottom: 10px;
}

#selectedTypeText {
  margin: 12px 0 20px;
  color: var(--gold);
  font-weight: 650;
}

/* FORM GRID */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}

.form-grid label,
.cancel-form,
.proof-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

label {
  color: #dce6f7;
  font-size: 0.91rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--text);
  background: #0b1425;
  border: 1px solid #344762;
  border-radius: 9px;
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: #7f8ea8;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(255, 200, 87, 0.12);
}

select {
  cursor: pointer;
}

select option {
  color: #fff;
  background: #111d31;
}

input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

textarea {
  min-height: 100px;
  resize: vertical;
}

#rounds {
  color: var(--gold);
  font-weight: 800;
}

.prize-preview {
  margin: 4px 0 18px;
  padding: 13px 15px;
  color: var(--gold);
  background: rgba(255, 200, 87, 0.08);
  border: 1px solid rgba(255, 200, 87, 0.23);
  border-radius: 10px;
  font-weight: 750;
}

#submitMatchBtn {
  width: 100%;
  min-height: 48px;
}

/* NOTICES */

.notice {
  margin-bottom: 20px;
  padding: 13px 16px;
  color: #dce8ff;
  background: #172744;
  border: 1px solid #344e79;
  border-radius: 10px;
  overflow-wrap: anywhere;
}

.notice.success {
  color: #b7ffdc;
  background: rgba(38, 194, 129, 0.1);
  border-color: rgba(38, 194, 129, 0.45);
}

.notice.error {
  color: #ffd2d8;
  background: rgba(255, 93, 112, 0.1);
  border-color: rgba(255, 93, 112, 0.5);
}

/* TABS */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 25px 0;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.tab {
  color: var(--muted);
  background: #111b2d;
  border-color: #2b3c56;
}

.tab:hover {
  color: #fff;
  background: #1d2b42;
}

.tab.active {
  color: #151a24;
  background: var(--gold);
  border-color: var(--gold);
}

/* SECTIONS AND MATCH CARDS */

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin: 25px 0 18px;
}

.section-heading h2 {
  margin: 0;
}

.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.match-card {
  min-width: 0;
  padding: 20px;
  background: linear-gradient(145deg, #142139, #101a2d);
  border: 1px solid #2c3d59;
  border-radius: 15px;
  overflow-wrap: anywhere;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.14);
}

.match-card:hover {
  border-color: #435b7e;
}

.match-card h3 {
  margin: 15px 0;
  font-size: 1.18rem;
}

.match-card h4 {
  margin: 20px 0 12px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 9px;
}

.match-type {
  color: var(--gold);
  font-size: 0.84rem;
  font-weight: 850;
}

.status {
  display: inline-block;
  padding: 5px 9px;
  border: 1px solid #42536b;
  border-radius: 7px;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.4px;
}

.status-open {
  color: #b6ffdb;
  background: rgba(38, 194, 129, 0.1);
  border-color: rgba(38, 194, 129, 0.35);
}

.status-accepted,
.status-ready {
  color: #ffe4a0;
  background: rgba(255, 200, 87, 0.1);
  border-color: rgba(255, 200, 87, 0.35);
}

.status-completed {
  color: #bcd0ff;
  background: rgba(71, 123, 255, 0.12);
  border-color: rgba(71, 123, 255, 0.4);
}

.status-cancelled {
  color: #ffc1ca;
  background: rgba(255, 93, 112, 0.1);
  border-color: rgba(255, 93, 112, 0.4);
}

.detail {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 9px 0;
  color: #b9c6dc;
  font-size: 0.9rem;
}

.detail strong {
  color: #edf3ff;
}

.match-card > button {
  width: 100%;
  margin-top: 10px;
}

.empty {
  padding: 30px 18px;
  text-align: center;
  background: rgba(18, 29, 50, 0.6);
  border: 1px dashed #34445e;
  border-radius: 12px;
}

/* ROOM DETAILS */

.room-box {
  margin: 14px 0;
  padding: 13px;
  color: #b8ffdc;
  background: rgba(38, 194, 129, 0.08);
  border: 1px solid #286b59;
  border-radius: 10px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

/* CANCEL FORM */

.cancel-form {
  margin-top: 14px;
  padding: 14px;
  background: #0e192b;
  border: 1px solid var(--border);
  border-radius: 11px;
}

.cancel-form select,
.cancel-form textarea {
  margin-bottom: 5px;
}

.cancel-form button {
  width: 100%;
}

/* PROOF FORM */

.proof-form {
  margin-top: 16px;
  padding: 15px;
  background: #0d182a;
  border: 1px solid #2d3e59;
  border-radius: 11px;
}

.proof-form h4 {
  margin: 0 0 5px;
}

.proof-form label {
  margin-top: 4px;
}

.proof-form input[type="file"] {
  padding: 9px;
  font-size: 0.82rem;
}

.proof-link {
  display: inline-block;
  margin: 5px 5px 5px 0;
  padding: 8px 10px;
  color: #cbd8ff;
  background: #17264a;
  border: 1px solid #435db2;
  border-radius: 8px;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.proof-link:hover {
  background: #1d2c55;
}

/* ADMIN PANEL */

#adminSection > .panel {
  min-width: 0;
  overflow: hidden;
}

#adminPlayers {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

#adminPlayers table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

#adminPlayers th,
#adminPlayers td {
  padding: 12px 10px;
  border-bottom: 1px solid #2b3b54;
  vertical-align: top;
}

#adminPlayers th {
  color: var(--gold);
  background: #0d1729;
  font-size: 0.84rem;
}

#adminPlayers td {
  color: #dbe5f6;
  font-size: 0.88rem;
}

#adminPlayers input {
  min-width: 110px;
  margin-bottom: 8px;
}

#adminPlayers td:last-child {
  min-width: 240px;
}

#adminPlayers td:last-child button {
  margin: 3px 4px 3px 0;
  white-space: nowrap;
}

#adminPlayers td:last-child .muted {
  overflow-wrap: anywhere;
}

.muted {
  color: var(--muted);
}

#adminMatches,
#adminCancellations {
  min-width: 0;
}

/* RESPONSIVE */

@media (min-width: 1100px) {
  .cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 18px 4%;
  }

  .top-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero > button {
    width: 100%;
  }

  .cards {
    grid-template-columns: minmax(0, 1fr);
  }

  .container {
    width: 92%;
    padding-top: 20px;
  }

  .form-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 15px;
  }

  .tabs {
    gap: 8px;
  }

  .tab {
    flex: 1 1 auto;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 14px;
  }

  .auth-panel {
    margin-top: 5vh;
    padding: 28px 20px;
  }

  .top-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .coins {
    grid-column: 1 / -1;
    text-align: center;
  }

  .top-actions button {
    width: 100%;
  }

  .hero {
    padding: 22px 18px;
  }

  .panel {
    padding: 17px;
  }

  .match-card {
    padding: 16px;
  }

  .type-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .tab {
    padding: 9px 10px;
    font-size: 0.82rem;
  }

  #adminPlayers table {
    min-width: 700px;
  }

  #adminPlayers td:last-child {
    min-width: 260px;
  }

  .match-card > button {
    max-width: 100%;
    white-space: normal;
  }

  .cancel-form,
  .proof-form {
    min-width: 0;
  }
}
/* Results section */
#resultsSection {
  margin-top: 20px;
}

#resultsSection .section-heading {
  margin-bottom: 18px;
}

#resultsGrid .match-card {
  width: 100%;
}

#resultsGrid .notice {
  margin-top: 12px;
}

#resultsGrid .detail {
  overflow-wrap: anywhere;
}

#resultsGrid .status {
  display: inline-block;
}

#resultsGrid .match-card h3 {
  margin-bottom: 14px;
}

/* WIN, LOST & CANCEL buttons - Room Details bhanda tala */
.match-actions {
  display: flex !important;
  flex-direction: row !important;
  justify-content: center;
  align-items: stretch;
  gap: 10px;
  width: 100%;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  box-sizing: border-box;
}

.match-actions button {
  flex: 1 1 0;
  min-width: 0;
  padding: 11px 5px;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}

.match-actions .win-btn {
  background: #16a34a;
  color: #fff;
}

.match-actions .lost-btn {
  background: #dc2626;
  color: #fff;
}

.match-actions .cancel-btn {
  background: #d97706;
  color: #fff;
}

@media (max-width: 380px) {
  .match-actions {
    gap: 6px;
  }

  .match-actions button {
    font-size: 11px;
    padding: 10px 3px;
  }
}

/* Match card ko content vertical order ma rakhne */
.match-card {
  display: flex;
  flex-direction: column;
}

/* Room Details section */
.room-box {
  order: 10;
  width: 100%;
}

/* WIN / LOST / CANCEL buttons */
.result-actions {
  order: 20;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

/* Proof ra cancel forms buttons pachhi */
.proof-form,
.cancel-form {
  order: 30;
  width: 100%;
}
