﻿:root {
  color-scheme: light;
  --bg-1: #f5fbff;
  --bg-2: #deebf3;
  --ink: #122231;
  --ink-soft: #556a79;
  --line: #cfdae3;
  --surface: rgba(255, 255, 255, 0.84);
  --surface-strong: #ffffff;
  --shadow: 0 20px 45px -28px rgba(6, 33, 53, 0.5);
  --accent: #0f9e8c;
  --accent-strong: #0a7668;
  --accent-soft: #d7f4ef;
  --danger: #d64f4f;
  --warning: #f3ab47;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  padding: 18px;
  font-family: "Noto Sans KR", "Space Grotesk", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 14% 10%, var(--bg-1) 0%, #edf4f9 38%, var(--bg-2) 100%);
}

h1,
h2,
h3,
p,
th,
td,
li,
span,
strong,
div,
article,
section {
  color: inherit;
}

h1,
h2,
h3 {
  margin: 0 0 12px;
  font-family: "Space Grotesk", "Noto Sans KR", sans-serif;
  letter-spacing: -0.02em;
}

.app-shell {
  max-width: 1280px;
  margin: 0 auto;
}

.bg-orb {
  position: fixed;
  z-index: -1;
  filter: blur(24px);
  opacity: 0.5;
  pointer-events: none;
}

.orb-a {
  width: 300px;
  height: 300px;
  border-radius: 999px;
  background: #81efc2;
  top: -90px;
  right: -90px;
}

.orb-b {
  width: 360px;
  height: 360px;
  border-radius: 999px;
  background: #96bfff;
  bottom: -130px;
  left: -90px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 20px 22px;
  border-radius: 24px;
  border: 1px solid rgba(18, 34, 49, 0.14);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(240, 253, 249, 0.88));
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.topbar h1 {
  font-size: clamp(26px, 3.1vw, 38px);
  margin-bottom: 4px;
}

.subtitle {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.status-box {
  min-width: 108px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: #3c4f5d;
  border-radius: 999px;
  padding: 9px 14px;
}

.tabs {
  position: sticky;
  top: 12px;
  z-index: 20;
  margin: 14px 0 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid rgba(18, 34, 49, 0.1);
  background: rgba(244, 251, 255, 0.78);
  backdrop-filter: blur(8px);
}

.tab {
  border: 1px solid var(--line);
  background: var(--surface-strong);
  border-radius: 999px;
  padding: 9px 16px;
  color: #243443;
  font-weight: 700;
  cursor: pointer;
  transition: transform 140ms ease, background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.tab:hover {
  transform: translateY(-1px);
}

.tab.active {
  background: linear-gradient(135deg, var(--accent), #10b7a0);
  color: #ffffff;
  border-color: transparent;
}

.panel {
  display: none;
  animation: panel-in 220ms ease-out;
}

.panel.active {
  display: block;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(9px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.grid {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card {
  border: 1px solid rgba(18, 34, 49, 0.12);
  border-radius: 22px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(251, 254, 255, 0.78));
  box-shadow: var(--shadow);
}

.muted {
  color: var(--ink-soft);
  font-size: 14px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-soft);
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  background: var(--surface-strong);
  color: var(--ink);
}

input::placeholder {
  color: #768896;
}

option {
  color: var(--ink);
}

select:focus,
input:focus,
button:focus {
  outline: 2px solid rgba(15, 158, 140, 0.32);
  outline-offset: 1px;
}

button {
  border: 0;
  border-radius: 12px;
  padding: 11px 14px;
  background: linear-gradient(135deg, var(--accent), #0cb29e);
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(0.98);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

button.danger {
  background: linear-gradient(135deg, var(--danger), #bc3f3f);
}

button.primary {
  background: linear-gradient(135deg, var(--warning), #f5bd58);
  color: #31230f;
}

.inline-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inline-form input,
.inline-form select {
  flex: 1;
}

.stack-form {
  display: grid;
  gap: 10px;
}

.sim-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sim-grid button {
  grid-column: span 2;
}

.match-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.match-grid button {
  grid-column: span 3;
}

.participant-picker {
  display: grid;
  gap: 10px;
  border: 1px dashed rgba(18, 34, 49, 0.2);
  border-radius: 14px;
  padding: 12px;
  background: rgba(244, 250, 254, 0.86);
}

.participant-picker-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: #274052;
}

.selected-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 34px;
}

.selected-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(15, 158, 140, 0.35);
  background: var(--accent-soft);
  color: #0a6355;
  font-size: 12px;
  font-weight: 700;
}

.selected-chip small {
  color: #3f6d65;
  font-size: 11px;
}

.pick-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  max-height: 230px;
  overflow: auto;
  padding-right: 2px;
}

.pick-item {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 10px;
  background: #ffffff;
  color: #223646;
  text-align: left;
}

.pick-item.active {
  border-color: #5ec8bb;
  background: var(--accent-soft);
}

.pick-name {
  font-size: 13px;
  font-weight: 700;
}

.pick-elo {
  font-size: 12px;
  color: var(--ink-soft);
}

.match-card-list {
  display: grid;
  gap: 10px;
}

.match-result-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(18, 34, 49, 0.13);
  border-radius: 16px;
  padding: 12px;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.94), rgba(235, 247, 255, 0.74));
  box-shadow: 0 16px 26px -22px rgba(13, 41, 63, 0.7);
}

.match-result-card::after {
  content: "";
  position: absolute;
  top: -26px;
  right: -18px;
  width: 90px;
  height: 90px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, rgba(16, 182, 160, 0.35), rgba(16, 182, 160, 0));
  pointer-events: none;
}

.match-result-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.match-head-main {
  display: flex;
  align-items: center;
  gap: 7px;
}

.match-order {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(13, 157, 140, 0.15);
  color: #12675b;
}

.match-format {
  font-size: 12px;
  color: #466174;
  font-weight: 700;
}

.match-delete-btn {
  padding: 6px 10px;
  font-size: 12px;
}

.match-meta {
  margin-top: 5px;
  color: var(--ink-soft);
  font-size: 12px;
}

.match-score-body {
  margin-top: 9px;
  display: grid;
  gap: 8px;
}

.match-team-line {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(18, 34, 49, 0.08);
  background: rgba(255, 255, 255, 0.8);
}

.match-team-name {
  font-size: 14px;
  font-weight: 700;
  color: #20384a;
}

.match-team-score {
  min-width: 34px;
  text-align: center;
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #0f4f70;
}

.match-vs {
  justify-self: center;
  color: #618095;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.match-delta-row {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.delta-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
}

.delta-pill.up {
  background: rgba(22, 166, 119, 0.16);
  color: #0f7252;
}

.delta-pill.down {
  background: rgba(214, 87, 87, 0.16);
  color: #8f3131;
}

.rule-editor {
  display: grid;
  gap: 8px;
}

.rule-row {
  display: grid;
  grid-template-columns: 1fr 110px 110px auto;
  gap: 8px;
  align-items: center;
  border: 1px solid rgba(18, 34, 49, 0.12);
  border-radius: 12px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.rule-row .rule-name {
  font-weight: 700;
  color: #2a3f4f;
}

.admin-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.admin-meta.active {
  background: #d8f4ec;
  color: #0e695b;
}

.admin-meta.inactive {
  background: #f2dede;
  color: #8d3434;
}

.cell-muted {
  color: var(--ink-soft);
}

.player-score-cell {
  display: grid;
  gap: 2px;
}

.player-score-cell strong {
  font-variant-numeric: tabular-nums;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th,
.table td {
  padding: 9px 8px;
  border-bottom: 1px solid rgba(18, 34, 49, 0.11);
  text-align: left;
}

.table thead th {
  color: #304657;
  font-weight: 700;
  background: rgba(245, 250, 253, 0.7);
}

.num-col {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: #5d6f82;
}

.badge.win {
  background: #1da877;
}

.badge.lose {
  background: #d65757;
}

.badge.draw {
  background: #78859a;
}

.actions-row {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #1f333f;
  color: #fff;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 170ms ease, transform 170ms ease;
  box-shadow: 0 10px 26px -14px rgba(0, 0, 0, 0.6);
  z-index: 30;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.hist {
  display: grid;
  gap: 6px;
}

.hist-row {
  display: grid;
  grid-template-columns: 120px 1fr 30px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.hist-bar {
  height: 10px;
  border-radius: 999px;
  background: #dce8f2;
  overflow: hidden;
}

.hist-fill {
  height: 100%;
  background: linear-gradient(90deg, #67e0be, #18a679);
}

@media (max-width: 1080px) {
  .grid.two {
    grid-template-columns: 1fr;
  }

  .match-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .match-grid button {
    grid-column: span 2;
  }

  .rule-row {
    grid-template-columns: 1fr 1fr;
  }

  .rule-row button {
    grid-column: span 2;
  }
}

@media (max-width: 860px) {
  body {
    padding: 14px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .sim-grid,
  .match-grid {
    grid-template-columns: 1fr;
  }

  .sim-grid button,
  .match-grid button {
    grid-column: span 1;
  }

  .inline-form {
    flex-direction: column;
    align-items: stretch;
  }

  .tabs {
    top: 6px;
  }

  .match-team-name {
    font-size: 13px;
  }

  .match-team-score {
    font-size: 16px;
  }
}
