:root {
  color-scheme: light;
  --paper: #f2e6d2;
  --panel: #fff8eb;
  --ink: #2c2b21;
  --evergreen: #19342e;
  --muted: #52594b;
  --cranberry: #a13743;
  --cranberry-dark: #822a36;
  --gold: #ffcf79;
  --border: #d8c3a4;
  --display: Georgia, "Times New Roman", serif;
  --body: "Avenir Next", system-ui, sans-serif;
  --radius: 15px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  min-width: 280px;
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background: var(--paper);
  font: .9375rem/1.55 var(--body);
}
::selection { color: #fff8eb; background: var(--cranberry); }
:focus-visible { outline: 3px solid #ae414f; outline-offset: 4px; }
#view-title:focus { outline: none; }
a { color: inherit; text-underline-offset: .2em; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .72; }
p, h1, h2, h3 { margin: 0; }
h1, h2, h3 { line-height: 1.12; }
svg { flex: 0 0 auto; vertical-align: middle; }

.site-header {
  position: relative;
  background: var(--evergreen);
  color: #fff1d8;
}
.site-header::after {
  content: "";
  display: block;
  height: 4px;
  background: #8f513c;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='4' viewBox='0 0 14 4'%3E%3Cpath d='m0 2 3-2 3 2-3 2Zm7 0 3-2 3 2-3 2Z' fill='%23daa762'/%3E%3C/svg%3E");
}
.header-inner, .site-main, .site-footer {
  width: min(1104px, calc(100% - 64px));
  margin-inline: auto;
}
.header-inner {
  min-height: 68px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 720; font-size: 1.07rem; white-space: nowrap; }
.brand svg { width: 29px; height: 29px; color: var(--gold); }
.brand small { margin-left: 4px; color: #e5c99d; font-size: .72rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.site-header :focus-visible, .hero :focus-visible { outline-color: var(--gold); }
.site-main { margin-block: 28px 44px; flex: 1; }
.site-footer { padding: 16px 0 23px; border-top: 1px solid var(--border); color: var(--muted); font-size: .82rem; }

.login-layout {
  min-height: 562px;
  display: grid;
  grid-template-columns: minmax(0, 1.21fr) minmax(0, .79fr);
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
}
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  background: var(--evergreen);
  color: #fff1d8;
}
.hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background-repeat: no-repeat;
  background-image: url("/images/chalet-noel.jpg");
  background-size: cover;
}
.hero h1 { font: 700 4.55rem/.98 var(--display); letter-spacing: -.035em; text-wrap: balance; }
.hero p { margin-top: 13px; color: #fff0d4; font-size: 1.02rem; text-wrap: pretty; }
.login-hero { flex-direction: column; justify-content: flex-end; padding: 43px; }
.login-hero::before {
  background-image: linear-gradient(0deg, #132d28 0, #132d28d4 20%, #132d2830 61%), url("/images/chalet-noel.jpg");
  background-position: center, 67% center;
}
.login-panel { display: flex; align-items: center; justify-content: center; padding: 42px; }
.login-content { width: min(100%, 350px); }
.login-content h2, .workspace-heading h2 {
  font: 700 2.35rem/1.07 var(--display);
  letter-spacing: -.035em;
  text-wrap: balance;
}
.intro { margin-top: 9px; }
.muted { color: var(--muted); }
.privacy { margin-top: 22px; color: var(--muted); display: flex; gap: 7px; align-items: center; font-size: .8rem; }
.privacy svg { width: 15px; height: 15px; }
.login-form { margin-top: 22px; }

label { display: block; margin: 11px 0 5px; color: var(--ink); font-size: .87rem; font-weight: 680; }
label span { color: var(--muted); font-weight: 450; }
input, textarea {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 7px;
  border: 1px solid #ad987c;
  background: #fffdf7;
  color: var(--ink);
  caret-color: var(--cranberry);
  font-size: 1rem;
  line-height: 1.4;
}
input { min-height: 45px; }
textarea { resize: vertical; }
::placeholder { color: #64594e; opacity: 1; }
.form-error { color: #8c233d; margin: 9px 0 3px; font-size: .88rem; }
.button, .icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 700;
  line-height: 1.23;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}
.button { padding: 9px 13px; }
.primary { color: #fffaf0; background: var(--cranberry); }
.primary:hover { background: var(--cranberry-dark); }
.primary:active { background: #681d2d; }
.secondary { color: var(--evergreen); background: var(--panel); border-color: #a3947b; }
.secondary:hover { background: #efe4d0; border-color: #887653; }
.subtle { color: var(--evergreen); background: transparent; }
.subtle:hover, .icon-button:hover { background: #e8d8bb; }
.danger { color: #812b39; }
.icon-button { width: 44px; min-width: 44px; padding: 0; color: var(--evergreen); background: transparent; }
.login-button { width: 100%; margin-top: 17px; justify-content: space-between; }
.login-back { width: 100%; margin-top: 4px; }
.login-content > .secondary { margin-top: 13px; }

.account { display: flex; align-items: center; gap: 7px; }
.account-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px 4px 4px;
}
.site-header .icon-button:hover { background: #315149; }
.account-name { font-weight: 720; line-height: 1.13; }
.site-header .icon-button { color: #fff1d8; }
.account-avatar, .tab-character { flex: 0 0 auto; width: 36px; }
.character-frame {
  display: block;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #34544a;
}
.character-frame > img, .character-fallback { position: absolute; inset: 0; height: 100%; width: 100%; object-fit: cover; }
.character-fallback {
  display: grid;
  place-items: center;
  color: #f7d49e;
  background: #34544a url("/images/chalet-character.jpg") center / cover no-repeat;
}
.character-fallback svg { display: none; }
.character-duo-left { --portrait-x: -36.05%; --portrait-y: -3.49%; }
.character-duo-right { --portrait-x: -202.79%; --portrait-y: -5.58%; }
.character-portrait { --portrait-x: -39.64%; --portrait-y: -2.14%; --portrait-width: 193.93%; }
.character-frame:is(.character-duo-left, .character-duo-right, .character-portrait) > img {
  inset: auto;
  width: var(--portrait-width, 357.21%);
  height: auto;
  max-width: none;
  left: var(--portrait-x);
  top: var(--portrait-y);
}

.dashboard-hero {
  min-height: 292px;
  gap: 22px;
  align-items: center;
  justify-content: space-between;
  padding: 22px 45px 23px;
  border-radius: var(--radius);
}
.dashboard-hero::before {
  background-image: linear-gradient(90deg, #152e29 2%, #152e29e0 30%, #152e295c 72%, #152e294f 100%), url("/images/chalet-noel.jpg");
  background-position: center, center 46%;
}
.dashboard-intro { flex: 1; min-width: 0; }
.dashboard-hero h1 { max-width: 13ch; font-size: 3.65rem; }
.dashboard-hero p { margin-top: 10px; }
.dashboard-character {
  flex: 0 0 auto;
  width: 185px;
  padding: 4px;
  background: #ffe5b5;
  border: 1px solid #543d2f;
  box-shadow: 0 7px 20px #0d211da0;
  border-radius: 11px;
  transform: rotate(2.5deg);
}
.dashboard-character .character-frame { border-radius: 6px; aspect-ratio: 570 / 695; }
.dashboard-character .character-frame.character-duo-left { aspect-ratio: 737 / 1024; }
.dashboard-character .character-frame.character-duo-right { aspect-ratio: 799 / 1024; }
.dashboard-character .character-frame.character-portrait { aspect-ratio: 3 / 4; }
.dashboard-character .character-frame.character-duo-left > img { width: 208.41%; left: 0; top: 0; }
.dashboard-character .character-frame.character-duo-right > img { width: 192.24%; left: -92.24%; top: 0; }
.dashboard-character .character-frame.character-portrait > img { width: 100%; left: 0; top: 0; }

.tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 6px;
  margin-top: 15px;
  padding-bottom: 11px;
  border-bottom: 1px solid var(--border);
}
.tab {
  min-height: 47px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px 5px 7px;
  color: var(--evergreen);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  font-weight: 700;
  text-align: start;
}
.tab:hover { background: #edddc3; }
.tab[aria-pressed="true"] { color: var(--evergreen); border-color: #c7b18f; background: var(--panel); }
.tab svg { width: 17px; height: 17px; }
.tab-character { width: 32px; }
.tab:not(:has(.tab-character)) { padding-inline: 10px; }
.tab.draw-tab { color: var(--cranberry-dark); }
.workspace { padding-top: 24px; }
.workspace-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 19px; }
.workspace-heading h2 { font-size: 2.12rem; }
.workspace-heading p { margin-top: 5px; }
.refresh { border-color: var(--border); background: var(--panel); }
.empty {
  min-height: 107px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  background: var(--panel);
  border: 1px dashed #b9a480;
  border-radius: var(--radius);
}
.empty-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  color: var(--cranberry-dark);
  background: #f2e2ca;
  border-radius: 8px;
}
.empty-icon svg { width: 22px; height: 22px; }
.empty h3 { font-size: .98rem; line-height: 1.35; }
.empty p { margin-top: 3px; color: var(--muted); font-size: .88rem; }

.draw-error { margin: 0 0 12px; }
.draw-waiting { flex-wrap: wrap; }
.draw-waiting .button { margin-inline-start: auto; }
.draw-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(12px, 4vw, 42px);
  padding: clamp(18px, 4vw, 36px) clamp(12px, 5vw, 56px);
  border-radius: var(--radius);
  border: 1px solid #235044;
  color: #fff1d8;
  background: radial-gradient(ellipse at top, #3a6553, var(--evergreen) 75%);
}
.draw-ball { display: grid; grid-template-rows: auto auto auto; align-content: start; justify-items: center; gap: 9px; min-width: 0; text-align: center; }
.draw-ball h3 { font: 700 clamp(1.2rem, 4vw, 1.55rem)/1.1 var(--display); overflow-wrap: anywhere; }
.draw-ball h3:focus { outline: none; }
.draw-ornament {
  margin-block: 13px 3px;
  position: relative;
  isolation: isolate;
  width: min(100%, 208px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid #d4ab68;
  background: #fde5bf;
  box-shadow: 0 5px 12px #0d211d80;
}
.draw-ornament::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -12px;
  z-index: 1;
  width: 25px;
  height: 13px;
  transform: translateX(-50%);
  border: 1px solid #d4ab68;
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(90deg, #8e633b, #f5d38a 45%, #b18049);
}
.draw-ornament canvas, .draw-artwork { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: inherit; }
.draw-artwork { overflow: hidden; }
.draw-artwork .character-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  width: auto;
  height: 84%;
  aspect-ratio: 3 / 4;
  border-radius: 6px;
  transform: translate(-50%, -50%);
  background: transparent;
  mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent),
    linear-gradient(to bottom, transparent, black 1.5%, black 98%, transparent);
  mask-composite: intersect;
}
.draw-artwork .character-frame > img { width: 100%; left: 0; top: 0; }
.draw-artwork .character-duo-left { aspect-ratio: 737 / 1024; }
.draw-artwork .character-duo-right { aspect-ratio: 799 / 1024; }
.draw-artwork .character-duo-left > img { width: 208.41%; }
.draw-artwork .character-duo-right > img { width: 192.24%; left: -92.24%; }
.draw-ornament canvas { touch-action: none; cursor: crosshair; }
#draw-view[aria-busy="true"] canvas { cursor: wait; }
.draw-link { color: #fff1d8; background: transparent; border-color: #a48a64; font-size: .86rem; }
.draw-link svg { width: 15px; height: 15px; }
.draw-link:hover { color: var(--evergreen); background: #fff1d8; }
.draw-board :focus-visible { outline-color: var(--gold); }
.draw-progress, .draw-admin { margin-top: 15px; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
.draw-progress h3, .draw-admin h3 { font: 700 1.36rem/1.15 var(--display); }
.draw-progress ul { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 6px 18px; list-style: none; margin: 12px 0 0; padding: 0; }
.draw-progress li { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.draw-progress li > :first-child { font-weight: 700; overflow-wrap: anywhere; }
.draw-count { color: var(--muted); font-size: .805rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.draw-admin > .button { margin-top: 12px; }
.draw-admin select { display: block; width: min(100%, 280px); min-height: 44px; padding: 8px 12px; border: 1px solid #ad987c; border-radius: 7px; background: #fffdf7; color: var(--ink); }
.draw-exclusions { min-width: 0; margin: 14px 0 0; padding: 0; border: 0; }
.draw-exclusions legend { padding: 0; color: var(--ink); font-size: .87rem; font-weight: 680; }
.draw-exclusion-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 126px), 1fr)); gap: 7px; margin-top: 7px; }
.draw-exclusion-options label { display: flex; align-items: center; gap: 8px; min-height: 44px; margin: 0; padding: 7px 9px; border: 1px solid var(--border); border-radius: 7px; background: #fffdf7; cursor: pointer; }
.draw-exclusion-options label:has(:checked) { border-color: #ad6f72; background: #f9ede1; }
.draw-exclusion-options input { flex: 0 0 16px; width: 16px; min-height: 0; margin: 0; padding: 0; accent-color: var(--cranberry-dark); }
.draw-exclusion-options span { color: var(--ink); overflow-wrap: anywhere; }
.draw-admin-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; margin-top: 12px; }
.draw-draft-hint { margin-top: 7px; font-size: .85rem; }
.draw-restrictions-empty, .draw-restrictions-table { margin-top: 16px; font-size: .9rem; }
.draw-restrictions-table { width: 100%; table-layout: fixed; border-collapse: collapse; }
.draw-restrictions-table caption { padding-bottom: 6px; text-align: left; font-weight: 700; }
.draw-restrictions-table thead { background: #f9ede1; }
.draw-restrictions-table thead th:first-child { width: 34%; }
.draw-restrictions-table :is(th, td) {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}
.draw-reset-warning { margin-top: 11px; padding: 12px; border: 1px solid #ad6f72; border-radius: 8px; background: #f9ede1; }
#draw-view[aria-busy="false"] :is(.draw-admin, .draw-waiting) button:disabled { cursor: not-allowed; }

.composer { padding: 17px 21px 21px; margin-bottom: 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
.composer-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.composer-heading h3 { font: 700 1.64rem/1.1 var(--display); }
.composer-heading + form > label { margin-top: 4px; }
.import-row { display: flex; gap: 8px; }
.input-icon { position: relative; flex: 1; min-width: 0; }
.input-icon svg { position: absolute; top: 14px; left: 10px; color: var(--muted); }
.input-icon input { padding-left: 34px; }
.manual-button { margin-top: 4px; padding-inline: 0 7px; text-decoration: underline; text-underline-offset: .2em; }
.manual-button:hover { background: transparent; color: var(--cranberry); }
#import-status { margin-top: 4px; }
#gift-details { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 9px; }
.details-grid { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; }
.import-preview, .gift-image {
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #ebddc6;
  color: #724b47;
}
.import-preview { aspect-ratio: 1; margin-top: 11px; border-radius: 8px; }
.import-preview svg, .gift-image svg { width: 32px; height: 32px; }
.import-preview img, .gift-image img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fffaf0; }
.save-button { margin-top: 14px; }
.gift-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 248px), 1fr)); gap: 14px; }
.gift-card { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
.gift-image { aspect-ratio: 16/10; border-bottom: 1px solid var(--border); }
.gift-body { padding: 14px 15px 12px; display: flex; flex: 1; flex-direction: column; }
.gift-body h3 { font-size: 1.02rem; overflow-wrap: anywhere; }
.gift-description { margin: 7px 0 2px; color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; white-space: pre-wrap; }
.gift-owner { margin: 3px 0 1px; color: var(--cranberry-dark); font-size: .84rem; font-weight: 700; }
.gift-actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 2px 8px; margin-top: auto; padding-top: 10px; }
.retailer { display: inline-flex; align-items: center; gap: 4px; font-size: .84rem; color: var(--evergreen); overflow-wrap: anywhere; }
.retailer svg, .gift-actions .button svg { width: 14px; height: 14px; }
.retailer:hover { color: var(--cranberry-dark); }
.gift-actions .button { min-height: 41px; font-size: .8rem; padding: 6px 8px; }
.notice {
  position: fixed;
  z-index: 2;
  left: 50%;
  bottom: 17px;
  transform: translateX(-50%);
  max-width: min(419px, calc(100% - 28px));
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--evergreen);
  color: #fff1d8;
  box-shadow: 0 4px 15px #172b2245;
}
.notice-error { background: var(--cranberry-dark); }
.no-script { padding: 12px 20px; }

@media (max-width: 900px) {
  .login-hero, .login-panel { padding: 31px; }
  .login-hero h1 { font-size: 3.8rem; }
  .login-layout { min-height: 518px; }
  .dashboard-hero { padding-inline: 33px; }
}
@media (max-width: 670px) {
  .header-inner, .site-main, .site-footer { width: calc(100% - 28px); }
  .header-inner { min-height: 62px; }
  .site-main { margin-block: 15px 30px; }
  .login-layout { display: block; min-height: 0; }
  .login-hero { min-height: 286px; padding: 22px; }
  .login-hero::before { background-position: center, 64% center; }
  .login-hero h1 { font-size: 3.16rem; }
  .hero p { margin-top: 8px; font-size: .93rem; }
  .login-panel { padding: 25px 20px 27px; }
  .login-content h2 { font-size: 2.03rem; }
  .privacy { margin-top: 17px; }
  .dashboard-hero { min-height: 177px; gap: 9px; padding: 14px 19px 15px; }
  .dashboard-hero::before { background-position: center, 54% center; }
  .dashboard-hero h1 { font-size: 2.27rem; }
  .dashboard-hero p { font-size: .88rem; }
  .dashboard-character { width: 103px; padding: 3px; }
  .tabs { gap: 2px 4px; margin-top: 10px; padding-bottom: 8px; }
  .tab { padding-inline: 5px 7px; gap: 5px; font-size: .85rem; }
  .tab:not(:has(.tab-character)) { padding-inline: 6px; }
  .tab-character { width: 28px; }
  .tab svg { width: 15px; height: 15px; }
  .workspace { padding-top: 18px; }
  .workspace-heading { gap: 10px; flex-wrap: wrap; }
  .workspace-heading h2 { font-size: 1.87rem; }
  .workspace-heading .refresh { margin-left: auto; }
  .empty { padding: 14px; }
  .draw-waiting .button { margin-inline-start: 0; }
  .draw-link { padding-inline: 8px; }
  .composer { padding-inline: 14px; }
  .details-grid { grid-template-columns: 1fr; gap: 0; }
  .import-preview { width: 91px; }
  .account { gap: 0; }
  .account-avatar { width: 31px; }
  .account-profile { gap: 6px; }
}
@media (max-width: 390px) {
  .import-row { flex-wrap: wrap; }
  .input-icon { flex: 0 0 100%; }
  .dashboard-hero h1 { font-size: 1.97rem; }
  .dashboard-character { width: 83px; }
  .brand { gap: 4px; font-size: .96rem; }
  .brand svg { width: 23px; }
  .brand small { margin-left: 2px; }
}
@media (max-width: 350px) {
  .brand small { display: none; }
}
@media (max-width: 310px) {
  .brand { font-size: .86rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .dashboard-character:has([data-avatar-image]:not([hidden])) {
    animation: portrait-greet 940ms cubic-bezier(.23, 1, .32, 1);
  }
  .tab-character .character-frame {
    transition: transform 200ms cubic-bezier(.23, 1, .32, 1);
  }
  .tab:is(:focus-visible, :active) .tab-character .character-frame {
    transform: translateY(-2px) rotate(-8deg);
  }
  .ornament-unwrapped {
    transform-origin: 50% 0;
    animation: ornament-sway 650ms ease-out;
  }
  @keyframes portrait-greet {
    35% { transform: translateY(-5px) rotate(-2deg); }
    68% { transform: translateY(-1px) rotate(4deg); }
  }
  @keyframes ornament-sway {
    24% { transform: rotate(4deg); }
    60% { transform: rotate(-2deg); }
  }
}
@media (prefers-reduced-motion: no-preference) and (hover: hover) {
  .tab:hover .tab-character .character-frame {
    transform: translateY(-2px) rotate(-8deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
