:root {
  --bg: #0a0f1f;
  --panel: #111a33;
  --panel-2: #172447;
  --line: #2f447f;
  --text: #eef4ff;
  --muted: #a6b4da;
  --accent: #ff4d2d;
  --accent-2: #ffb300;
  --ok: #30c279;
  --danger: #ff5a70;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Microsoft JhengHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 10%, rgba(255, 77, 45, 0.15), transparent 40%),
    radial-gradient(circle at 80% 0%, rgba(255, 179, 0, 0.12), transparent 35%),
    linear-gradient(145deg, #060a16 0%, #0a0f1f 45%, #0a1429 100%);
  min-height: 100vh;
}

a {
  color: #ffd16a;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 14, 30, 0.75);
  backdrop-filter: blur(6px);
}

.brand {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.nav-links {
  display: flex;
  gap: 14px;
  align-items: center;
}

.container {
  width: min(1100px, 95%);
  margin: 24px auto 80px;
}

.hero {
  background: linear-gradient(130deg, rgba(255, 77, 45, 0.2), rgba(255, 179, 0, 0.08) 40%, rgba(16, 31, 66, 0.9));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 26px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
}

.hero h1 {
  margin: 0 0 8px;
  font-size: 2rem;
}

.card-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.card {
  background: linear-gradient(160deg, rgba(21, 35, 70, 0.95), rgba(13, 22, 44, 0.95));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}

.card h3 {
  margin-top: 0;
}

.meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(255, 179, 0, 0.12);
  color: #ffd16a;
  border: 1px solid rgba(255, 179, 0, 0.5);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin-top: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 6px;
  color: var(--muted);
}

input,
select,
textarea,
button {
  width: 100%;
  border-radius: 10px;
  border: 1px solid #324d8f;
  padding: 10px 12px;
  background: #0f1932;
  color: var(--text);
}

button {
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, #ff4d2d, #ff9b24);
  color: #190f0d;
  border: none;
}

button.secondary {
  background: #263d73;
  color: var(--text);
  border: 1px solid #3e5ba0;
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.table th,
.table td {
  border-bottom: 1px solid #22325d;
  padding: 10px;
  text-align: left;
  font-size: 0.9rem;
}

.kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.kpi .card {
  text-align: center;
  padding: 12px;
}

.kpi strong {
  font-size: 1.4rem;
}

.notice {
  border: 1px solid #3c5caa;
  background: #122146;
  padding: 10px;
  border-radius: 10px;
  margin-top: 10px;
}

.notice.ok {
  border-color: #2a8a61;
  background: #132a22;
}

.notice.error {
  border-color: #a74b61;
  background: #2f1720;
}

.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}

.modal-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  width: 100%; max-width: 520px;
  padding: 24px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
}

.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}

.modal-header h3 {
  margin: 0; font-size: 1.3rem;
}

.modal-close {
  background: none; border: none; color: var(--muted);
  font-size: 1.6rem; cursor: pointer; width: auto; padding: 0 4px;
}

.modal-msg {
  margin-top: 12px;
}

.modal-close:hover { color: var(--text); }

.required { color: var(--danger); }

.btn-secondary {
  background: #263d73; color: var(--text); border: 1px solid #3e5ba0;
  width: auto; padding: 10px 20px;
}

.btn-primary {
  width: auto; padding: 10px 24px;
}

.btn-sm {
  width: auto; padding: 4px 12px; font-size: 0.8rem;
}

.score-cell {
  white-space: nowrap; text-align: center;
}

.score-input {
  width: 48px; text-align: center; display: inline; font-size: 1rem; font-weight: 700;
}

.score-colon {
  display: inline; padding: 0 4px; font-weight: 700;
}

.team-name {
  font-weight: 600;
}

.btn-google {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  background: #ffffff; color: #3c4043; border: 1px solid #dadce0; border-radius: 6px;
  padding: 10px 24px; font-weight: 600; font-size: 0.95rem; text-decoration: none;
  transition: background 0.15s, box-shadow 0.15s;
}
.btn-google:hover { background: #f7f8f8; text-decoration: none; box-shadow: 0 1px 3px rgba(0,0,0,0.25); }
.btn-google svg { flex-shrink: 0; }

.admin-nav {
  display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 18px;
  background: rgba(15, 23, 46, 0.6); border: 1px solid var(--line); border-radius: 10px;
  margin: 0 0 24px; position: sticky; top: 8px; z-index: 10; backdrop-filter: blur(6px);
}
.admin-nav-item {
  display: inline-block; padding: 8px 14px; background: #1a2548; color: var(--text);
  border: 1px solid #2c3d6e; border-radius: 6px; font-size: 0.88rem; text-decoration: none;
  transition: background 0.15s, transform 0.1s;
}
.admin-nav-item:hover {
  background: #243669; text-decoration: none; transform: translateY(-1px);
}
.admin-nav-item:active { transform: translateY(0); }

.divider {
  display: flex; align-items: center; text-align: center; margin: 18px 0 14px;
  color: var(--muted); font-size: 0.85rem;
}
.divider::before, .divider::after {
  content: ""; flex: 1; border-bottom: 1px solid var(--line);
}
.divider span { padding: 0 12px; }

@media (max-width: 768px) {
  .hero h1 {
    font-size: 1.5rem;
  }
  .nav {
    flex-direction: column;
    gap: 8px;
  }
}
