/* ── Reset & Base ─────────────────────────────────────────── */

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

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #1a1a2e;
  color: #e0e0e0;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 2rem 1rem;
}

/* ── Container ───────────────────────────────────────────── */

.container {
  width: 100%;
  max-width: 400px;
}

/* ── Header / Status ─────────────────────────────────────── */

header {
  text-align: center;
  margin-bottom: 2rem;
}

header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #ffffff;
  margin-bottom: 1rem;
}

.status {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.status-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #8888a0;
}

.status-region {
  font-size: 1.75rem;
  font-weight: 700;
  color: #ffffff;
  transition: color 0.2s;
}

/* ── Button Grid ─────────────────────────────────────────── */

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.btn {
  border: none;
  border-radius: 16px;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.1s, box-shadow 0.2s, opacity 0.2s;
  -webkit-user-select: none;
  user-select: none;
}

.btn:active:not(:disabled) {
  transform: scale(0.96);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Region buttons */

.btn-region,
.btn-off {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 120px;
  padding: 1.25rem 0.5rem;
  background: #16213e;
  color: #c8c8d4;
  border: 2px solid transparent;
}

.btn-region:hover:not(:disabled),
.btn-off:hover:not(:disabled) {
  background: #1c2a4a;
}

.btn-flag {
  font-size: 2.5rem;
  line-height: 1;
}

.btn-label {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Active region highlight */

.btn-region.active {
  border-color: #4fc3f7;
  box-shadow: 0 0 20px rgba(79, 195, 247, 0.25);
  background: #1a2d50;
  color: #ffffff;
}

/* OFF button */

.btn-off {
  background: #2e1520;
  color: #e57373;
  border-color: transparent;
}

.btn-off:hover:not(:disabled) {
  background: #3a1a28;
}

.btn-off.active {
  border-color: #e57373;
  box-shadow: 0 0 20px rgba(229, 115, 115, 0.25);
  color: #ffffff;
}

/* ── Loading ─────────────────────────────────────────────── */

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
  color: #8888a0;
  font-size: 0.9rem;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid #2a2a4a;
  border-top-color: #4fc3f7;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Error ───────────────────────────────────────────────── */

.error-text {
  color: #e57373;
  font-size: 0.85rem;
  text-align: center;
  margin-top: 1rem;
}

/* ── PIN Modal ───────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 20, 0.92);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  padding: 1rem;
}

.modal {
  background: #16213e;
  border-radius: 20px;
  padding: 2rem;
  width: 100%;
  max-width: 320px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.modal h2 {
  font-size: 1.25rem;
  color: #ffffff;
}

.modal input {
  width: 100%;
  padding: 0.9rem 1rem;
  font-size: 1.5rem;
  text-align: center;
  letter-spacing: 0.3em;
  background: #1a1a2e;
  border: 2px solid #2a2a4a;
  border-radius: 12px;
  color: #ffffff;
  outline: none;
  transition: border-color 0.2s;
}

.modal input:focus {
  border-color: #4fc3f7;
}

.btn-pin {
  padding: 0.9rem;
  font-size: 1rem;
  font-weight: 600;
  background: #4fc3f7;
  color: #1a1a2e;
  border-radius: 12px;
}

.btn-pin:active:not(:disabled) {
  background: #3aa8d8;
}
