:root {
  --bg-start: #efebe3;
  --bg-end: #e4ded4;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-strong: rgba(255, 255, 255, 0.96);
  --line: rgba(69, 58, 49, 0.12);
  --text: #201913;
  --muted: #6f6358;
  --accent: #8f4a2b;
  --accent-soft: rgba(143, 74, 43, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  font-family: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(143, 74, 43, 0.08), transparent 26%),
    linear-gradient(160deg, var(--bg-start), var(--bg-end));
}

.card {
  width: min(480px, 100%);
  display: grid;
  gap: 16px;
  padding: 30px;
  border-radius: 26px;
  border: 1px solid rgba(69, 58, 49, 0.1);
  background: var(--panel);
  box-shadow: 0 20px 42px rgba(39, 29, 21, 0.09);
  backdrop-filter: blur(12px) saturate(1.05);
}

h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.lead,
.status-message {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.users-section {
  display: grid;
  gap: 12px;
}

.users-grid {
  display: grid;
  gap: 8px;
}

.user-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.58);
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.user-card:hover {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(143, 74, 43, 0.22);
  transform: translateY(-1px);
}

.user-card:focus-visible {
  outline: 2px solid rgba(143, 74, 43, 0.65);
  outline-offset: 2px;
}

.user-card-info strong {
  font-size: 14px;
  font-weight: 600;
}

.user-card-actions {
  flex-shrink: 0;
}

#errorMessage {
  min-height: 20px;
  color: #b42318;
  font-size: 14px;
}

.auth-modal[hidden] {
  display: none;
}

.auth-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20, 17, 14, 0.38);
  backdrop-filter: blur(9px) saturate(0.95);
  z-index: 1000;
}

.auth-modal-card {
  width: min(560px, 100%);
  display: grid;
  gap: 14px;
  padding: 26px;
  border-radius: 24px;
  border: 1px solid rgba(69, 58, 49, 0.12);
  background: var(--panel-strong);
  box-shadow: 0 28px 70px rgba(28, 20, 15, 0.18);
}

.auth-modal-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.auth-modal-header h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.auth-modal-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.auth-modal-close {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(69, 58, 49, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.auth-modal-close:hover {
  border-color: rgba(143, 74, 43, 0.22);
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
}

.auth-modal-setup {
  display: grid;
  gap: 12px;
}

.auth-modal-qr-wrap {
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(122, 98, 74, 0.12);
  background: rgba(255, 255, 255, 0.72);
}

.auth-modal-qr {
  width: 220px;
  height: 220px;
  image-rendering: pixelated;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(73, 49, 25, 0.08);
}

.auth-modal-qr-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.auth-modal-field {
  display: grid;
  gap: 6px;
}

.auth-modal-field label,
.auth-modal-field > span {
  color: var(--muted);
  font-size: 12px;
}

.auth-modal-copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.auth-modal-copy-row code {
  display: block;
  overflow: auto;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(69, 58, 49, 0.12);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  word-break: break-all;
}

.auth-code-field {
  gap: 8px;
}

.auth-code-shell {
  position: relative;
}

.auth-code-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  border: 0;
  padding: 0;
  opacity: 0;
  color: transparent;
  caret-color: transparent;
  background: transparent;
}

.auth-code-input:focus {
  outline: none;
}

.auth-code-shell:focus-within .auth-code-cells {
  border-color: rgba(143, 74, 43, 0.42);
  box-shadow: 0 0 0 4px rgba(143, 74, 43, 0.07);
}

.auth-code-cells {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  padding: 4px;
  border-radius: 18px;
  border: 1px solid rgba(69, 58, 49, 0.12);
  background: rgba(248, 246, 241, 0.88);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.auth-code-cell {
  display: grid;
  place-items: center;
  min-height: 58px;
  border-radius: 12px;
  border: 1px solid rgba(69, 58, 49, 0.08);
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.auth-code-cell.is-filled {
  border-color: rgba(143, 74, 43, 0.18);
}

.auth-code-cell.is-active {
  border-color: rgba(143, 74, 43, 0.42);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: inset 0 0 0 1px rgba(143, 74, 43, 0.06);
}

.auth-modal-message {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

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

.auth-modal-actions button,
.auth-modal-copy-row button {
  border: 1px solid rgba(69, 58, 49, 0.12);
  border-radius: 12px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.auth-modal-actions button:hover,
.auth-modal-copy-row button:hover {
  border-color: rgba(143, 74, 43, 0.22);
  background: rgba(255, 255, 255, 1);
  transform: translateY(-1px);
}

.auth-modal-actions .primary {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
}

@media (max-width: 640px) {
  .card,
  .auth-modal-card {
    padding: 20px;
    border-radius: 18px;
  }

  h1 {
    font-size: 26px;
  }

  .auth-modal-copy-row {
    grid-template-columns: 1fr;
  }

  .auth-code-cells {
    gap: 8px;
  }

  .auth-code-cell {
    min-height: 50px;
    font-size: 20px;
  }

  .auth-modal-actions {
    flex-direction: column-reverse;
  }

  .auth-modal-actions button,
  .auth-modal-copy-row button {
    width: 100%;
  }
}
