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

body {
  min-height: 100vh;
  background-color: #7ed97e;
  font-family: 'Malgun Gothic', '맑은 고딕', sans-serif;
  color: #222;
}

/* ── 공통 헤더 ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 10px;
}

.page-title {
  font-size: 2rem;
  font-weight: 700;
  font-family: 'Dancing Script', 'Nanum Pen Script', cursive;
  color: #FFE600;
  text-shadow: none;
  letter-spacing: 2px;
}

.btn-add {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #111;
  color: #fff;
  border: none;
  font-size: 1.7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
  transition: background 0.15s;
}

.btn-add:hover {
  background: #333;
}

.back-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #333;
  padding: 4px 8px;
}

/* ── 홈 화면 ── */
.home-title {
  text-align: center;
  font-size: 3.5rem;
  font-weight: 700;
  font-family: 'Dancing Script', 'Nanum Pen Script', cursive;
  color: #FFE600;
  text-shadow: none;
  padding: 40px 0 30px;
  letter-spacing: 4px;
}

.home-layout {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 20px;
  padding: 0 16px 40px;
}

.home-cards {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 280px;
  flex-shrink: 0;
}

.home-ranking-panel {
  background: rgba(255,255,255,0.15);
  border-radius: 16px;
  padding: 16px 14px;
  width: 160px;
  flex-shrink: 0;
}

.ranking-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #FFE600;
  margin-bottom: 2px;
  text-align: center;
}

.ranking-subtitle {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.7);
  text-align: center;
  margin-bottom: 10px;
}

.ranking-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ranking-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255,255,255,0.2);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 0.82rem;
  color: #fff;
  font-weight: 600;
  counter-increment: rank;
}

.ranking-item::before {
  content: counter(rank);
  font-size: 0.7rem;
  font-weight: 900;
  color: rgba(255,255,255,0.6);
  min-width: 14px;
}

.ranking-list { counter-reset: rank; }

.ranking-item.rank-1 { background: rgba(255,215,0,0.35); }
.ranking-item.rank-2 { background: rgba(192,192,192,0.3); }
.ranking-item.rank-3 { background: rgba(205,127,50,0.3); }

.rank-name { flex: 1; margin: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-score { font-size: 0.78rem; color: #FFE600; font-weight: 800; white-space: nowrap; }

.ranking-empty, .ranking-loading {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.55);
  text-align: center;
  padding: 8px 0;
  list-style: none;
}

@media (max-width: 680px) {
  .home-layout { flex-direction: column; align-items: center; gap: 12px; }
  .home-ranking-panel { width: 280px; }
}

.home-card {
  border-radius: 20px;
  padding: 32px 24px;
  cursor: pointer;
  text-align: center;
  font-size: 1.4rem;
  font-weight: 700;
  font-family: 'Dancing Script', 'Nanum Pen Script', cursive;
  color: #fff;
  text-shadow: none;
  transition: transform 0.12s, box-shadow 0.12s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  letter-spacing: 1px;
}

.home-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.18);
}

.home-card:active {
  transform: translateY(0);
}

.card-today    { background: #a5d6a7; }  /* 연한 초록 */
.card-contents { background: #81c784; }  /* 중간 초록 */
.card-basket   { background: #66bb6a; }  /* 진한 초록 */
.card-quiz     { background: #4caf50; }  /* 더 진한 초록 */

/* ── 퀴즈 페이지 ── */
.quiz-container {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 20px 60px;
  text-align: center;
}

/* 시작 화면 */
.quiz-start-screen {
  padding-top: 60px;
}

.quiz-main-title {
  font-size: 2.4rem;
  font-weight: 700;
  font-family: 'Dancing Script', 'Nanum Pen Script', cursive;
  color: #FFE600;
  text-shadow: none;
  letter-spacing: 3px;
  margin-bottom: 12px;
}

.quiz-subtitle {
  font-size: 1rem;
  color: #fff;
  margin-bottom: 48px;
  opacity: 0.85;
}

.btn-quiz-start {
  background: #FFE600;
  color: #333;
  border: none;
  border-radius: 16px;
  padding: 18px 48px;
  font-size: 1.4rem;
  font-weight: 900;
  cursor: pointer;
  letter-spacing: 2px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.15);
  transition: transform 0.12s, box-shadow 0.12s;
  font-family: 'Dancing Script', 'Nanum Pen Script', cursive;
}

.btn-quiz-start:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.btn-quiz-start:active {
  transform: translateY(0);
}

.quiz-start-deco {
  position: relative;
  margin-top: 36px;
  height: 210px;
}

.quiz-start-deco span {
  position: absolute;
  font-size: 5rem;
  opacity: 0.9;
}

.deco-clover1 {
  left: calc(50% - 120px);
  top: 20px;
  transform: rotate(-20deg);
}

.deco-smile {
  left: calc(50% - 60px);
  top: 80px;
  transform: rotate(12deg);
}

.deco-clover2 {
  left: calc(50% + 0px);
  top: 140px;
  transform: rotate(15deg);
}

/* 퀴즈 화면 */
.quiz-play-screen {
  padding-top: 20px;
}

.quiz-score-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  font-weight: 700;
  color: #fff;
  font-size: 1rem;
}

.quiz-score-num {
  font-size: 1.3rem;
  font-weight: 900;
  color: #FFE600;
  text-shadow: none;
}

.quiz-photo-box {
  background: #fff;
  border-radius: 20px;
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 320px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  overflow: hidden;
  position: relative;
}

.quiz-photo-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.quiz-photo-placeholder {
  font-size: 4rem;
  color: #ccc;
}

.quiz-feedback {
  font-size: 3rem;
  height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.quiz-buttons {
  display: flex;
  gap: 14px;
  margin-top: 8px;
}

.btn-quiz-answer {
  flex: 1;
  background: #fff;
  color: #333;
  border: none;
  border-radius: 14px;
  padding: 18px 8px;
  font-size: 1.15rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0,0,0,0.1);
  transition: transform 0.1s, background 0.15s;
  font-family: inherit;
}

.btn-quiz-answer:hover:not(:disabled) {
  transform: translateY(-2px);
  background: #f0f0f0;
}

.btn-quiz-answer:disabled {
  cursor: default;
  opacity: 0.7;
}

.btn-quiz-answer.correct {
  background: #c8f5c8;
  color: #2a7a2a;
}

.btn-quiz-answer.wrong {
  background: #ffd6d6;
  color: #a00;
}

/* 결과 화면 */
.quiz-result-screen {
  padding-top: 80px;
}

.quiz-result-title {
  font-size: 1.6rem;
  font-weight: 900;
  color: #FFE600;
  text-shadow: none;
  margin-bottom: 16px;
}

.quiz-result-score {
  font-size: 3.5rem;
  font-weight: 900;
  color: #fff;
  margin-bottom: 8px;
}

.quiz-result-msg {
  font-size: 1rem;
  color: #fff;
  margin-bottom: 20px;
  opacity: 0.85;
}

.quiz-ranking-box {
  background: rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 14px 20px;
  margin-bottom: 24px;
  min-width: 220px;
  max-width: 320px;
  width: 100%;
}

.quiz-ranking-title {
  font-size: 1rem;
  font-weight: 700;
  color: #FFE600;
  margin-bottom: 10px;
}

.quiz-ranking-list {
  list-style: none;
  padding: 0;
  margin: 0;
  color: #fff;
  font-size: 0.95rem;
}

.quiz-ranking-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.quiz-ranking-list li:last-child { border-bottom: none; }

.rank-num {
  font-weight: 700;
  color: #FFE600;
  min-width: 18px;
  text-align: right;
}

.rank-score {
  margin-left: auto;
  opacity: 0.8;
}

.btn-quiz-retry {
  background: #FFE600;
  color: #333;
  border: none;
  border-radius: 14px;
  padding: 14px 36px;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 1px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.15);
  transition: transform 0.12s;
  font-family: inherit;
}

.btn-quiz-retry:hover {
  transform: translateY(-2px);
}

.hidden { display: none; }

/* ── 나눔 바구니 안내 ── */
.basket-notice {
  max-width: 600px;
  margin: 0 auto 8px;
  padding: 10px 16px;
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: #1a6b1a;
}

/* ── 월간 배지 ── */
.monthly-badge {
  max-width: 600px;
  margin: 0 auto 12px;
  padding: 12px 18px;
  background: #fff;
  border-radius: 14px;
  text-align: center;
  font-weight: 700;
  font-size: 1rem;
  color: #333;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.badge-smile {
  font-size: 1.4rem;
  vertical-align: middle;
  margin-right: 4px;
}

/* ── 게시물 목록 ── */
.posts-container {
  padding: 10px 16px 80px;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.post-card {
  background: #fff;
  border-radius: 16px;
  padding: 16px 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  min-height: 180px;
  display: flex;
  flex-direction: column;
  font-family: 'Jua', '맑은 고딕', sans-serif;
}

.post-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.post-author {
  font-weight: 700;
  font-size: 1rem;
  color: #444;
}

.post-date {
  font-size: 0.78rem;
  color: #aaa;
  flex-shrink: 0;
  margin-left: 8px;
}

.post-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: #222;
}

.post-content {
  font-size: 0.95rem;
  color: #555;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
}

.post-category {
  display: inline-block;
  background: #eee;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 0.8rem;
  color: #666;
  margin-top: 6px;
}

.post-image {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: 10px;
  margin: 8px 0;
}

.post-usage {
  font-size: 0.82rem;
  color: #888;
  margin-top: 4px;
}

.btn-admin-delete {
  background: #ff4d4d;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 3px 10px;
  font-size: 0.8rem;
  cursor: pointer;
  margin-top: 4px;
}

.btn-admin-delete:hover { background: #d43; }

/* ── 댓글 ── */
.comments-section {
  margin-top: 12px;
  border-top: 1px solid #eee;
  padding-top: 10px;
}

.comment-item {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
  align-items: flex-start;
}

.comment-author {
  font-weight: 700;
  font-size: 0.85rem;
  color: #555;
  flex-shrink: 0;
}

.comment-content {
  font-size: 0.85rem;
  color: #444;
  flex: 1;
  word-break: break-all;
}

.comment-date {
  font-size: 0.73rem;
  color: #bbb;
  flex-shrink: 0;
}

.comment-form {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.comment-input {
  flex: 1;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.9rem;
  font-family: inherit;
}

.comment-input:focus {
  outline: none;
  border-color: #7ed97e;
}

.btn-comment-submit {
  background: #7ed97e;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.9rem;
  cursor: pointer;
  font-weight: 700;
}

.btn-comment-submit:hover { background: #5bc45b; }

/* ── 모달 ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-overlay.hidden { display: none; }

.modal-box {
  background: #fff;
  border-radius: 20px;
  padding: 28px 24px;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 18px;
  color: #333;
  text-align: center;
}

.modal-preview-name {
  font-size: 1rem;
  font-weight: 700;
  color: #5bc45b;
  margin-bottom: 12px;
  min-height: 1.4em;
  text-align: center;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 5px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  border: 1.5px solid #ddd;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: #7ed97e;
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.image-preview {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 10px;
  margin-top: 8px;
  display: none;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.btn-submit {
  flex: 1;
  background: #7ed97e;
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 12px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-submit:hover { background: #5bc45b; }

.btn-cancel {
  flex: 1;
  background: #eee;
  color: #555;
  border: none;
  border-radius: 12px;
  padding: 12px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-cancel:hover { background: #ddd; }

/* ── 로그인/회원가입 ── */
.auth-container {
  max-width: 380px;
  margin: 40px auto;
  padding: 0 20px;
}

.auth-box {
  background: #fff;
  border-radius: 20px;
  padding: 32px 28px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.auth-title {
  font-size: 1.4rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 24px;
  color: #333;
}

.auth-link {
  text-align: center;
  margin-top: 16px;
  font-size: 0.9rem;
  color: #666;
}

.auth-link a {
  color: #5bc45b;
  font-weight: 700;
  text-decoration: none;
}

.auth-link a:hover { text-decoration: underline; }

.error-msg {
  background: #fff0f0;
  color: #d43;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.88rem;
  margin-bottom: 12px;
  display: none;
}

/* ── 관리자 페이지 ── */
.admin-container {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 16px 60px;
}

.admin-section {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.admin-section-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #333;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid #eee;
}

.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #f5f5f5;
  gap: 8px;
}

.user-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.badge-admin {
  background: #5bc45b;
  color: #fff;
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 0.75rem;
}

.badge-restricted {
  background: #ff4d4d;
  color: #fff;
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 0.75rem;
}

.btn-restrict {
  border: 1.5px solid #ff4d4d;
  color: #ff4d4d;
  background: none;
  border-radius: 8px;
  padding: 3px 10px;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
}

.btn-restrict.is-restricted {
  border-color: #5bc45b;
  color: #5bc45b;
}

.btn-restrict:hover {
  background: #fff0f0;
}

.btn-restrict.is-restricted:hover {
  background: #f0fff0;
}

.admin-post-item {
  padding: 8px 0;
  border-bottom: 1px solid #f5f5f5;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.admin-post-info {
  flex: 1;
  font-size: 0.88rem;
  color: #555;
  line-height: 1.5;
  word-break: break-all;
}

.board-badge {
  display: inline-block;
  border-radius: 8px;
  padding: 1px 7px;
  font-size: 0.75rem;
  font-weight: 700;
  margin-right: 4px;
}

.board-today   { background: #ffd6e8; color: #c03080; }
.board-contents { background: #d6efff; color: #1a6faa; }
.board-basket  { background: #ffe9cc; color: #c06a10; }

/* ── 네비게이션 바 ── */
.nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: rgba(255,255,255,0.25);
  font-size: 0.85rem;
}

.nav-user {
  font-weight: 700;
  color: #333;
}

.nav-btn {
  background: #fff;
  border: 1.5px solid #ccc;
  border-radius: 8px;
  padding: 4px 12px;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
  color: #555;
}

.nav-btn:hover { background: #f5f5f5; }

.nav-btn.admin { border-color: #5bc45b; color: #5bc45b; font-weight: 700; }

/* ── 빈 상태 ── */
.empty-msg {
  text-align: center;
  color: #888;
  padding: 40px 0;
  font-size: 0.95rem;
}

/* ── 로딩 ── */
.loading {
  text-align: center;
  color: #aaa;
  padding: 20px;
}

/* ── 가짜 이름 퀴즈 ── */
.quiz-start-buttons {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  margin-bottom: 0;
}

.btn-fake-quiz {
  background: #fff;
  color: #2a7a2a;
  border: 2.5px solid #FFE600;
}

.btn-fake-quiz:hover {
  background: #fffbe6;
}

.fake-level-label {
  font-size: 1.2rem;
  font-weight: 900;
  color: #FFE600;
}

.fake-timer-label {
  font-size: 1.3rem;
  font-weight: 900;
  color: #fff;
  min-width: 2ch;
  text-align: right;
}

.fake-timer-bar-wrap {
  width: 100%;
  height: 8px;
  background: rgba(255,255,255,0.3);
  border-radius: 4px;
  margin-bottom: 14px;
  overflow: hidden;
}

.fake-timer-bar {
  height: 100%;
  width: 100%;
  background: #4caf50;
  border-radius: 4px;
  transition: width 0.9s linear, background 0.3s;
}

.fake-instruction {
  font-size: 0.95rem;
  color: #fff;
  margin-bottom: 16px;
  opacity: 0.9;
}

.fake-name-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 12px;
}

.fake-name-chip {
  background: #fff;
  color: #333;
  border: 2px solid transparent;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.1s, background 0.15s, border-color 0.15s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.fake-name-chip:hover {
  transform: translateY(-2px);
  background: #f0f8f0;
}

.fake-name-chip.selected {
  border-color: #FFE600;
  background: #fffbe6;
  transform: translateY(-2px);
}

.fake-name-chip.fake-correct {
  background: #c8f5c8;
  color: #2a7a2a;
  border-color: #4caf50;
}

.fake-name-chip.fake-wrong {
  background: #ffd6d6;
  color: #a00;
  border-color: #ff4d4d;
}

/* 반응형 */
@media (max-width: 480px) {
  .home-title { font-size: 2.6rem; }
  .page-title { font-size: 1.5rem; }
}
