:root {
  color-scheme: dark;
  --bg: #07111f;
  --card: rgba(9, 20, 38, 0.88);
  --line: rgba(148, 163, 184, 0.18);
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #7c3aed;
  --accent-2: #ec4899;
  --good: #22c55e;
  --warn: #f59e0b;
}
* { box-sizing: border-box; }
.hidden { display: none !important; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Pretendard', sans-serif;
  background:
    radial-gradient(circle at top, rgba(124, 58, 237, 0.25), transparent 30%),
    radial-gradient(circle at right top, rgba(236, 72, 153, 0.16), transparent 22%),
    var(--bg);
  color: var(--text);
}
.layout {
  width: min(1480px, calc(100% - 32px));
  margin: 32px auto 56px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
  height: 100%;
}
.hero {
  display: grid;
  gap: 20px;
}
.hero-main {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
}
.eyebrow {
  margin: 0 0 10px;
  color: #c4b5fd;
  letter-spacing: 0.12em;
  font-weight: 700;
  font-size: 0.82rem;
}
h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); margin-bottom: 12px; }
.hero-copy { color: var(--muted); line-height: 1.7; margin-bottom: 0; }
.hero-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 14px;
  min-width: 320px;
}
.hero-meta div {
  background: rgba(15, 23, 42, 0.68);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
}
.hero-meta span { display: block; color: var(--muted); font-size: 0.84rem; margin-bottom: 8px; }
.hero-meta strong { font-size: 1.5rem; }
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
  align-items: stretch;
}
.bottom-grid {
  margin-top: 20px;
}
.full-width-card {
  width: 100%;
}
.candidate-toolbar {
  margin-bottom: 16px;
}
.candidate-search-input {
  width: min(100%, 360px);
  border: 1px solid var(--line);
  background: rgba(15, 23, 42, 0.82);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
}
.empty-search-result {
  border: 1px dashed var(--line);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
}
.section-head { display: flex; justify-content: space-between; gap: 16px; align-items: end; margin-bottom: 18px; }
.section-head p { color: var(--muted); margin-bottom: 0; }
.monthly-section-head {
  align-items: center;
}
.month-select {
  min-width: 130px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.82);
  color: var(--text);
  font: inherit;
}
.idol-list, .ranking-list {
  display: grid;
  gap: 14px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.idol-list {
  grid-template-columns: 1fr;
  align-items: start;
}
.idol-group-section {
  display: grid;
  gap: 12px;
}
.idol-group-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #ddd6fe;
  padding-left: 4px;
}
.idol-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.idol-item, .ranking-item {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  background: rgba(15, 23, 42, 0.52);
}
.idol-item {
  padding: 14px;
}
.square-card {
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}
.square-card-ranks {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  min-height: 44px;
  align-content: start;
}
.mini-rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 19px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  color: #ddd6fe;
  background: rgba(124, 58, 237, 0.2);
  border: 1px solid rgba(124, 58, 237, 0.28);
  white-space: nowrap;
}
.mini-rank-badge.secondary {
  color: #fbcfe8;
  background: rgba(236, 72, 153, 0.16);
  border-color: rgba(236, 72, 153, 0.24);
}
.square-card-image-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(15, 23, 42, 0.68);
}
.square-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.square-card-text {
  min-width: 0;
}
.square-card .idol-name {
  font-size: 0.95rem;
  line-height: 1.25;
  word-break: keep-all;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.square-card .idol-group {
  font-size: 0.8rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.square-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.pending-change-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  color: #fde68a;
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(245, 158, 11, 0.24);
  white-space: nowrap;
}
.change-image-button {
  border: 1px solid var(--line);
  background: rgba(15, 23, 42, 0.82);
  color: var(--text);
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}
.change-image-button:hover {
  border-color: rgba(124, 58, 237, 0.55);
}
.vote-card {
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.vote-card:hover {
  transform: translateY(-2px);
  border-color: rgba(124, 58, 237, 0.55);
  box-shadow: 0 12px 28px rgba(0,0,0,0.22);
}
.vote-card:focus-visible {
  outline: 2px solid rgba(124, 58, 237, 0.85);
  outline-offset: 2px;
}
.vote-card.disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.idol-top, .ranking-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.idol-top {
  align-items: flex-start;
}
.idol-profile { display: flex; align-items: center; gap: 12px; min-width: 0; }
.idol-visual {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(15, 23, 42, 0.68);
  flex: 0 0 auto;
}
.idol-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.idol-name, .ranking-name { font-size: 1.05rem; font-weight: 700; }
.idol-item .idol-name {
  font-size: 0.96rem;
  line-height: 1.25;
}
.idol-item .idol-group {
  font-size: 0.82rem;
}
.idol-group { color: var(--muted); font-size: 0.92rem; margin-top: 4px; }
.vote-button {
  border: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
}
.vote-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.progress {
  margin-top: 14px;
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.16);
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.ranking-item strong { font-size: 1.2rem; }
.ranking-progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ranking-progress-row .progress {
  flex: 1;
}
.ranking-metric {
  flex: 0 0 auto;
  white-space: nowrap;
}
.ranking-item .ranking-top {
  align-items: center;
}
.ranking-item .idol-profile {
  min-width: 0;
  flex: 1;
}
.ranking-item .ranking-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rank-crown {
  display: inline-block;
  margin-right: 6px;
}
.rank-1 {
  border-color: rgba(250, 204, 21, 0.45);
}
.rank-2 {
  border-color: rgba(203, 213, 225, 0.4);
}
.rank-3 {
  border-color: rgba(251, 146, 60, 0.38);
}
.ranking-item .idol-group {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ranking-item .progress {
  margin-top: 10px;
}
.badge {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}
.badge.good { background: rgba(34, 197, 94, 0.16); color: #86efac; }
.badge.warn { background: rgba(245, 158, 11, 0.16); color: #fcd34d; }
.notes { margin-top: 20px; }
.notes ul { margin-bottom: 0; color: var(--muted); line-height: 1.7; }
.admin-layout { margin-top: 40px; }
.admin-grid { margin-top: 20px; }
.admin-form {
  display: grid;
  gap: 14px;
}
.admin-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.95rem;
}
.admin-review-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}
.admin-section-title {
  margin-bottom: 12px;
  font-size: 0.95rem;
  font-weight: 800;
  color: #ddd6fe;
}
.candidate-review-list .review-card h2 {
  font-size: 1.05rem;
  margin-bottom: 4px;
}
.candidate-review-list .review-card p {
  font-size: 0.85rem;
}
.candidate-review-list .review-actions .vote-button {
  padding: 10px 14px;
}
.review-list {
  display: grid;
  gap: 16px;
}
.review-card {
  padding: 16px;
}
.review-compare {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.single-review-image {
  grid-template-columns: minmax(0, 220px);
}
.review-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--line);
}
.review-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}
.reject-button {
  background: linear-gradient(135deg, #475569, #334155);
}
.field-feedback {
  min-height: 1em;
  font-size: 0.82rem;
  color: var(--muted);
}
.field-feedback.error {
  color: #fca5a5;
}
.field-feedback.ok {
  color: #86efac;
}
.image-preview-box {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.52);
  padding: 12px;
}
.image-preview {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 14px;
  display: block;
  background: rgba(15, 23, 42, 0.68);
}
.admin-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  background: rgba(15, 23, 42, 0.52);
  color: var(--text);
  outline: none;
}
.admin-form input:focus {
  border-color: rgba(124, 58, 237, 0.7);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}
.notes a {
  color: #c4b5fd;
}
.modal-trigger {
  width: 100%;
  justify-content: center;
}
.hero-register-button {
  align-self: flex-start;
  white-space: nowrap;
}
.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(2, 6, 23, 0.72);
  z-index: 50;
}
.modal.open {
  display: flex;
}
.modal-panel {
  width: min(100%, 440px);
  max-height: 82vh;
  overflow: auto;
  padding: 20px;
}
.modal-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
}
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  padding: 14px 18px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--line);
  box-shadow: 0 18px 50px rgba(0,0,0,0.35);
}
@media (min-width: 1500px) {
  .idol-group-grid { grid-template-columns: repeat(10, minmax(0, 1fr)); }
}

@media (max-width: 1200px) {
  .idol-group-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .hero-main, .section-head { display: block; }
  .hero-meta { margin-top: 0; min-width: 0; }
  .hero-register-button { margin-top: 16px; width: 100%; }
  .grid { grid-template-columns: 1fr; }
  .idol-group-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .idol-group-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ranking-progress-row {
    gap: 8px;
  }
  .ranking-metric {
    font-size: 0.9rem;
  }
  .mini-rank-badge {
    font-size: 0.62rem;
    padding: 3px 6px;
  }
}
