:root {
  color-scheme: light;
  --font-cjk: "Source Han Sans SC", "Source Han Sans CN", "Noto Sans CJK SC", "Noto Sans SC", "思源黑体", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  --font-latin: Futura, "Futura PT", "Avenir Next", Avenir, Inter, system-ui, sans-serif;
  --font-display: var(--font-latin), var(--font-cjk);
  --font-ui: var(--font-latin), var(--font-cjk);
  font-family: var(--font-ui);
  background: #120f17;
  color: #f7faf7;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
}

.poll-body {
  background:
    radial-gradient(circle at 70% 18%, rgba(166, 87, 255, 0.17), transparent 25%),
    radial-gradient(circle at 22% 78%, rgba(192, 96, 66, 0.18), transparent 24%),
    linear-gradient(180deg, rgba(18, 15, 23, 0.08), rgba(18, 15, 23, 0.74) 74%, #120f17),
    #120f17;
  color: #f7faf7;
}

.poll-body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.026) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(circle at 50% 44%, black, transparent 72%);
  opacity: 0.42;
}

.brand-row {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #4b6f72;
  font-family: var(--font-latin);
  font-size: 14px;
  font-weight: 800;
}

.brand-row.compact {
  color: #d5e0dd;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 99px;
  background: #c06042;
}

.poll-toolbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px clamp(18px, 4vw, 42px);
}

.poll-toolbar h1 {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: clamp(30px, 5vw, 58px);
  line-height: 1;
  letter-spacing: 0;
  text-shadow: 0 10px 48px rgba(0, 0, 0, 0.36);
}

.shiny-title {
  display: inline-flex;
  align-items: center;
  gap: clamp(12px, 2vw, 22px);
}

.shiny-title span {
  background-image: linear-gradient(115deg, #a9a9af 0%, #a9a9af 35%, #ffffff 50%, #a9a9af 65%, #a9a9af 100%);
  background-size: 220% auto;
  background-position: 150% center;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: shiny-title-sweep 2.6s linear infinite;
}

.shiny-title span:first-child {
  font-size: 0.76em;
  animation-delay: 0.18s;
}

@keyframes shiny-title-sweep {
  0% {
    background-position: 150% center;
  }
  100% {
    background-position: -50% center;
  }
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.icon-button,
.text-button,
.ghost-button {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.105);
  color: #fff;
  cursor: pointer;
  font-family: var(--font-latin);
  text-decoration: none;
  backdrop-filter: blur(16px);
}

.icon-button {
  width: 42px;
  height: 42px;
  font-size: 20px;
}

.text-button,
.ghost-button {
  min-height: 42px;
  padding: 10px 14px;
  font-weight: 800;
}

.poll-admin-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: 18px;
  width: min(1180px, calc(100% - 32px));
  margin: 8px auto 34px;
}

.teacher-panel,
.teacher-preview,
.student-panel {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(18px);
}

.teacher-panel {
  padding: clamp(18px, 4vw, 30px);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 7px;
  color: rgba(255, 255, 255, 0.58);
  font-family: var(--font-latin);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.panel-heading h2 {
  margin: 0;
  font-size: clamp(24px, 4vw, 38px);
  line-height: 1.05;
}

.settings-form,
.field-block {
  display: grid;
  gap: 10px;
}

.settings-form {
  gap: 18px;
}

.field-block span,
.options-editor-head span {
  font-size: 14px;
  font-weight: 800;
}

.field-block input,
.field-block select,
.option-row input {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 0 14px;
  background: rgba(12, 14, 16, 0.5);
  color: #fff;
  outline: none;
}

.field-block select {
  color-scheme: dark;
}

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

.options-editor {
  display: grid;
  gap: 12px;
}

.options-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.options-editor-head small {
  color: rgba(255, 255, 255, 0.58);
}

.option-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.option-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.option-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #c06042;
  color: #fff;
  font-weight: 900;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.primary-button {
  min-height: 52px;
  border: 0;
  border-radius: 8px;
  padding: 0 24px;
  background: #c06042;
  color: #fff;
  font-family: var(--font-latin);
  font-weight: 900;
  cursor: pointer;
}

.status-text {
  min-height: 24px;
  margin: 0;
  color: rgba(255, 255, 255, 0.68);
  font-weight: 700;
}

.teacher-preview {
  align-self: start;
  display: grid;
  gap: 12px;
  padding: 20px;
}

.link-card,
.live-card {
  display: grid;
  gap: 8px;
  min-height: 94px;
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.11);
}

.link-card span,
.live-card span {
  color: rgba(255, 255, 255, 0.62);
  font-size: 13px;
  font-weight: 800;
}

.link-card a {
  overflow-wrap: anywhere;
  color: #f1d0c3;
  font-weight: 800;
}

.live-card strong {
  font-size: 42px;
  line-height: 1;
}

.student-shell {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 18px;
}

.student-panel {
  width: min(100%, 760px);
  padding: clamp(22px, 6vw, 36px);
}

.student-panel h1 {
  margin: 14px 0 24px;
  font-size: clamp(30px, 8vw, 54px);
  line-height: 1.05;
  letter-spacing: 0;
}

.student-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.vote-button {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 86px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  text-align: left;
}

.vote-button.selected {
  border-color: rgba(192, 96, 66, 0.92);
  background: rgba(192, 96, 66, 0.24);
}

.vote-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 8px;
  background: #4b6f72;
  color: #fff;
  font-size: 24px;
  font-weight: 900;
}

.vote-label {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: clamp(17px, 3vw, 22px);
  font-weight: 900;
}

.poll-results-stage {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: min(980px, calc(100% - 32px));
  min-height: calc(100vh - 130px);
  margin: 0 auto 116px;
}

.poll-results-panel {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: clamp(22px, 4vw, 42px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.07)),
    rgba(18, 15, 23, 0.72);
  color: #f7faf7;
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
}

.panel-title {
  margin: 0 0 clamp(18px, 3vw, 28px);
  color: #f7faf7;
  font-family: var(--font-latin);
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1.1;
  letter-spacing: 0;
  font-weight: 900;
}

.result-rows {
  display: grid;
  gap: 12px;
}

.result-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(64px, 92px) minmax(0, 1fr) minmax(36px, auto);
  gap: 16px;
  align-items: center;
  min-height: clamp(54px, 7vw, 72px);
  border-radius: 999px;
  padding: 0 clamp(16px, 3vw, 28px);
  color: #f7faf7;
  background: rgba(255, 255, 255, 0.105);
  border: 1px solid rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.result-row::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: var(--result-color, #4d9bff);
  box-shadow: 0 12px 30px color-mix(in srgb, var(--result-color, #4d9bff), transparent 62%);
  transition: width 240ms ease;
}

.result-row.has-votes::before {
  width: var(--result-width, 0%);
}

.result-percent,
.result-label,
.result-count {
  position: relative;
  z-index: 1;
  font-size: clamp(19px, 3vw, 30px);
  line-height: 1.1;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.22);
}

.result-percent,
.result-count {
  font-family: var(--font-latin);
  font-weight: 900;
}

.result-label {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 600;
}

.total-votes {
  margin: clamp(18px, 3vw, 30px) 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-family: var(--font-latin);
  font-size: clamp(22px, 3vw, 32px);
  font-weight: 900;
}

.display-page-links {
  position: fixed;
  left: 50%;
  bottom: clamp(12px, 3vw, 24px);
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  width: min(94vw, 920px);
  padding: 8px 10px;
  border: 0;
  background: transparent;
  box-shadow: none;
  transform: translateX(-50%);
  backdrop-filter: none;
}

.display-page-link-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.display-page-link-item a {
  padding: 5px 2px;
  color: rgba(255, 255, 255, 0.78);
  font-family: var(--font-latin);
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.display-page-link-item a:hover {
  color: #ffffff;
}

.display-qr-trigger,
.dialog-close {
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.84);
  font-family: var(--font-latin);
  font-weight: 950;
  cursor: pointer;
}

.display-qr-trigger {
  min-width: 30px;
  height: 30px;
  padding: 0 7px;
  font-size: 11px;
}

.dialog-close {
  float: right;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.09);
  font-size: 18px;
}

.display-qr-trigger:hover,
.dialog-close:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.qr-dialog {
  width: min(92vw, 380px);
  border: 0;
  border-radius: 8px;
  padding: 28px;
  background: #18131f;
  color: #f7f2ff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 30px 120px rgba(0, 0, 0, 0.5);
}

.qr-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.qr-dialog img {
  display: block;
  width: 100%;
  max-width: 260px;
  margin: 12px auto;
  border-radius: 8px;
  background: #fff;
}

.qr-dialog p {
  overflow-wrap: anywhere;
  text-align: center;
  color: rgba(255, 255, 255, 0.72);
}

@media (max-width: 880px) {
  .poll-admin-shell {
    grid-template-columns: 1fr;
  }

  .teacher-preview {
    align-self: stretch;
  }
}

@media (max-width: 640px) {
  .poll-toolbar {
    align-items: flex-start;
  }

  .settings-grid,
  .option-list,
  .student-options {
    grid-template-columns: 1fr;
  }

  .poll-results-stage {
    width: min(100% - 20px, 980px);
    min-height: calc(100vh - 118px);
  }

  .poll-results-panel {
    padding: 20px 14px;
  }

  .result-row {
    grid-template-columns: 62px minmax(0, 1fr) 28px;
    gap: 8px;
    padding: 0 14px;
  }

  .display-page-links {
    gap: 8px;
    padding: 8px;
  }

  .display-page-link-item a {
    font-size: 12px;
  }

  .display-qr-trigger {
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
  }
}
