@import url("https://cdn.jsdelivr.net/gh/sunn-us/SUIT/fonts/variable/woff2/SUIT-Variable.css");

:root {
  --bg: #edf3ef;
  --surface: #ffffff;
  --surface-soft: #f7faf8;
  --line: #d7e2db;
  --text: #172b23;
  --muted: #66786f;
  --brand: #0f6b4f;
  --brand-dark: #084936;
  --brand-soft: #dff2e8;
  --accent: #f5b82e;
  --danger: #d95d39;
  --men: #327dca;
  --women: #df6a8a;
  --mixed: #7d57c2;
  --shadow: 0 16px 34px rgba(22, 56, 42, 0.12);
  --font-sans: "SUIT Variable", "SUIT", "Pretendard Variable", "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --font-brand: "SUIT Variable", "SUIT", "Avenir Next", "Trebuchet MS", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: linear-gradient(180deg, #f6faf7 0%, var(--bg) 100%);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  letter-spacing: -0.018em;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  padding: 12px 12px 96px;
}

body.is-dragging {
  overflow: hidden;
  user-select: none;
}

button,
input,
select {
  font: inherit;
  letter-spacing: -0.02em;
}

button {
  cursor: pointer;
}

.app-shell {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 0 10px;
  margin-bottom: 2px;
  background: transparent;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.brand-logo {
  display: block;
  width: min(248px, 72vw);
  height: auto;
}

.mail-link,
.footer a {
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.panel {
  padding: 14px;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

h1,
h2 {
  margin: 0;
  letter-spacing: -0.04em;
}

h1 {
  font-size: 22px;
  font-weight: 900;
  line-height: 1.18;
}

h2 {
  font-size: 14px;
  font-weight: 850;
  color: var(--muted);
}

.block {
  display: grid;
  gap: 10px;
  padding-top: 14px;
  margin-top: 14px;
  border-top: 1px solid var(--line);
}

.block:first-of-type {
  padding-top: 0;
  margin-top: 0;
  border-top: 0;
}

.badge,
.type-tag,
.meta-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: -0.025em;
  white-space: nowrap;
}

.badge-green {
  color: var(--brand-dark);
  background: var(--brand-soft);
}

.badge-warn {
  color: #805600;
  background: #fff2d4;
}

.count-control {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbf8 100%);
}

.count-summary {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.count-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.count-summary strong {
  color: var(--brand-dark);
  font-size: 28px;
  line-height: 1;
}

.count-range {
  min-height: 24px;
  padding: 0;
  border: 0;
  accent-color: var(--brand);
  background: transparent;
}

.count-presets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.count-option {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 850;
}

.count-option.active {
  border-color: transparent;
  background: var(--brand);
  color: white;
}

.count-option:disabled,
select:disabled,
input:disabled {
  color: #819189;
  background: #eff4f1;
}

.participant-list {
  display: grid;
  gap: 8px;
}

.participant-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.participant-head {
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  gap: 8px;
}

.participant-index {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  font-size: 12px;
  font-weight: 900;
}

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

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

.field-wide {
  grid-column: 1 / -1;
}

.field span,
.mini-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: -0.03em;
}

input,
select {
  width: 100%;
  min-height: 42px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: white;
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
}

input:focus,
select:focus {
  border-color: #8bc9ae;
  box-shadow: 0 0 0 3px rgba(15, 107, 79, 0.1);
}

.notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  margin-top: 12px;
  border-radius: 12px;
  background: #e9f6ef;
  color: #205742;
  font-size: 13px;
  font-weight: 800;
}

.notice-warn {
  background: #fff4d7;
  color: #7a5708;
}

.notice button {
  border: 0;
  border-radius: 9px;
  padding: 8px 10px;
  background: rgba(15, 107, 79, 0.9);
  color: white;
  font-size: 12px;
  font-weight: 900;
}

.share-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  margin-top: 12px;
  border-radius: 12px;
  color: white;
  background: linear-gradient(135deg, #143d31 0%, #255845 100%);
}

.share-card h3 {
  margin: 0;
  font-size: 15px;
}

.share-link {
  padding: 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.13);
  font-size: 12px;
  line-height: 1.45;
  word-break: break-all;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.primary-btn,
.secondary-btn,
.subtle-btn,
.ghost-btn {
  min-height: 46px;
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 850;
}

.compact-btn {
  min-height: 32px;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.primary-btn {
  color: white;
  background: var(--brand);
  box-shadow: 0 12px 22px rgba(15, 107, 79, 0.22);
}

.secondary-btn {
  color: var(--brand-dark);
  background: #e8f2ed;
}

.subtle-btn {
  border: 1px solid var(--line);
  color: var(--text);
  background: white;
}

.ghost-btn {
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  background: rgba(255, 255, 255, 0.14);
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.meta-chip {
  color: var(--brand-dark);
  background: var(--brand-soft);
}

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

.game-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}

.game-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: #f5faf7;
}

.game-title strong {
  display: block;
  font-size: 15px;
}

.game-title span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.court-list {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.court-card {
  padding: 10px;
  border: 1px solid #dcebe3;
  border-radius: 12px;
  background: #f8fcfa;
}

.court-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.type-men {
  color: var(--men);
  background: #e8f3ff;
}

.type-women {
  color: var(--women);
  background: #ffe8ef;
}

.type-mixed {
  color: var(--mixed);
  background: #f2eaff;
}

.team-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: 8px;
}

.team {
  display: grid;
  gap: 7px;
  align-content: start;
}

.vs {
  display: grid;
  place-items: center;
  color: #7b9187;
  font-size: 11px;
  font-weight: 900;
}

.player-chip {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 43px;
  border: 0;
  border-radius: 10px;
  padding: 9px 10px;
  background: white;
  color: var(--text);
  text-align: left;
  font-size: 13px;
  font-weight: 850;
  box-shadow: inset 0 0 0 1px rgba(20, 55, 42, 0.08);
  touch-action: manipulation;
}

.player-chip small {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10px;
}

.player-chip.gender-m {
  box-shadow: inset 0 0 0 1px rgba(50, 125, 202, 0.22);
}

.player-chip.gender-f {
  box-shadow: inset 0 0 0 1px rgba(223, 106, 138, 0.22);
}

.player-chip.drag-source {
  opacity: 0.28;
}

.player-chip.drop-target {
  outline: 3px solid rgba(15, 107, 79, 0.26);
  background: #e9f8f0;
}

.drag-ghost {
  position: fixed;
  z-index: 200;
  min-width: 116px;
  max-width: 180px;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  color: white;
  background: var(--brand);
  box-shadow: 0 18px 42px rgba(9, 52, 38, 0.32);
  pointer-events: none;
  transform: translate(-50%, -120%) scale(1.05);
}

.drag-ghost small {
  color: rgba(255, 255, 255, 0.75);
}

.waiting-box {
  margin: 0 10px 10px;
  padding: 10px;
  border: 1px solid #f1dfaa;
  border-radius: 12px;
  background: #fff8e7;
}

.waiting-box strong {
  display: block;
  margin-bottom: 8px;
  color: #795b08;
  font-size: 12px;
}

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

.empty-state {
  padding: 24px 14px;
  border: 1px dashed #bfd3c7;
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--text);
}

.footer {
  display: grid;
  gap: 10px;
  padding: 14px 4px 4px;
  color: var(--muted);
  font-size: 12px;
}

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

.footer strong {
  display: block;
  color: var(--text);
  font-size: 12px;
}

.footer-main a {
  flex: 0 0 auto;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.footer-stats span {
  padding: 6px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
}

.sticky-actions {
  position: fixed;
  left: 50%;
  bottom: 12px;
  z-index: 30;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 8px;
  width: calc(100% - 24px);
  max-width: 440px;
  padding: 8px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  box-shadow: 0 16px 36px rgba(13, 43, 33, 0.18);
  transform: translateX(-50%);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  background: rgba(8, 24, 18, 0.48);
  backdrop-filter: blur(6px);
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  display: grid;
  gap: 12px;
  width: 100%;
  max-width: 440px;
  padding: 16px;
  border-radius: 18px;
  background: white;
  box-shadow: 0 26px 58px rgba(0, 0, 0, 0.22);
}

.modal-card h3 {
  margin: 0;
  font-size: 19px;
}

.toast {
  position: fixed;
  left: 50%;
  top: 14px;
  z-index: 210;
  min-width: 220px;
  max-width: calc(100% - 24px);
  padding: 11px 13px;
  border-radius: 12px;
  background: rgba(20, 52, 40, 0.94);
  color: white;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

[hidden] {
  display: none !important;
}

@media (max-width: 380px) {
  .count-grid,
  .mini-grid,
  .settings-grid,
  .button-row,
  .sticky-actions,
  .waiting-grid {
    grid-template-columns: 1fr;
  }

  .team-grid {
    grid-template-columns: 1fr;
  }

  .vs {
    min-height: 20px;
  }
}
