*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #020617;
  color: #e5e7eb;
}

/* Layout utama */

.page-wrap {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: 16px;
}

.container {
  width: 100%;
  max-width: 1080px;
  background: #020617;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  padding: 16px;
  border: 1px solid #1f2937;
}

@media (min-width: 768px) {
  .container {
    padding: 24px 28px;
  }
}

h1 {
  margin: 0 0 8px;
  font-size: 20px;
}

.subtitle {
  font-size: 13px;
  color: #9ca3af;
  margin-bottom: 16px;
}

/* Status bar */

.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border-radius: 8px;
  background: #020617;
  border: 1px solid #1e293b;
  font-size: 13px;
}

.badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #a5b4fc;
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.8);
}

/* Messages */

.msg {
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 13px;
}

.msg.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid #f87171;
  color: #fecaca;
}

.msg.success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid #4ade80;
  color: #bbf7d0;
}

/* Form */

.reward-form {
  margin-top: 4px;
  margin-bottom: 16px;
}

.field-group {
  margin-bottom: 12px;
  position: relative;
}

.field-group label {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
  color: #e5e7eb;
}

.field-group input[type="text"],
.field-group input[type="password"] {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #1f2933;
  background: #020617;
  color: #e5e7eb;
  font-size: 13px;
}

.field-group input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.65);
}

.hint {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 3px;
}

/* Buttons */

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
}

button.primary {
  padding: 8px 14px;
  border-radius: 9999px;
  background: linear-gradient(to right, #2563eb, #22c55e);
  color: white;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
}

button.primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

button.secondary {
  padding: 8px 14px;
  border-radius: 9999px;
  background: #020617;
  color: #e5e7eb;
  border: 1px solid #475569;
  font-size: 13px;
}

/* Table */

.table-wrapper {
  margin-top: 20px;
}

.table-scroll {
  max-height: 420px;
  overflow: auto;
  border-radius: 10px;
  border: 1px solid #1f2933;
  background: #020617;
}

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

thead {
  background: #020617;
  position: sticky;
  top: 0;
  z-index: 1;
}

th,
td {
  padding: 7px 8px;
  text-align: left;
  white-space: nowrap;
}

th {
  font-weight: 600;
  color: #9ca3af;
  border-bottom: 1px solid #1f2933;
}

tbody tr:nth-child(even) {
  background: #020617;
}

tbody tr:hover {
  background: #0b1220;
}

td.gold,
td.lv {
  text-align: right;
}

/* Player button */

.player-name {
  background: transparent;
  border-radius: 9999px;
  border: 1px solid transparent;
  padding: 2px 8px;
  font-size: 12px;
  color: #93c5fd;
}

.player-name:hover {
  border-color: #3b82f6;
  background: rgba(37, 99, 235, 0.15);
}

/* Empty state */

.empty-state {
  padding: 20px 12px;
  border-radius: 10px;
  text-align: center;
  font-size: 13px;
  border: 1px dashed #1f2933;
  color: #9ca3af;
  margin-top: 16px;
}

/* Suggestions */

.suggest-box {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 4px;
  max-height: 260px;
  overflow: auto;
  background: #020617;
  border-radius: 8px;
  border: 1px solid #1f2933;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.65);
  display: none;
  z-index: 40;
}

.suggest-item {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 8px;
  font-size: 12px;
  cursor: pointer;
}

.suggest-item:hover {
  background: #0b1220;
}

.suggest-code {
  font-weight: 600;
  color: #e5e7eb;
}

.suggest-name {
  flex: 1;
  text-align: right;
  color: #9ca3af;
}

/* Animasi kecil */

.page-wrap .container {
  animation: fadeInPanel 0.25s ease-out;
}

@keyframes fadeInPanel {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Modal (global) */

.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.88);
  align-items: center;
  justify-content: center;
  padding: 16px;
}

/* Saat aktif */

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

/* Prioritas z-index:
   - authCodeModal paling tinggi (supaya di atas modal lain)
   - singleModal di bawahnya
*/
#singleModal.modal-backdrop {
  z-index: 9000;
}

#authCodeModal.modal-backdrop {
  z-index: 10000;
}

/* Isi modal */

.modal {
  width: 100%;
  max-width: 420px;
  background: #020617;
  border-radius: 12px;
  padding: 16px 16px 14px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.8);
  border: 1px solid #1f2933;
}

.modal-title {
  margin: 0 0 4px;
  font-size: 16px;
}

.modal-sub {
  font-size: 12px;
  color: #9ca3af;
  margin-bottom: 10px;
}

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

/* Kunci scroll saat ada modal apa pun */

body.modal-open {
  overflow: hidden;
}

/* Responsive tweak */

@media (max-width: 640px) {
  .container {
    padding: 14px 12px;
  }

  h1 {
    font-size: 18px;
  }

  .status-bar {
    font-size: 12px;
  }

  table {
    font-size: 11px;
  }

  th,
  td {
    padding: 6px 6px;
  }

  .modal {
    padding: 14px;
  }
}
