* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
  color: #123;
  background: #eaf7fb;
  overflow: hidden;
}
.panel {
  position: relative;
  z-index: 1;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}
.title {
  margin: 4px 0 0;
  font-size: 20px;
  font-weight: 800;
  color: #14425c;
  text-align: center;
}
.user-name {
  margin: -4px 0 0;
  font-size: 13px;
  font-weight: 700;
  color: #2f6d92;
  text-align: center;
  word-break: break-all;
}
.admin-badge {
  margin: -6px 0 0;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 700;
  color: #8a5a00;
  background: #fff4d6;
  border: 1px solid #f0d79a;
  border-radius: 8px;
  text-align: center;
}
.admin-badge[hidden] { display: none; }
.saver {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.saver .word-input,
.saver .meaning-input { flex: 1 1 30%; }
.word-input,
.meaning-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 12px 14px;
  font-size: 16px;
  color: #123;
  border: 2px solid #9fc6da;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
}
.word-input:focus,
.meaning-input:focus {
  outline: none;
  border-color: #2f88bd;
  box-shadow: 0 0 0 3px rgba(47, 136, 189, 0.20);
}
.save-btn {
  flex: 0 0 auto;
  padding: 12px 18px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: #2f88bd;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}
.save-btn:hover { background: #26739f; }
.save-btn:disabled { background: #9dbccd; cursor: default; }
.form-hint {
  margin: -4px 0 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: #5c7d92;
}
.status {
  min-height: 20px;
  margin: 0;
  font-size: 14px;
  color: #35607a;
  text-align: center;
}
.status:not(:empty) {
  padding: 8px 10px;
  border: 1px solid #cfe3ee;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
}
.status.ok { color: #1c7a45; font-weight: 700; }
.status.warn { color: #a4700c; }
.status.err { color: #b3322a; }
.list-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
}
.list-title {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 700;
  color: #35607a;
}
.word-list {
  flex: 1 1 auto;
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
}
.word-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 4px;
  font-size: 15px;
  border-bottom: 1px solid #dceaf2;
}
.word-list li:last-child { border-bottom: none; }
.word-list .row-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.word-list .word { font-weight: 700; word-break: break-all; }
.word-list .meaning { font-size: 13px; color: #35607a; word-break: break-all; }
.word-list .row-side {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.word-list .meta { font-size: 12px; color: #7c97a8; }
.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}
.row-actions .confirm-ask { font-size: 12px; color: #35607a; }
.mini-btn {
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  color: #2f6d92;
  background: #eaf3f9;
  border: 1px solid #bcd8e7;
  border-radius: 6px;
  cursor: pointer;
}
.mini-btn:hover { background: #dbeaf4; }
.mini-btn:disabled { opacity: 0.55; cursor: default; }
.mini-btn.danger { color: #b3322a; background: #fdeeec; border-color: #f0c6c1; }
.mini-btn.danger:hover { background: #f9ddd9; }
.edit-wrap {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.edit-wrap .word-input,
.edit-wrap .meaning-input {
  flex: 1 1 40%;
  min-width: 0;
  padding: 7px 9px;
  font-size: 14px;
}
.word-list .empty { justify-content: center; color: #7c97a8; font-size: 14px; }
.word-list .loading { justify-content: center; color: #7c97a8; font-size: 14px; }
.word-list .loading::after {
  content: "";
  display: inline-block;
  width: 1em;
  margin-left: 2px;
  animation: dots 1.2s steps(4, end) infinite;
}
@keyframes dots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75% { content: "..."; }
}
/* 이용약관 동의 화면 */
.panel[hidden] { display: none; }
.consent {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(12, 40, 56, 0.55);
  overflow-y: auto;
}
.consent[hidden] { display: none; }
.consent-box {
  width: 100%;
  max-width: 420px;
  max-height: 100%;
  overflow-y: auto;
  padding: 18px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(10, 40, 60, 0.28);
}
.consent-title {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 800;
  color: #14425c;
  text-align: center;
}
.consent-body {
  font-size: 13.5px;
  line-height: 1.6;
  color: #2b4a5c;
}
.consent-body h2 {
  margin: 12px 0 4px;
  font-size: 14px;
  font-weight: 700;
  color: #14425c;
}
.consent-body h2:first-child { margin-top: 0; }
.consent-body p { margin: 0; }
.consent-body ul { margin: 0; padding-left: 18px; }
.consent-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 16px 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: #14425c;
  cursor: pointer;
}
.consent-check input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 1px;
}
.consent-btn {
  width: 100%;
  padding: 12px 16px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: #2f88bd;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}
.consent-btn:hover:not(:disabled) { background: #26739f; }
.consent-btn:disabled { background: #9dbccd; cursor: default; }
/* 단어장·퀴즈 화면 전환 */
#dictView {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#dictView[hidden] { display: none; }
.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.list-head .list-title { margin: 0; }
.quiz-open { flex: 0 0 auto; padding: 6px 10px; font-size: 13px; }

/* 단어 퀴즈 */
.quiz-view {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.quiz-view[hidden] { display: none; }
.quiz-view .list-title { margin: 0; text-align: center; font-size: 15px; }
.quiz-hint {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #35607a;
  text-align: center;
}
.pick-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
}
.quiz-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.quiz-actions .save-btn { flex: 0 0 auto; padding: 10px 16px; font-size: 15px; }
.quiz-progress {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #2f6d92;
  text-align: center;
}
.quiz-question {
  flex: 0 0 auto;
  padding: 16px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  text-align: center;
  overflow-y: auto;
}
.quiz-prompt { margin: 0 0 8px; font-size: 13px; color: #35607a; }
.quiz-ask { margin: 0; font-size: 24px; font-weight: 800; color: #14425c; word-break: break-word; }
.quiz-score {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  color: #14425c;
  text-align: center;
}
.quiz-sub { margin: 4px 0; font-size: 14px; font-weight: 700; color: #35607a; }
.quiz-wrong-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
}
.quiz-wrong-wrap .word-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.word-list .given { font-size: 12px; color: #b3322a; word-break: break-all; }

@media (max-height: 420px) {
  .panel { padding: 10px; gap: 8px; }
  .title { font-size: 16px; }
  .word-input, .meaning-input, .save-btn { padding: 9px 12px; font-size: 14px; }
  .quiz-ask { font-size: 18px; }
  .quiz-question { padding: 10px; }
}
