:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #eef3f7;
  --text: #16212f;
  --muted: #66768a;
  --border: #dce4ec;
  --ink: #17324d;
  --green: #12966e;
  --green-soft: #e5f7f1;
  --red: #e05549;
  --red-soft: #fff0ed;
  --amber: #c98416;
  --amber-soft: #fff6df;
  --shadow: 0 18px 48px rgba(23, 50, 77, 0.12);
  --radius: 8px;
  color: var(--text);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 0%, rgba(18, 150, 110, 0.15), transparent 30%),
    linear-gradient(180deg, #fff, var(--bg));
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.app {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 18px;
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  color: #fff;
  background: linear-gradient(135deg, var(--ink), var(--green));
  box-shadow: 0 12px 24px rgba(23, 50, 77, 0.22);
  flex: 0 0 auto;
}

.brand h1 {
  margin: 0;
  font-size: clamp(24px, 7vw, 34px);
  line-height: 1.08;
  font-weight: 900;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.code-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(18, 150, 110, 0.28);
  border-radius: var(--radius);
  color: var(--green);
  background: var(--green-soft);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 2px;
}

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

.room-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 14px;
  align-items: start;
}

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 15px;
  border-bottom: 1px solid var(--border);
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 15px;
  line-height: 1.2;
  font-weight: 900;
}

.panel-body {
  padding: 15px;
}

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

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

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.field input,
.field select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  background: #fff;
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: rgba(18, 150, 110, 0.72);
  box-shadow: 0 0 0 3px rgba(18, 150, 110, 0.12);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  background: #fff;
  font-size: 14px;
  font-weight: 900;
}

.btn.primary {
  border-color: var(--ink);
  color: #fff;
  background: var(--ink);
}

.btn.success {
  border-color: var(--green);
  color: #fff;
  background: var(--green);
}

.btn.danger {
  border-color: rgba(224, 85, 73, 0.36);
  color: var(--red);
  background: var(--red-soft);
}

.btn.ghost {
  background: transparent;
}

.btn.full {
  width: 100%;
}

.icon {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.hero-copy {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.room-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.room-title h2 {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(24px, 7vw, 36px);
  line-height: 1.08;
  font-weight: 950;
}

.room-title p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.me-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 16px;
  border: 1px solid rgba(18, 150, 110, 0.24);
  border-radius: var(--radius);
  background: var(--green-soft);
  margin-bottom: 14px;
}

.me-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.me-card strong {
  display: block;
  margin-top: 5px;
  font-size: 20px;
  line-height: 1.1;
}

.score {
  font-size: clamp(34px, 12vw, 52px);
  line-height: 1;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.score.positive {
  color: var(--green);
}

.score.negative {
  color: var(--red);
}

.players {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.player-row,
.history-row,
.rank-row {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.player-main,
.history-main,
.rank-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  font-weight: 900;
}

.sub {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.amount {
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.amount.in {
  color: var(--green);
}

.amount.out {
  color: var(--red);
}

.transfer-grid {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 10px;
}

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

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 9px;
  border-radius: var(--radius);
  color: var(--green);
  background: var(--green-soft);
  font-size: 12px;
  font-weight: 900;
}

.status.finished {
  color: var(--muted);
  background: var(--surface-2);
}

.empty {
  min-height: 120px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

.toast {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 28px));
  padding: 12px 14px;
  border: 1px solid rgba(18, 150, 110, 0.3);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 900;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

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

@media (max-width: 820px) {
  .app {
    padding: 14px;
  }

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

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

  .room-head {
    display: flex;
  }

  .code-badge {
    width: 100%;
  }
}

@media (max-width: 460px) {
  .brand-mark {
    width: 38px;
    height: 38px;
  }

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

  .btn {
    width: 100%;
  }
}
