@font-face {
  font-family: 'HakgyoansimNadeuriTTF-B';
  src: url('https://fastly.jsdelivr.net/gh/projectnoonnu/2408-5@1.0/HakgyoansimNadeuriTTF-B.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
}

:root {
  --my-bg-a: #fff7ec;
  --my-bg-b: #eef8ff;
  --my-bg-c: #f8f0ff;
  --my-ink: #253044;
  --my-muted: #6b7280;
  --my-card: rgba(255,255,255,0.74);
  --my-line: rgba(120,144,180,0.22);
  --my-pink: #ff8fc7;
  --my-blue: #8bd7ff;
  --my-violet: #c7b7ff;
  --my-shadow: 0 18px 42px rgba(94,120,160,0.16);
  --danger: #ff6b83;
  --ok: #45b8a9;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { overflow-x: hidden; }
button, input { font: inherit; }
button { cursor: pointer; border: 0; }
button:disabled { cursor: not-allowed; opacity: 0.45; transform: none !important; }

body.mygame-soft {
  min-height: 100vh;
  margin: 0;
  color: var(--my-ink);
  font-family: 'HakgyoansimNadeuriTTF-B', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 211, 235, 0.62), transparent 34%),
    radial-gradient(circle at 88% 10%, rgba(139, 215, 255, 0.48), transparent 32%),
    radial-gradient(circle at 50% 100%, rgba(199, 183, 255, 0.34), transparent 36%),
    linear-gradient(135deg, var(--my-bg-a) 0%, var(--my-bg-b) 48%, var(--my-bg-c) 100%);
}

.mygame-topnav {
  position: relative;
  z-index: 20;
  width: min(1180px, calc(100% - 32px));
  margin: 18px auto 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.mygame-home,
.mygame-date {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 13px;
  border: 1px solid var(--my-line);
  border-radius: 999px;
  background: rgba(255,255,255,0.72);
  box-shadow: 0 8px 22px rgba(94,120,160,0.12);
  color: var(--my-ink);
  font-size: 0.86rem;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.mygame-date { color: var(--my-muted); }
.mygame-home:hover { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(94,120,160,0.16); }

.mygame-page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.mygame-card {
  border: 1px solid var(--my-line);
  border-radius: 26px;
  background: var(--my-card);
  box-shadow: var(--my-shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.55fr);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
}

.hero-main {
  position: relative;
  overflow: hidden;
  padding: clamp(24px, 5vw, 46px);
}

.hero-main::after {
  content: "";
  position: absolute;
  right: -70px;
  top: -85px;
  width: 240px;
  height: 240px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255,143,199,0.42), rgba(139,215,255,0.38));
}

.eyebrow,
.mini-pill,
.badge {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.68);
  border: 1px solid var(--my-line);
  color: var(--my-muted);
  font-size: 0.85rem;
  line-height: 1;
}

.eyebrow { margin-bottom: 14px; }

h1, h2, h3 { color: #172033; }
h1 {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: clamp(2.6rem, 8vw, 5.8rem);
  line-height: 0.9;
  letter-spacing: -0.06em;
}

.subtitle,
.section-head p,
.notice-box p,
.modal-card p {
  color: var(--my-muted);
  line-height: 1.68;
}

.subtitle {
  position: relative;
  z-index: 1;
  margin: 16px 0 0;
  font-size: clamp(0.95rem, 2vw, 1.08rem);
}

.side-note {
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
}

.side-note .value {
  font-size: clamp(1.25rem, 3.2vw, 1.85rem);
  line-height: 1.32;
  letter-spacing: -0.04em;
}

.side-note .label {
  color: var(--my-muted);
  font-size: 0.95rem;
  line-height: 1.9;
}

.hero-actions,
.setup-actions,
.booth-actions,
.count-buttons,
.modal-actions,
.count-actions-top,
.lobby-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-actions { position: relative; z-index: 1; margin-top: 24px; }

.primary-btn,
.secondary-btn,
.ghost-btn,
.danger-btn {
  min-height: 42px;
  padding: 11px 16px;
  border-radius: 14px;
  transition: transform 160ms ease, filter 160ms ease, box-shadow 160ms ease;
  font-size: 0.95rem;
}

.primary-btn {
  background: linear-gradient(135deg, var(--my-pink), #ff74ba);
  color: #fff;
  box-shadow: 0 12px 28px rgba(255,116,186,0.22);
}

.secondary-btn {
  background: linear-gradient(135deg, var(--my-blue), #74bfff);
  color: #fff;
  box-shadow: 0 12px 28px rgba(116,191,255,0.2);
}

.ghost-btn {
  background: rgba(255,255,255,0.78);
  color: var(--my-ink);
  border: 1px solid var(--my-line);
}

.danger-btn {
  background: rgba(255,107,131,0.13);
  color: #bf3e56;
  border: 1px solid rgba(255,107,131,0.24);
}

.primary-btn:hover,
.secondary-btn:hover,
.ghost-btn:hover,
.danger-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.02);
}

.large-btn {
  min-height: 56px;
  font-size: 1.05rem;
  flex: 1 1 180px;
}

.setup-card,
.lobby-card,
.booth-card,
.count-card {
  padding: clamp(18px, 3vw, 28px);
  margin-top: 18px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-head h2 {
  margin: 12px 0 6px;
  font-size: clamp(1.45rem, 3vw, 2.1rem);
  letter-spacing: -0.04em;
}

.section-head p { margin: 0; }

.setup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--my-muted);
  font-size: 0.9rem;
}

.field.grow { flex: 1 1 240px; }

.field input,
.modal-card input {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid var(--my-line);
  border-radius: 15px;
  outline: none;
  background: rgba(255,255,255,0.82);
  color: var(--my-ink);
}

.field input:focus,
.modal-card input:focus {
  border-color: rgba(255,143,199,0.58);
  box-shadow: 0 0 0 4px rgba(255,143,199,0.12);
}

.field small { color: #8a91a1; }

.candidate-editor {
  border: 1px dashed var(--my-line);
  border-radius: 22px;
  padding: 16px;
  background: rgba(255,255,255,0.34);
}

.candidate-input-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.candidate-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.candidate-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid var(--my-line);
  background: rgba(255,255,255,0.68);
}

.candidate-chip button {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(255,107,131,0.12);
  color: #bf3e56;
}

.setup-actions { margin-top: 16px; }

.lobby-head { align-items: center; }

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(80px, 1fr));
  gap: 10px;
  min-width: min(100%, 330px);
}

.status-box {
  padding: 13px;
  border-radius: 18px;
  border: 1px solid var(--my-line);
  background: rgba(255,255,255,0.62);
  text-align: center;
}

.status-box strong {
  display: block;
  font-size: 1.35rem;
  color: #172033;
}

.status-box span {
  color: var(--my-muted);
  font-size: 0.82rem;
}

.voting-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(240px, 0.65fr);
  gap: 18px;
  align-items: stretch;
}

.printer-area {
  min-height: 360px;
  border-radius: 24px;
  border: 1px solid var(--my-line);
  background: rgba(255,255,255,0.40);
  display: grid;
  place-items: center;
  padding: 22px;
  position: relative;
  overflow: hidden;
}

.printer-area::before {
  content: "";
  position: absolute;
  width: 330px;
  height: 330px;
  border-radius: 50%;
  background: rgba(139,215,255,0.18);
  right: -70px;
  bottom: -120px;
}

.printer {
  position: relative;
  width: min(360px, 88vw);
  height: 260px;
  z-index: 1;
}

.printer-top {
  position: absolute;
  left: 52px;
  top: 38px;
  width: 256px;
  height: 54px;
  border-radius: 18px 18px 6px 6px;
  background: rgba(255,255,255,0.78);
  border: 1px solid var(--my-line);
  box-shadow: 0 12px 26px rgba(94,120,160,0.14);
}

.printer-body {
  position: absolute;
  left: 24px;
  top: 82px;
  width: 312px;
  height: 116px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(239,246,255,0.90));
  border: 1px solid rgba(120,144,180,0.28);
  box-shadow: 0 18px 36px rgba(94,120,160,0.20);
}

.printer-light {
  position: absolute;
  right: 32px;
  top: 26px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #cbd5e1;
  box-shadow: 0 0 0 6px rgba(203,213,225,0.18);
}

.printer.printing .printer-light {
  background: #45b8a9;
  box-shadow: 0 0 0 6px rgba(69,184,169,0.17), 0 0 18px rgba(69,184,169,0.55);
}

.printer-slot {
  position: absolute;
  left: 35px;
  bottom: 28px;
  width: 242px;
  height: 13px;
  border-radius: 999px;
  background: rgba(37,48,68,0.18);
}

.printed-paper {
  position: absolute;
  left: 74px;
  top: 126px;
  width: 212px;
  height: 132px;
  padding: 18px;
  border-radius: 0 0 14px 14px;
  background: #fffdf7;
  border: 1px solid rgba(120,144,180,0.20);
  box-shadow: 0 16px 28px rgba(94,120,160,0.14);
  transform: translateY(-88px);
  opacity: 0;
}

.printed-paper.show {
  animation: paperOut 860ms ease forwards;
}

@keyframes paperOut {
  0% { transform: translateY(-88px); opacity: 0; }
  35% { opacity: 1; }
  100% { transform: translateY(74px); opacity: 1; }
}

.paper-title { text-align: center; font-size: 1.2rem; color: #172033; }
.paper-line { height: 10px; margin-top: 14px; border-radius: 999px; background: rgba(120,144,180,0.20); }
.paper-line.short { width: 70%; margin-inline: auto; }
.paper-stamp-guide { margin-top: 14px; text-align: center; color: #ff4f9d; font-size: 0.78rem; }

.print-message {
  position: absolute;
  left: 22px;
  bottom: 18px;
  z-index: 2;
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.72);
  color: var(--my-muted);
  border: 1px solid var(--my-line);
  font-size: 0.86rem;
}

.lobby-actions {
  flex-direction: column;
  padding: 18px;
  border-radius: 24px;
  background: rgba(255,255,255,0.34);
  border: 1px solid var(--my-line);
}

.notice-box {
  margin-top: 18px;
  padding: 15px 17px;
  border-radius: 20px;
  border: 1px dashed var(--my-line);
  background: rgba(255,255,255,0.48);
}

.notice-box p { margin: 8px 0 0; }

.booth-badge {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.68);
  border: 1px solid var(--my-line);
  color: var(--my-muted);
}

.ballot-sheet {
  display: grid;
  gap: 12px;
  padding: clamp(16px, 3vw, 24px);
  border-radius: 24px;
  background: #fffdf7;
  border: 1px solid rgba(120,144,180,0.24);
  box-shadow: inset 0 0 0 6px rgba(255,143,199,0.06);
}

.ballot-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 118px;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 12px;
  border: 1px solid rgba(120,144,180,0.18);
  border-radius: 18px;
  background: rgba(255,255,255,0.74);
  transition: transform 140ms ease, border-color 140ms ease;
}

.ballot-row.selected {
  border-color: rgba(255,79,157,0.5);
  transform: translateY(-1px);
}

.ballot-num {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(139,215,255,0.18);
  color: #387199;
}

.ballot-name { font-size: 1.18rem; color: #172033; }

.stamp-zone {
  height: 52px;
  display: grid;
  place-items: center;
  border: 2px dashed rgba(255,143,199,0.46);
  border-radius: 14px;
  color: rgba(255,79,157,0.55);
  position: relative;
  overflow: hidden;
}

.stamp-zone.has-stamp::after {
  content: "투표";
  position: absolute;
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 5px solid rgba(244,63,94,0.78);
  color: rgba(244,63,94,0.86);
  font-size: 1.35rem;
  transform: rotate(-13deg) scale(0.82);
  animation: stampPop 220ms ease forwards;
}

@keyframes stampPop {
  from { opacity: 0; transform: rotate(-13deg) scale(1.45); }
  to { opacity: 1; transform: rotate(-13deg) scale(0.92); }
}

.booth-actions { margin-top: 16px; justify-content: flex-end; }

.count-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
  gap: 18px;
}

.count-left,
.count-right {
  border-radius: 24px;
  border: 1px solid var(--my-line);
  background: rgba(255,255,255,0.40);
  padding: 18px;
}

.count-right h3 { margin: 0 0 14px; }

.opened-ballot {
  min-height: 220px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: rgba(255,253,247,0.88);
  border: 1px solid rgba(120,144,180,0.18);
  padding: 16px;
}

.opened-empty { color: var(--my-muted); text-align: center; line-height: 1.6; }

.opened-paper {
  width: min(100%, 320px);
  padding: 22px;
  border-radius: 16px;
  background: #fffdf7;
  border: 1px solid rgba(120,144,180,0.22);
  box-shadow: 0 14px 28px rgba(94,120,160,0.12);
  text-align: center;
}

.opened-paper .paper-head { color: var(--my-muted); font-size: 0.86rem; }
.opened-paper .choice { margin-top: 14px; font-size: 1.5rem; color: #172033; }
.opened-paper .stamp { margin: 14px auto 0; width: 70px; height: 70px; display: grid; place-items: center; border: 5px solid rgba(244,63,94,0.78); color: rgba(244,63,94,0.86); border-radius: 50%; transform: rotate(-13deg); }

.count-buttons { margin-top: 14px; }

.result-board {
  display: grid;
  gap: 10px;
}

.result-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 58px;
  align-items: center;
  gap: 10px;
  padding: 11px;
  border-radius: 16px;
  background: rgba(255,255,255,0.66);
  border: 1px solid var(--my-line);
}

.rank {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: rgba(199,183,255,0.22);
  color: #6550b8;
}

.result-name { display: flex; flex-direction: column; gap: 7px; }
.result-name strong { color: #172033; }
.bar-track { height: 10px; border-radius: 999px; background: rgba(120,144,180,0.16); overflow: hidden; }
.bar { height: 100%; border-radius: inherit; background: linear-gradient(135deg, var(--my-pink), var(--my-blue)); width: 0%; transition: width 400ms ease; }
.vote-num { color: var(--my-muted); text-align: right; }
.winner-note { margin-top: 12px; padding: 12px; border-radius: 16px; background: rgba(69,184,169,0.12); color: #267a70; border: 1px solid rgba(69,184,169,0.18); line-height: 1.55; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  z-index: 100;
  max-width: min(520px, calc(100% - 32px));
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(255,255,255,0.88);
  color: var(--my-ink);
  border: 1px solid var(--my-line);
  box-shadow: 0 16px 36px rgba(94,120,160,0.18);
  transition: opacity 180ms ease, transform 180ms ease;
  text-align: center;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  background: rgba(37,48,68,0.24);
  padding: 18px;
}

.modal-card {
  width: min(420px, 100%);
  padding: 22px;
}
.modal-card h2 { margin: 0 0 8px; }
.modal-actions { margin-top: 14px; justify-content: flex-end; }

.hidden { display: none !important; }

@media (max-width: 980px) {
  .hero,
  .voting-stage,
  .count-layout { grid-template-columns: 1fr; }
  .status-grid { min-width: 0; width: 100%; }
}

@media (max-width: 640px) {
  .mygame-topnav {
    width: min(100% - 18px, 1180px);
    margin-top: 10px;
    align-items: flex-start;
    flex-direction: column;
  }
  .mygame-date, .mygame-home { font-size: 0.78rem; }
  .mygame-page { width: min(100% - 18px, 1180px); padding-top: 14px; }
  .setup-grid { grid-template-columns: 1fr; }
  .candidate-input-row { align-items: stretch; flex-direction: column; }
  .section-head,
  .lobby-head { flex-direction: column; }
  .status-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ballot-row { grid-template-columns: 34px minmax(0, 1fr); }
  .stamp-zone { grid-column: 1 / -1; }
  .count-actions-top { width: 100%; }
  .count-actions-top button { flex: 1 1 auto; }
}
