* {
  box-sizing: border-box;
}

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

body {
  font-family: system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: #10151f;
  color: #eef2f8;
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  height: 100%;
}

.player-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #1a2231;
  border-bottom: 1px solid #2b3648;
  font-size: 15px;
  flex-wrap: wrap;
}

.player-label {
  color: #8fa2bd;
  font-size: 13px;
}

.player-name {
  color: #7ad6a0;
  font-weight: 700;
  word-break: break-all;
}

.player-name.is-fallback {
  color: #f0b566;
  font-weight: 500;
}

.stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  min-height: 120px;
}

.stage-text {
  margin: 0;
  color: #63748d;
  font-size: 14px;
}

.stage {
  overflow: auto;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 420px;
  padding: 20px;
  background: #1a2231;
  border: 1px solid #2b3648;
  border-radius: 14px;
}

.question {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
  word-break: break-word;
}

.answer-form {
  display: flex;
  gap: 8px;
}

.answer-input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #3a465c;
  border-radius: 10px;
  background: #0f1622;
  color: #eef2f8;
  font-size: 16px;
  font-family: inherit;
}

.answer-input:focus {
  outline: 2px solid #4a8cff;
  outline-offset: 1px;
}

.answer-input:disabled {
  color: #7d8ba1;
}

.submit-btn,
.restart-btn {
  padding: 10px 14px;
  border: 0;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}

.submit-btn {
  background: #4a8cff;
  color: #08111f;
}

.submit-btn:disabled {
  background: #33405a;
  color: #8fa2bd;
  cursor: default;
}

.restart-btn {
  background: #2b3648;
  color: #eef2f8;
}

.streak {
  margin: 0;
  color: #8fa2bd;
  font-size: 13px;
  text-align: center;
}

.streak strong {
  color: #7ad6a0;
  font-size: 15px;
}

.feedback {
  margin: 0;
  min-height: 20px;
  color: #a9b8cc;
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
  word-break: break-word;
}

.feedback.is-good {
  color: #7ad6a0;
}

.feedback.is-bad {
  color: #f0896a;
}

.db-status {
  margin: 0;
  color: #63748d;
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
  word-break: break-word;
}

.db-status.is-warn {
  color: #f0b566;
}

.rule-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid #2b3648;
}

.rule-title {
  margin: 0;
  color: #8fa2bd;
  font-size: 13px;
  font-weight: 700;
}

.rule-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.rule-input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #3a465c;
  border-radius: 9px;
  background: #0f1622;
  color: #eef2f8;
  font-size: 14px;
  font-family: inherit;
}

.rule-input:focus {
  outline: 2px solid #4a8cff;
  outline-offset: 1px;
}

.rule-arrow {
  color: #63748d;
  font-size: 14px;
}

.save-btn {
  padding: 9px 12px;
  border: 0;
  border-radius: 9px;
  background: #7ad6a0;
  color: #08130d;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}

.save-btn:disabled {
  background: #33405a;
  color: #8fa2bd;
  cursor: default;
}

.rule-status {
  margin: 0;
  min-height: 16px;
  color: #63748d;
  font-size: 12px;
  line-height: 1.4;
  word-break: break-word;
}

.rule-status.is-warn {
  color: #f0896a;
}

/* ---------- 데이터 로딩 표시 ---------- */

.loading {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  background: rgba(9, 13, 20, 0.72);
  color: #d5dfec;
  font-size: 13px;
  text-align: center;
}

.loading[hidden] {
  display: none;
}

.loading-spinner {
  flex: none;
  width: 18px;
  height: 18px;
  border: 2px solid #3a465c;
  border-top-color: #4a8cff;
  border-radius: 50%;
  animation: loading-spin 0.8s linear infinite;
}

.loading-text {
  line-height: 1.4;
  word-break: break-word;
}

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

@media (prefers-reduced-motion: reduce) {
  .loading-spinner {
    animation-duration: 2s;
  }
}

/* ---------- 이용 약관 동의 ---------- */

.consent {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 16px;
  background: rgba(9, 13, 20, 0.97);
  overflow: auto;
}

.consent[hidden] {
  display: none;
}

.consent-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 420px;
  margin: auto;
  padding: 18px;
  background: #1a2231;
  border: 1px solid #2b3648;
  border-radius: 14px;
}

.consent-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.consent-lead {
  margin: 0;
  color: #8fa2bd;
  font-size: 13px;
  line-height: 1.45;
}

.consent-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
}

.consent-item {
  padding: 10px 12px;
  background: #10151f;
  border: 1px solid #2b3648;
  border-radius: 10px;
}

.consent-item dt {
  margin-bottom: 4px;
  color: #7ad6a0;
  font-size: 12px;
  font-weight: 700;
}

.consent-item dd {
  margin: 0;
  color: #d5dfec;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}

.consent-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: #d5dfec;
  font-size: 13px;
  line-height: 1.4;
  cursor: pointer;
}

.consent-check input {
  flex: none;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: #4a8cff;
}

.consent-btn {
  padding: 11px 14px;
  border: 0;
  border-radius: 10px;
  background: #4a8cff;
  color: #08111f;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}

.consent-btn:disabled {
  background: #33405a;
  color: #8fa2bd;
  cursor: default;
}

.consent-note {
  margin: 0;
  color: #63748d;
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}
