:root {
  color-scheme:light;
  --paper:#f8faf7;
  --ink:#173e35;
  --muted:#62746b;
  --line:#dce5dc;
  --green:#ddebcb;
  --red:#bf493a;
  --white:#fff;
  --serif:Georgia,'Times New Roman',serif;
  font-family:Inter,-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
  color:var(--ink);
  background:var(--paper);
  font-synthesis:none;
}

html.telegram-app {
  --paper: var(--tg-theme-bg-color, #f8faf7);
  --ink: var(--tg-theme-text-color, #173e35);
  --muted: var(--tg-theme-hint-color, #62746b);
  --white: var(--tg-theme-secondary-bg-color, #fff);
  --line: color-mix(in srgb, var(--ink) 20%, var(--paper));
  --green: var(--tg-theme-secondary-bg-color, #ddebcb);
  padding-top: var(--tg-content-safe-area-inset-top, 0px);
  padding-bottom: max(env(safe-area-inset-bottom), var(--tg-content-safe-area-inset-bottom, 0px));
}

.telegram-app .panel, .telegram-app .panel.white, .telegram-app .admin-view .panel,
.telegram-app .secret-card, .telegram-app .notice {
  background: var(--white);
  border-color: var(--line);
}

.telegram-app .participants .person .avatar {
  background: var(--paper);
  color: var(--ink);
}

.telegram-app .secret-card p, .telegram-app .tab-count {
  color: var(--ink);
}

.telegram-app .tab-count, .telegram-app .button.secondary:hover {
  background: var(--white);
}

.telegram-app .button:not(.secondary):not(.danger) {
  background: var(--tg-theme-button-color, #173e35);
  color: var(--tg-theme-button-text-color, #fff);
  border-color: var(--tg-theme-button-color, #173e35);
}

* {
  box-sizing:border-box;
}

body {
  margin:0;
  font-size:16px;
  line-height:1.55;
}

button,input,textarea,select {
  font:inherit;
}

button,a,input,textarea,select {
  -webkit-tap-highlight-color:transparent;
}

button,a {
  touch-action:manipulation;
}

button {
  cursor:pointer;
}

button:disabled {
  opacity:.5;
  cursor:wait;
}

a {
  color:inherit;
  text-decoration:none;
}

button:focus-visible,a:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible {
  outline:3px solid #b96a27;
  outline-offset:4px;
}

[hidden] {
  display:none!important;
}

.page {
  max-width:1240px;
  margin:auto;
  padding:0 48px;
}

.header {
  min-height:108px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  border-bottom:1px solid var(--line);
  gap:24px;
}

.brand {
  font-size:21px;
  font-weight:700;
  letter-spacing:-.8px;
  display:flex;
  align-items:center;
  gap:12px;
}

.brand-icon {
  font-size:36px;
  color:var(--red);
  font-weight:400;
  line-height:1;
}

.brand-note {
  font-size:10px;
  letter-spacing:1.8px;
  font-weight:600;
  margin-left:14px;
  border-left:1px solid var(--line);
  padding-left:20px;
}

.header-note {
  color:var(--muted);
  font-size:14px;
}

nav {
  display:flex;
  align-items:center;
  gap:20px;
}

.text-button {
  background:none;
  border:0;
  padding:8px 0;
  color:var(--muted);
  font-size:14px;
}

.text-button:hover {
  color:var(--ink);
  text-decoration:underline;
}

.loading {
  padding:80px 0;
}

main {
  min-height:calc(100svh - 209px);
}

footer {
  display:flex;
  justify-content:space-between;
  gap:20px;
  border-top:1px solid var(--line);
  padding:28px 0;
  color:var(--muted);
  font-size:13px;
}

.tiny-star {
  color:var(--red);
  padding-left:8px;
}

.eyebrow {
  display:block;
  font-size:12px;
  font-weight:700;
  letter-spacing:2px;
  text-transform:uppercase;
  color:var(--muted);
}

h1,h2,h3,p {
  margin-top:0;
}

h1 {
  font-family:var(--serif);
  font-weight:400;
  letter-spacing:-3px;
  line-height:1.07;
  font-size:clamp(48px,5.4vw,72px);
  margin:22px 0;
}

h2 {
  font-family:var(--serif);
  font-weight:400;
  font-size:32px;
  line-height:1.2;
  letter-spacing:-.7px;
  margin:0 0 16px;
}

h3 {
  font-size:17px;
  font-weight:600;
  margin:0 0 8px;
}

.muted {
  color:var(--muted);
}

.hero {
  display:grid;
  grid-template-columns:1.05fr 1fr;
  gap:72px;
  align-items:center;
  padding:64px 0 52px;
}

.hero-copy>p {
  max-width:400px;
  color:var(--muted);
  font-size:17px;
  line-height:1.7;
}

.hero h1 em {
  font-style:normal;
  color:var(--red);
}

.invite {
  display:inline-flex;
  align-items:center;
  gap:8px;
  background:#edf2e8;
  border:1px solid var(--line);
  border-radius:30px;
  padding:6px 12px;
  font-size:12px;
  letter-spacing:.5px;
}

.invite span {
  color:var(--red);
  font-size:15px;
}

.santa-scene {
  position:relative;
  overflow:hidden;
  min-height:340px;
  background:var(--green);
  border-radius:3px;
  display:flex;
  align-items:center;
  justify-content:center;
}

.santa-scene:before {
  content:'';
  position:absolute;
  inset:0;
  background-image:radial-gradient(#173e3512 1px,transparent 1px);
  background-size:16px 16px;
}

.santa {
  width:170px;
  height:202px;
  image-rendering:pixelated;
  position:relative;
  filter:drop-shadow(10px 12px 0 #173e3510);
  animation:float 5s ease-in-out infinite;
}

.scene-caption {
  position:absolute;
  bottom:24px;
  font-size:11px;
  letter-spacing:2.5px;
}

.snow {
  position:absolute;
  color:#173e3545;
  font-size:26px;
}

.snow.one {
  top:42px;
  left:54px;
}

.snow.two {
  bottom:70px;
  right:52px;
  font-size:40px;
}

.snow.three {
  top:58px;
  right:90px;
  font-size:14px;
}

.gift {
  position:absolute;
  left:56px;
  bottom:65px;
  width:28px;
  height:25px;
  background:#bc4e3e;
  box-shadow:0 -5px 0 #cc6755;
}

.gift:before {
  content:'';
  position:absolute;
  left:11px;
  top:-5px;
  width:6px;
  height:30px;
  background:#f3d898;
}

.login-panel {
  max-width:400px;
  margin-top:32px;
}

.field {
  display:flex;
  flex-direction:column;
  gap:7px;
  margin:0 0 17px;
}

.field>span,label>span.label {
  font-size:14px;
  font-weight:600;
}

.field small {
  font-size:13px;
  color:var(--muted);
}

input,textarea,select {
  width:100%;
  border:1px solid #cbd7cb;
  border-radius:4px;
  padding:13px 14px;
  background:var(--white);
  color:var(--ink);
  min-height:49px;
}

input::placeholder,textarea::placeholder {
  color:#829087;
}

textarea {
  resize:vertical;
  min-height:95px;
}

select {
  appearance:none;
  padding-right:32px;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%23173e35' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat:no-repeat;
  background-position:right 14px center;
}

.button {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  min-height:48px;
  padding:12px 21px;
  border:1px solid var(--ink);
  border-radius:4px;
  background:var(--ink);
  color:white;
  font-size:14px;
  font-weight:600;
  transition:background .15s;
}

.button:hover {
  background:#28584a;
}

.button.secondary {
  background:transparent;
  color:var(--ink);
  border-color:#bdcdbf;
}

.button.secondary:hover {
  background:#eaf0e6;
}

.button.danger {
  background:var(--red);
  border-color:var(--red);
}

.full {
  width:100%;
}

.fine-print {
  font-size:13px;
  color:var(--muted);
  margin:12px 0 0;
}

.steps {
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:30px;
  padding:32px 0 46px;
  border-top:1px solid var(--line);
}

.step {
  display:flex;
  gap:15px;
}

.step-mark {
  font-size:25px;
  color:var(--red);
  line-height:1.2;
}

.step p {
  font-size:14px;
  color:var(--muted);
  margin:0;
}

.step h3 {
  font-size:15px;
  margin:0 0 5px;
}

.dashboard-intro {
  display:flex;
  justify-content:flex-end;
  align-items:center;
  padding:42px 0 34px;
  gap:30px;
}

.dashboard-intro h1 {
  font-size:52px;
  margin:12px 0 14px;
}

.dashboard-intro p {
  margin:0;
  color:var(--muted);
  max-width:480px;
}

.mini-scene {
  background:var(--green);
  width:185px;
  height:170px;
  flex-shrink:0;
  display:grid;
  place-items:center;
  border-radius:50%;
}

.mini-scene img {
  width:92px;
  height:110px;
  image-rendering:pixelated;
}

.tabs {
  display:flex;
  gap:30px;
  border-bottom:1px solid var(--line);
  margin-bottom:32px;
}

.tab {
  padding:14px 0;
  background:none;
  border:0;
  color:var(--muted);
  border-bottom:2px solid transparent;
  margin-bottom:-1px;
  font-size:15px;
}

.tab.active {
  border-bottom-color:var(--ink);
  color:var(--ink);
  font-weight:600;
}

.tab-count {
  display:inline-block;
  font-size:11px;
  border-radius:20px;
  padding:0 6px;
  margin-left:6px;
  background:#e7eee2;
  color:var(--ink);
}

.dashboard-grid {
  display:grid;
  grid-template-columns:minmax(0,1.65fr) minmax(280px,1fr);
  gap:32px;
  padding-bottom:48px;
}

.section-heading {
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:22px;
  gap:12px;
}

.section-heading h2 {
  font-size:26px;
  margin:0;
}

.pill {
  font-size:12px;
  white-space:nowrap;
  border:1px solid var(--line);
  padding:5px 10px;
  border-radius:30px;
  color:var(--muted);
}

.pill.done {
  background:var(--green);
  border-color:var(--green);
  color:var(--ink);
}

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

.person {
  border:1px solid var(--line);
  padding:20px;
  border-radius:5px;
  min-height:139px;
  background:var(--white);
}

.person-top {
  display:flex;
  align-items:center;
  gap:12px;
  margin-bottom:13px;
}

.avatar {
  width:38px;
  height:38px;
  display:grid;
  place-items:center;
  background:#e8eedf;
  flex-shrink:0;
  font-family:var(--serif);
  font-size:19px;
  border-radius:4px;
}

.person:nth-child(3n+2) .avatar {
  background:#f2e3df;
}

.person:nth-child(3n) .avatar {
  background:#e2e9ef;
}

.person h3 {
  font-size:15px;
  margin:0;
  overflow-wrap:anywhere;
}

.person p {
  font-size:14px;
  color:var(--muted);
  margin:0;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
}

.panel {
  padding:26px;
  background:#eef3e9;
  border:1px solid #e0e8da;
  border-radius:5px;
  margin-bottom:18px;
}

.panel.white {
  background:white;
  border-color:var(--line);
}

.panel h2 {
  font-size:28px;
}

.panel>p {
  font-size:14px;
  color:var(--muted);
}

.panel .eyebrow {
  margin-bottom:16px;
}

.side-note {
  display:flex;
  gap:12px;
  font-size:13px;
  color:var(--muted);
  padding:2px 8px;
}

.side-note .lock {
  font-size:19px;
  color:var(--ink);
}

.empty {
  border:1px dashed #c5d3c5;
  border-radius:4px;
  text-align:center;
  padding:48px 24px;
}

.empty .empty-mark {
  font-size:38px;
  color:var(--red);
  display:block;
  margin-bottom:15px;
}

.empty h3 {
  font-family:var(--serif);
  font-size:25px;
  font-weight:400;
}

.empty p {
  color:var(--muted);
  font-size:14px;
  max-width:300px;
  margin:0 auto;
}

.button-row {
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

.key-actions {
  display:flex;
  flex-direction:column;
  gap:10px;
}

.code-controls {
  margin: 22px 0 14px;
}

.personal-code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 16px;
  letter-spacing: .1px;
  text-transform: uppercase;
  min-width: 0;
}

.code-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.code-buttons .button {
  flex: 1;
  padding: 10px 12px;
  white-space: nowrap;
}

.returning-participant, .legacy-key {
  margin-top: 22px;
  font-size: 14px;
}

summary {
  cursor: pointer;
  color: var(--muted);
}

details[open] > summary {
  margin-bottom: 18px;
}

.legacy-key .file-label {
  margin-top: 12px;
}

.file-input {
  position:absolute;
  width:1px;
  height:1px;
  opacity:0;
  min-height:0;
  padding:0;
  overflow:hidden;
}

.file-label:focus-within {
  outline:3px solid #b96a27;
  outline-offset:4px;
}

.checkbox {
  display:flex;
  align-items:flex-start;
  gap:10px;
  font-size:14px;
  margin-bottom:18px;
}

.checkbox input {
  width:18px;
  height:18px;
  min-height:18px;
  margin:3px 0 0;
  accent-color:var(--ink);
}

.notice {
  padding:14px 16px;
  background:#fff5de;
  border:1px solid #ecdfbc;
  font-size:14px;
  border-radius:4px;
  margin-bottom:20px;
}

.personal-view {
  max-width:660px;
  margin:0 auto 48px;
}

.secret-card {
  position:relative;
  text-align:center;
  padding:44px 30px;
  background:var(--green);
  border:1px solid #cedcba;
  border-radius:5px;
  margin-bottom:20px;
}

.secret-card .secret-symbol {
  font-size:50px;
  color:var(--red);
  line-height:1.3;
  margin-bottom:15px;
}

.secret-card h2 {
  font-size:38px;
  overflow-wrap:anywhere;
}

.secret-card p {
  color:#4d6555;
  font-size:15px;
}

.recipient-wishes {
  white-space:pre-wrap;
  overflow-wrap:anywhere;
}

.secret-card .eyebrow {
  margin-bottom:16px;
}

.secret-card .button {
  margin-top:10px;
}

.admin-view {
  padding-bottom:48px;
}

.admin-grid {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:24px;
}

.admin-view h2 {
  font-size:28px;
}

.admin-view .panel {
  background:white;
}

.admin-list {
  list-style:none;
  margin:0;
  padding:0;
}

.admin-list li {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  border-top:1px solid var(--line);
  padding:12px 0;
  font-size:14px;
  overflow-wrap:anywhere;
}

.admin-list button {
  color:var(--red);
  flex-shrink:0;
}

.admin-login {
  max-width:440px;
  margin:0 auto 48px;
}

.form-error {
  color:#a2392c;
  font-size:14px;
  margin:12px 0 0;
}

#toast {
  position:fixed;
  bottom:26px;
  left:50%;
  transform:translateX(-50%);
  background:var(--ink);
  color:white;
  padding:14px 24px;
  border-radius:5px;
  box-shadow:0 6px 25px #173e3520;
  max-width:calc(100% - 32px);
  width:max-content;
  z-index:20;
  font-size:14px;
}

#toast.error {
  background:#9c362c;
}

dialog {
  max-width:460px;
  width:calc(100% - 32px);
  border:1px solid var(--line);
  border-radius:8px;
  padding:30px;
  color:var(--ink);
  background:var(--paper);
}

dialog::backdrop {
  background:#102e2870;
  backdrop-filter:blur(3px);
}

dialog .eyebrow {
  margin-bottom:16px;
}

dialog p {
  color:var(--muted);
}

@keyframes float {
  0%,100% {
    transform:translateY(0);
  }
  50% {
    transform:translateY(-7px);
  }
}

@media(prefers-reduced-motion:reduce) {
  * {
    animation:none!important;
    transition:none!important;
  }
}

@media(min-width:1400px) {
  .hero {
    padding-top:80px;
    padding-bottom:70px;
  }
  .santa-scene {
    min-height:400px;
  }
}

@media(max-width:900px) {
  .page {
    padding:0 28px;
  }
  .hero {
    gap:32px;
  }
  .santa-scene {
    min-height:340px;
  }
  .brand-note {
    display:none;
  }
  .dashboard-grid {
    gap:22px;
    grid-template-columns:1.25fr 1fr;
  }
  .participants {
    grid-template-columns:1fr;
  }
  .gift {
    left:25px;
  }
  .snow.one {
    left:30px;
  }
  .snow.two {
    right:25px;
  }
  .steps {
    gap:20px;
  }
  .step {
    gap:10px;
  }
  .admin-grid {
    grid-template-columns:1fr;
  }
}

@media(max-width:620px) {
  .page {
    padding:0 20px;
  }
  .header {
    min-height:82px;
    gap:10px;
  }
  .brand {
    font-size:19px;
    gap:8px;
  }
  .brand-icon {
    font-size:30px;
  }
  .header-note {
    font-size:12px;
  }
  nav {
    gap:14px;
  }
  .hero {
    grid-template-columns:1fr;
    padding:34px 0;
    gap:30px;
  }
  .hero h1 {
    font-size:52px;
  }
  .hero-copy>p {
    font-size:16px;
  }
  .login-panel {
    max-width:none;
    margin-top:25px;
  }
  .santa-scene {
    min-height:235px;
    grid-row:2;
  }
  .santa {
    width:115px;
    height:137px;
  }
  .scene-caption {
    bottom:17px;
    font-size:10px;
  }
  .steps {
    grid-template-columns:1fr;
    gap:22px;
    padding:28px 0;
  }
  .step {
    gap:15px;
  }
  .step p {
    max-width:320px;
  }
  .dashboard-intro {
    padding:30px 0;
  }
  .dashboard-intro h1 {
    font-size:40px;
    letter-spacing:-1.5px;
  }
  .dashboard-intro p {
    font-size:14px;
  }
  .mini-scene {
    width:92px;
    height:100px;
  }
  .mini-scene img {
    width:59px;
    height:70px;
  }
  .tabs {
    gap:23px;
    margin-bottom:24px;
  }
  .tab {
    font-size:14px;
  }
  .dashboard-grid {
    grid-template-columns:1fr;
    gap:24px;
  }
  .dashboard-grid aside {
    grid-row:1;
  }
  .participants {
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  .person {
    padding:15px;
  }
  .person-top {
    gap:8px;
  }
  .avatar {
    width:30px;
    height:30px;
    font-size:16px;
  }
  .person h3 {
    font-size:14px;
  }
  .person p {
    font-size:13px;
  }
  .panel {
    padding:23px;
  }
  .section-heading h2 {
    font-size:24px;
  }
  .secret-card {
    padding:34px 22px;
  }
  .secret-card h2 {
    font-size:32px;
  }
  footer {
    flex-direction:column;
    gap:6px;
    padding:22px 0;
    font-size:12px;
  }
  .button-row .button {
    flex:1;
  }
}

@media(max-width:360px) {
  .participants {
    grid-template-columns:1fr;
  }
  .hero h1 {
    font-size:46px;
  }
  .header-note {
    display:none;
  }
}
