* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Segoe UI",
    sans-serif;
  background-color: #fafafa;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: #111;
}

/* ── Nav Bar ── */
header {
  background: #000;
}

header nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  height: 56px;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-logo {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.nav-link {
  color: #ccc;
  text-decoration: none;
  font-size: 0.9rem;
}

.nav-link:hover {
  color: #fff;
}

.nav-right {
  display: flex;
  align-items: center;
}

.btn-create {
  display: inline-block;
  background: #fff;
  color: #000;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 8px 20px;
  border-radius: 999px;
  transition: background 0.15s, color 0.15s;
}

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

/* ── Layout ── */
.container {
  display: flex;
  flex: 1;
}

.ad-side {
  flex: 1;
  background-color: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #aaa;
  font-size: 0.85rem;
  border-left: 1px solid #e5e5e5;
  border-right: 1px solid #e5e5e5;
}

.main-content {
  flex: 2;
  max-width: 600px;
  padding: 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  align-self: flex-start;
  min-height: calc(100vh - 56px);
}

/* ── Vote Paper ── */
.vote-paper {
  background: #fff;
  width: 100%;
  padding: 2rem;
  border-radius: 4px;
  border: 1px solid #222;
  text-align: center;
}

.vote-paper h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-top: 0;
}

/* ── Vote Option Display (non-interactive, for /vote/:id page) ── */
.vote-option-display {
  display: block;
  width: 100%;
  padding: 14px;
  margin: 10px 0;
  background: #fff;
  border: 1px solid #222;
  color: #111;
  border-radius: 4px;
  font-size: 1rem;
  text-align: center;
  box-sizing: border-box;
}

/* ── Vote Buttons ── */
.btn-option {
  display: block;
  width: 100%;
  padding: 14px;
  margin: 10px 0;
  background: #fff;
  border: 1px solid #222;
  color: #111;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-option:hover {
  background: #111;
  color: #fff;
}

.btn-skip {
  margin-top: 20px;
  background: #fff;
  color: #555;
  border: 1px solid #999;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.15s, color 0.15s;
}

.btn-skip:hover {
  background: #111;
  color: #fff;
  border-color: #111;
}

/* ── Result Bars ── */
.result-bar-bg {
  background: #eee;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 16px;
  text-align: left;
}

.result-bar-fill {
  background: #222;
  height: 30px;
  line-height: 30px;
  color: #fff;
  padding-left: 10px;
  white-space: nowrap;
  font-size: 0.85rem;
}

/* 최다 득표 */
.result-bar-fill--top {
  background: #2563eb;
}

/* 내 선택 (최다 득표 아님) */
.result-bar-fill--mine {
  background: #d97706;
}

/* 내 선택 + 최다 득표 동시 */
.result-bar-fill--both {
  background: #7c3aed;
}

/* ── Result Badges ── */
.result-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  vertical-align: middle;
  line-height: 1.6;
}

.result-badge--top {
  background: #dbeafe;
  color: #1d4ed8;
}

.result-badge--mine {
  background: #fef3c7;
  color: #b45309;
}

/* ── Form Elements (create page) ── */
.vote-paper label {
  display: block;
  text-align: left;
  margin-top: 16px;
  margin-bottom: 4px;
  font-weight: 600;
  font-size: 0.9rem;
}

.vote-paper input[type="text"],
.vote-paper select {
  width: 100%;
  padding: 10px;
  margin-top: 4px;
  border: 1px solid #333;
  border-radius: 3px;
  font-size: 0.95rem;
  background: #fff;
  color: #111;
}

.vote-paper input[type="text"]:focus,
.vote-paper select:focus {
  outline: none;
  border-color: #000;
}

/* ── Option List (create page) ── */
.opt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.opt-header label {
  margin-bottom: 0;
}

.opt-count {
  font-size: 0.8rem;
  color: #888;
}

.opt-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 4px;
}

.opt-row .opt-input {
  flex: 1;
  margin-top: 0;
}

.btn-opt-remove {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 1.1rem;
  line-height: 1;
  color: #999;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn-opt-remove:hover:not(:disabled) {
  background: #fee;
  color: #c00;
  border-color: #c00;
}

.btn-opt-remove:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-opt-add {
  display: block;
  width: 100%;
  padding: 10px;
  margin-top: 8px;
  background: #fff;
  border: 1px dashed #aaa;
  border-radius: 3px;
  font-size: 0.9rem;
  color: #555;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn-opt-add:hover:not(:disabled) {
  background: #f5f5f5;
  border-color: #666;
  color: #111;
}

.btn-opt-add:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-submit {
  display: block;
  width: 100%;
  padding: 14px;
  margin-top: 24px;
  background: #111;
  color: #fff;
  border: 1px solid #111;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

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

.question-notice {
  margin-top: 8px;
  padding: 10px 12px;
  background: #fff8e1;
  border-left: 3px solid #f0a500;
  font-size: 0.85rem;
  color: #7a5500;
  line-height: 1.5;
}

/* ── Result Page Layout Override ── */
.main-content.result-layout {
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  gap: 1.5rem;
  overflow-y: auto;
}

/* ── Comment Section ── */
.comment-section {
  background: #fff;
  width: 100%;
  padding: 2rem;
  border-radius: 4px;
  border: 1px solid #222;
  box-sizing: border-box;
}

.comment-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.comment-section-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
}

.btn-comment-write {
  padding: 6px 14px;
  background: #fff;
  color: #111;
  border: 1px solid #222;
  border-radius: 3px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-comment-write:hover {
  background: #111;
  color: #fff;
}

/* ── Comment Write Form ── */
.comment-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid #e5e5e5;
  margin-bottom: 1.25rem;
}

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

.comment-form-row .input-nickname { flex: 2; }
.comment-form-row .input-password { flex: 1.5; }

.comment-form input[type="text"],
.comment-form input[type="password"],
.comment-form textarea {
  padding: 9px 10px;
  border: 1px solid #333;
  border-radius: 3px;
  font-size: 0.9rem;
  font-family: inherit;
  background: #fff;
  color: #111;
  box-sizing: border-box;
}

.comment-form input[type="text"]:focus,
.comment-form input[type="password"]:focus,
.comment-form textarea:focus {
  outline: none;
  border-color: #000;
}

.comment-form textarea {
  width: 100%;
  min-height: 72px;
  resize: vertical;
}

.comment-form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.comment-ip-notice {
  font-size: 0.75rem;
  color: #aaa;
  margin: 0;
}

.btn-comment-submit {
  padding: 9px 20px;
  background: #111;
  color: #fff;
  border: 1px solid #111;
  border-radius: 3px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.btn-comment-submit:hover { background: #333; }
.btn-comment-submit:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Comment List ── */
.comment-list {
  display: flex;
  flex-direction: column;
}

.comment-item {
  padding: 12px 0;
  border-top: 1px solid #e5e5e5;
}

.comment-item:first-child { border-top: none; }

.comment-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.comment-nickname {
  font-weight: 700;
  font-size: 0.88rem;
  color: #111;
}

.comment-date {
  font-size: 0.76rem;
  color: #bbb;
}

.comment-content {
  font-size: 0.92rem;
  line-height: 1.55;
  color: #222;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

.comment-content--deleted {
  color: #bbb;
  font-style: italic;
}

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

.btn-comment-action {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.77rem;
  color: #aaa;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.1s;
}

.btn-comment-action:hover { color: #111; }

/* ── Reply List ── */
.reply-list {
  margin-top: 8px;
  margin-left: 1.25rem;
  padding-left: 12px;
  border-left: 2px solid #ebebeb;
  display: flex;
  flex-direction: column;
}

.reply-item {
  padding: 8px 0;
  border-top: 1px solid #f2f2f2;
}

.reply-item:first-child { border-top: none; }

/* ── Inline Forms (수정·삭제·답글) ── */
.comment-inline-form {
  margin-top: 8px;
  padding: 12px;
  background: #f8f8f8;
  border: 1px solid #e5e5e5;
  border-radius: 3px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.comment-inline-form textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 0.88rem;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
  box-sizing: border-box;
}

.comment-inline-form input[type="text"],
.comment-inline-form input[type="password"] {
  padding: 7px 10px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 0.88rem;
  font-family: inherit;
  box-sizing: border-box;
}

.comment-inline-form input[type="text"]:focus,
.comment-inline-form input[type="password"]:focus,
.comment-inline-form textarea:focus {
  outline: none;
  border-color: #999;
}

.comment-inline-form-row {
  display: flex;
  gap: 8px;
}

.comment-inline-form-row input { flex: 1; }

.inline-form-buttons {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.btn-inline-confirm {
  padding: 6px 14px;
  background: #111;
  color: #fff;
  border: 1px solid #111;
  border-radius: 3px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-inline-confirm:hover { background: #333; }

.btn-inline-cancel {
  padding: 6px 14px;
  background: #fff;
  color: #555;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-inline-cancel:hover { background: #f0f0f0; }

.comment-form-error {
  font-size: 0.8rem;
  color: #c00;
  margin: 0;
}

/* ── Load More ── */
.btn-load-more {
  display: block;
  width: 100%;
  padding: 10px;
  margin-top: 12px;
  background: #fff;
  border: 1px dashed #ccc;
  border-radius: 3px;
  font-size: 0.88rem;
  color: #666;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}

.btn-load-more:hover {
  background: #f5f5f5;
  border-color: #888;
  color: #111;
}

.btn-load-more:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.comment-empty {
  text-align: center;
  color: #bbb;
  font-size: 0.88rem;
  padding: 1.5rem 0;
  margin: 0;
}

/* ── Site Intro ── */
.site-intro {
  background: #fff;
  border-top: 1px solid #e5e5e5;
  padding: 3rem 1.5rem 4rem;
}

.site-intro-inner {
  max-width: 680px;
  margin: 0 auto;
  color: #222;
  line-height: 1.8;
}

.site-intro-inner h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 2.5rem 0 0.6rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid #111;
}

.site-intro-inner h2:first-child {
  margin-top: 0;
}

.site-intro-inner h3 {
  font-size: 0.97rem;
  font-weight: 700;
  margin: 1.5rem 0 0.4rem;
  color: #333;
}

.site-intro-inner p {
  font-size: 0.93rem;
  color: #444;
  margin: 0 0 0.8rem;
}

.site-intro-inner ul {
  padding-left: 1.25rem;
  margin: 0.5rem 0 0;
}

.site-intro-inner li {
  font-size: 0.93rem;
  color: #444;
  margin-bottom: 0.5rem;
}

.site-intro-inner a {
  color: #2563eb;
  text-decoration: none;
}

.site-intro-inner a:hover {
  text-decoration: underline;
}

/* ── Footer ── */
footer {
  background: #111;
  padding: 1rem 1.5rem;
  margin-top: auto;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  font-size: 0.82rem;
}

.footer-inner span {
  color: #888;
}

.footer-inner a {
  color: #aaa;
  text-decoration: none;
}

.footer-inner a:hover {
  color: #fff;
}

/* ── Vote List Page ── */
.main-content.vote-list-layout {
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  max-width: 680px;
  min-height: auto;
  padding-top: 2rem;
  padding-bottom: 3rem;
}

.vote-list-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 0 1.25rem;
}

.vote-list-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 1.5rem;
}

.filter-btn {
  display: inline-block;
  padding: 5px 12px;
  border: 1px solid #ccc;
  border-radius: 999px;
  font-size: 0.82rem;
  color: #444;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.filter-btn:hover {
  border-color: #555;
  color: #111;
}

.filter-btn--active {
  background: #111;
  color: #fff;
  border-color: #111;
}

.vote-card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.vote-card {
  display: block;
  padding: 1rem 1.25rem;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.vote-card:hover {
  border-color: #222;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
}

.vote-card-category {
  font-size: 0.75rem;
  color: #888;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.vote-card-question {
  margin: 4px 0 6px;
  font-size: 0.97rem;
  font-weight: 600;
  color: #111;
  line-height: 1.4;
}

.vote-card-count {
  font-size: 0.78rem;
  color: #aaa;
}

.vote-list-empty {
  text-align: center;
  color: #bbb;
  font-size: 0.9rem;
  padding: 3rem 0;
}

.vote-list-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
}

.btn-page {
  display: inline-block;
  padding: 8px 20px;
  background: #fff;
  border: 1px solid #333;
  border-radius: 4px;
  font-size: 0.88rem;
  color: #111;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.btn-page:hover {
  background: #111;
  color: #fff;
}

.page-info {
  font-size: 0.85rem;
  color: #888;
}

/* ── Mobile Responsive ── */
@media (max-width: 768px) {
  body {
    height: auto;
    min-height: 100vh;
  }

  .container {
    flex-direction: column;
    height: auto;
  }

  .main-content {
    order: 1;
    max-width: 100%;
    width: 100%;
    padding: 1rem;
    align-items: stretch;
  }

  .main-content.result-layout {
    padding: 1rem;
    gap: 1rem;
  }

  .ad-side {
    order: 2;
    flex: none;
    width: 100%;
    height: 80px;
    border-left: none;
    border-right: none;
    border-top: 1px solid #e5e5e5;
  }

  .vote-paper {
    padding: 1.25rem;
  }

  /* iOS 자동 확대 방지: 입력 폰트 16px 이상 유지 */
  .vote-paper input[type="text"],
  .vote-paper select,
  .comment-form input[type="text"],
  .comment-form input[type="password"],
  .comment-form textarea,
  .comment-inline-form input[type="text"],
  .comment-inline-form input[type="password"],
  .comment-inline-form textarea {
    font-size: 1rem;
  }

  /* 닉네임 + 비밀번호 입력란 세로 정렬 */
  .comment-form-row {
    flex-direction: column;
  }

  /* 인라인 폼 행도 세로 정렬 */
  .comment-inline-form-row {
    flex-direction: column;
  }

  .comment-section {
    padding: 1.25rem;
  }

  .reply-list {
    margin-left: 0.75rem;
  }

  .site-intro {
    padding: 2rem 1rem 3rem;
  }
}
