* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', 'Segoe UI', sans-serif;
  background: #f5f7fa;
  color: #1a1a2e;
  min-height: 100vh;
}

/* ================================
   HEADER
   ================================ */

.header {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-size: 1.5em;
  font-weight: 700;
  color: #1a1a2e;
}

.logo span {
  color: #22c55e;
}

.credit {
  font-size: 0.85em;
  color: #6b7280;
}

/* ================================
   CONTAINER
   ================================ */

.container {
  max-width: 900px;
  margin: 24px auto;
  padding: 0 20px;
}

/* ================================
   SECTIONS (Accordion)
   ================================ */

.section {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  transition: background 0.2s;
  user-select: none;
}

.section-header:hover {
  background: #f9fafb;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1em;
  font-weight: 600;
  color: #1a1a2e;
}

.section-icon {
  font-size: 1.2em;
}

.arrow {
  font-size: 0.7em;
  color: #22c55e;
  transition: transform 0.3s;
}

.section.open .arrow {
  transform: rotate(90deg);
}

.section-body {
  display: none;
  padding: 0 20px 20px 20px;
  border-top: 1px solid #f3f4f6;
}

.section.open .section-body {
  display: block;
}

/* ================================
   FORMS
   ================================ */

.form-row {
  display: flex;
  gap: 16px;
  margin-top: 16px;
}

.form-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.8em;
  font-weight: 600;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input,
.form-group select {
  padding: 12px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.95em;
  font-family: inherit;
  color: #1a1a2e;
  background: #fff;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  border-color: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.form-group input::placeholder {
  color: #9ca3af;
}

/* ================================
   BUTTONS
   ================================ */

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 0.95em;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-primary {
  background: #22c55e;
  color: #fff;
  flex: 1;
}

.btn-primary:hover {
  background: #16a34a;
}

.btn-outline {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
}

.btn-outline:hover {
  background: #e5e7eb;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8em;
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
}

.btn-sm:hover {
  background: #e5e7eb;
}

/* ================================
   RESULT BOX
   ================================ */

.result-box {
  margin-top: 16px;
  min-height: 0;
  overflow-x: auto;
}

.result-box:empty {
  display: none;
}

.log-box {
  margin-top: 12px;
  padding: 14px 16px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 0.9em;
  min-height: 48px;
  overflow-x: auto;
}

.log-box:empty {
  display: none;
}

/* ================================
   INFO BADGE
   ================================ */

.info-badge {
  display: inline-block;
  margin-top: 12px;
  padding: 6px 14px;
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
  border-radius: 20px;
  font-size: 0.85em;
}

/* ================================
   STAT GRID
   ================================ */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.stat-item {
  padding: 12px 14px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.stat-label {
  font-size: 0.75em;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 1.1em;
  font-weight: 700;
  color: #1a1a2e;
}

/* ================================
   DATA TABLE
   ================================ */

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 0.9em;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #f3f4f6;
}

.data-table th {
  font-weight: 600;
  color: #6b7280;
  font-size: 0.8em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table tr:hover {
  background: #f9fafb;
}

/* ================================
   BADGES
   ================================ */

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8em;
  font-weight: 500;
  margin: 2px;
}

.badge-online {
  background: #dcfce7;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}

.badge-offline {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.badge-info {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

/* ================================
   MEDAL GRID
   ================================ */

.medal-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  margin-bottom: 8px;
}

.medal-label {
  font-size: 0.85em;
  font-weight: 600;
  color: #374151;
  flex: 1;
}

.medal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}

.medal-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.medal-item:hover {
  border-color: #22c55e;
  background: #f0fdf4;
}

.medal-item input[type="checkbox"] {
  accent-color: #22c55e;
  width: 16px;
  height: 16px;
}

.medal-item label {
  font-size: 0.85em;
  color: #374151;
  cursor: pointer;
}

/* ================================
   STATUS MSG
   ================================ */

.status-success {
  color: #16a34a;
  font-weight: 500;
}

.status-error {
  color: #dc2626;
  font-weight: 500;
}

/* ================================
   LOADING
   ================================ */

.loading {
  color: #6b7280;
  text-align: center;
  padding: 16px;
}

/* ================================
   RESPONSIVE
   ================================ */

@media (max-width: 600px) {
  .form-row {
    flex-direction: column;
  }

  .header {
    padding: 12px 16px;
  }

  .container {
    padding: 0 12px;
  }

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