:root {
  --bg: #e3f1fa;
  --ink: #242424;
  --body: #3b3a39;
  --muted: #605e5c;
  --teal: #00798a;
  --teal-press: #00697a;
  --link: #00798a;
  --red: #a4262c;
  --line: #c8c6c4;
  --placeholder: #8a8886;
  --white: #ffffff;
  --shadow: 0 1px 3px rgba(16, 48, 58, 0.08);
  --font: "Segoe UI", "Segoe UI Web (West European)", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button, input { font-family: inherit; }

.sheet {
  width: min(390px, 100%);
  margin: 0 auto;
  padding: 42px 22px 40px;
}

.logos {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 64px;
}

.logo-china,
.logo-delight {
  display: block;
  width: auto;
  object-fit: contain;
}
.logo-china { height: 72px; max-width: 54%; }
.logo-delight { height: 68px; max-width: 44%; }

h1 {
  margin: 38px 0 0;
  font-size: 22px;
  line-height: 30px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--ink);
}

.lead {
  margin: 16px 0 0;
  color: var(--body);
  font-size: 14px;
  line-height: 20px;
}

.note {
  margin: 46px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
}

.required-legend {
  margin: 10px 0 0;
  color: var(--red);
  font-size: 14px;
  line-height: 20px;
}

.required-legend span,
.star {
  color: var(--red);
  font-weight: 700;
}

.field { margin-top: 26px; }

.field label {
  display: block;
  margin: 0 0 8px;
  font-size: 16px;
  line-height: 22px;
  font-weight: 600;
  color: var(--ink);
}

.star { margin-left: 4px; }

input[type="text"],
input[type="password"] {
  display: block;
  width: 100%;
  height: 40px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--white);
  color: var(--ink);
  font-size: 15px;
  outline: none;
  appearance: none;
}

input::placeholder { color: var(--placeholder); }

input:hover { border-color: #b3b0ad; }

input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 1px var(--teal);
}

.form-error {
  min-height: 0;
  margin: 12px 0 0;
  color: var(--red);
  font-size: 13px;
  line-height: 18px;
}

.form-error:empty { display: none; }

.submit {
  display: block;
  width: 100%;
  height: 46px;
  margin: 22px 0 0;
  border: 0;
  border-radius: 4px;
  background: var(--teal);
  color: var(--white);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.1px;
  cursor: pointer;
}

.submit:hover { background: var(--teal-press); }

.submit:focus-visible {
  outline: 2px solid #004e5a;
  outline-offset: 2px;
}

.submit:disabled {
  opacity: 0.72;
  cursor: default;
}

.view-winner {
  display: block;
  margin: 26px 0 0;
  text-align: center;
  color: var(--link);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}

.view-winner:hover { text-decoration: underline; }

.thanks-title { margin-top: 48px; }

.thanks-lead { font-size: 15px; line-height: 22px; }

body.page-winner h1 {
  margin-top: 28px;
  text-align: center;
  font-size: 20px;
  line-height: 28px;
}

.result-card {
  margin-top: 28px;
  padding: 26px 22px 24px;
  background: var(--white);
  border-radius: 14px;
  border-top: 4px solid var(--teal);
  box-shadow: 0 10px 28px rgba(0, 73, 88, 0.1);
  text-align: center;
}

.winner-kicker {
  margin: 0;
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.winner-name {
  margin: 12px 0 0;
  font-size: 36px;
  line-height: 42px;
  font-weight: 700;
  letter-spacing: -0.4px;
  overflow-wrap: anywhere;
}

.winner-org {
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px solid #e4eef2;
  color: var(--muted);
  font-size: 16px;
  line-height: 22px;
  overflow-wrap: anywhere;
}

.pending-copy {
  margin: 12px 0 4px;
  color: var(--body);
  font-size: 16px;
  line-height: 24px;
}

#announced {
  position: relative;
  display: flex;
  flex-direction: column;
  margin-top: 8px;
}

#announced.is-you #winner-card,
#announced.is-public #winner-card { order: 1; }

#announced.is-public #consolation { order: 2; }

#announced.is-other #consolation { order: 1; }

#announced.is-other #winner-card { order: 2; }

#announced.is-you .result-card,
#announced.is-public .result-card {
  border-top: 0;
  background:
    linear-gradient(#d4a24a, #d4a24a) top / 100% 4px no-repeat,
    linear-gradient(180deg, #fff8ea 0%, #ffffff 46%);
  box-shadow: 0 16px 36px rgba(140, 96, 20, 0.14);
}

#announced.is-you .winner-kicker,
#announced.is-public .winner-kicker { color: #9a6b16; }

#announced.is-you .spark,
#announced.is-public .spark { color: #d4a24a; }

#announced.is-other .spark { display: none; }

.spark {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 18px;
  line-height: 1;
}

.winner-line {
  margin: 10px 0 0;
  color: var(--body);
  font-size: 15px;
  line-height: 22px;
}

.winner-line:empty { display: none; }

.consolation {
  margin-top: 14px;
  padding: 18px 20px 16px;
  background: rgba(255, 255, 255, 0.78);
  border-radius: 14px;
  text-align: center;
}

.consolation-kicker {
  margin: 0;
  color: #3d6d78;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.consolation p {
  margin: 8px 0 0;
  color: var(--body);
  font-size: 15px;
  line-height: 22px;
}

.confetti {
  position: absolute;
  left: -12px;
  right: -12px;
  top: -8px;
  height: 230px;
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
}

.confetti i {
  position: absolute;
  top: -16px;
  width: 8px;
  height: 12px;
  opacity: 0.9;
  animation-name: confetti-fall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

#announced .result-card,
#announced .consolation { position: relative; z-index: 1; }

@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg); }
  100% { transform: translateY(240px) rotate(200deg); opacity: 0.15; }
}

@media (prefers-reduced-motion: reduce) {
  .confetti { display: none; }
}

.back-link {
  display: block;
  margin-top: 22px;
  text-align: center;
  color: var(--link);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
}

.back-link:hover { text-decoration: underline; }

body.page-admin { background: var(--bg); }

body.page-admin .sheet {
  width: min(920px, 100%);
  padding-top: 32px;
}

.login-card,
.panel {
  background: var(--white);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-card {
  margin-top: 28px;
  padding: 22px 22px 24px;
}

.login-card h1 {
  margin-top: 0;
  font-size: 24px;
  line-height: 30px;
}

.login-card .lead { margin-top: 8px; }

.login-card .field { margin-top: 16px; }

.desk-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-top: 22px;
}

.desk-bar h1 {
  margin: 0;
  font-size: 26px;
  line-height: 32px;
}

.ghost {
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--white);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.ghost:hover { background: #f4fafc; }

.ghost:disabled {
  opacity: 0.45;
  cursor: default;
}

.ghost.danger {
  color: #a4262c;
  border-color: #e7b8ba;
}

.ghost.danger:hover { background: #fdf4f4; }

.toolbar-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 18px;
}

.password-form { max-width: 360px; }

.password-form .field { margin-top: 14px; }

.form-ok {
  min-height: 0;
  margin: 12px 0 0;
  color: #0b6a3c;
  font-size: 13px;
  line-height: 18px;
}

.form-ok:empty { display: none; }

.panel { margin-top: 16px; padding: 18px 18px 16px; }

.panel h2 {
  margin: 0;
  font-size: 16px;
  line-height: 22px;
}

.winner-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.winner-banner p { margin: 4px 0 0; color: var(--body); }

.winner-banner strong { font-size: 18px; }

.delay-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #edebe9;
}

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 40px;
  height: 22px;
  margin: 0;
}

.switch-ui {
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: #c8c6c4;
  position: relative;
  flex: 0 0 auto;
}

.switch-ui::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  top: 2px;
  left: 2px;
  transition: transform 0.15s ease;
}

.switch input:checked + .switch-ui { background: var(--teal); }

.switch input:checked + .switch-ui::after { transform: translateX(18px); }

.switch input:focus-visible + .switch-ui {
  outline: 2px solid #004e5a;
  outline-offset: 2px;
}

.delay-length {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--body);
}

.delay-length input {
  width: 76px;
  height: 36px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.count { color: var(--muted); font-size: 13px; }

.search {
  width: min(240px, 100%);
  height: 36px;
}

.entry-list { display: flex; flex-direction: column; }

.entry {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.2fr) auto;
  gap: 8px 16px;
  align-items: center;
  padding: 12px 2px;
  border-top: 1px solid #edebe9;
}

.entry:first-child { border-top: 0; }

.entry.is-winner {
  margin: 0 -8px;
  padding-left: 10px;
  padding-right: 8px;
  border-top-color: transparent;
  border-left: 3px solid var(--teal);
  background: #f3fbfc;
  border-radius: 4px;
}

.entry .who { font-weight: 600; }

.entry .org,
.entry .when { color: var(--muted); font-size: 13px; }

.entry .when { grid-column: 1 / -1; }

.entry-actions { display: flex; gap: 8px; justify-content: flex-end; }

.small {
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 4px;
  background: var(--teal);
  color: white;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.small:hover { background: var(--teal-press); }

.small.secondary {
  background: #f3f2f1;
  color: var(--ink);
}

.small.secondary:hover { background: #e8e6e4; }

.small:disabled { opacity: 0.55; cursor: default; }

.empty {
  margin: 8px 0 4px;
  color: var(--muted);
}

@media (max-width: 640px) {
  .entry {
    grid-template-columns: 1fr;
  }

  .entry-actions { justify-content: flex-start; }

  .winner-banner,
  .desk-bar,
  .toolbar,
  .toolbar-actions { align-items: stretch; flex-direction: column; }

  .search,
  .toolbar-actions { width: 100%; }
}

@media (max-width: 340px) {
  h1 { font-size: 19px; line-height: 26px; }
  .sheet { padding-left: 16px; padding-right: 16px; }
}
