/* APP SHELL — deliberately quiet: soft green blocks, heavy grotesk, rounded buttons
   (from the wireframes). The user's calendar is the star, not the interface. */

:root {
  --block: #9ccb9b;        /* green block (wireframes) */
  --block-hover: #aad4a9;
  --block-soft: #e3f0e2;
  --ink: #4e6e4d;          /* green text (wireframes) */
  --ink-strong: #2f4a2e;
  --paper: #ffffff;
  --danger: #b5432f;
  --radius: 28px;
  --radius-sm: 16px;
  --pill: 999px;
  --gap: 24px;
  --font: 'Inter', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-weight: 700;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
:focus-visible { outline: 3px solid var(--ink-strong); outline-offset: 3px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- views ---------- */
.view { display: none; position: fixed; inset: 0; overflow: hidden; }
.view.is-active { display: block; animation: view-in .35s var(--ease); }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  background: var(--block); color: var(--ink);
  border-radius: var(--pill);
  padding: .8em 1.5em;
  font-weight: 900; text-transform: uppercase; letter-spacing: .005em;
  font-size: 18px; line-height: 1.1;
  transition: transform .18s var(--ease), background .18s var(--ease), box-shadow .18s var(--ease);
  user-select: none;
}
.btn:hover { background: var(--block-hover); transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn--hero { font-size: clamp(20px, 2.6vw, 34px); padding: .7em 1.6em; min-width: min(100%, 360px); }
.btn--small { font-size: 14px; padding: .65em 1.1em; text-transform: none; font-weight: 800; border-radius: var(--radius-sm); }
.btn--ghost { background: transparent; box-shadow: inset 0 0 0 2px var(--block); }
.btn--ghost:hover { background: var(--block-soft); }
.btn--danger { background: #f1d2cb; color: var(--danger); }
.btn--danger:hover { background: #ebc0b6; }
.btn--nav {
  justify-content: flex-start; text-transform: none; font-size: 20px;
  border-radius: 18px; padding: .75em 1em; width: 100%;
}
.link-btn {
  color: var(--ink); font-weight: 800; font-size: 14px;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 2px;
  text-decoration-color: var(--block);
}
.link-btn:hover { text-decoration-color: var(--ink); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: var(--paper); color: var(--ink);
  border-radius: var(--pill); padding: .45em .85em;
  font-size: 13px; font-weight: 800;
  box-shadow: inset 0 0 0 2px var(--block);
  transition: background .15s, color .15s;
}
.chip:hover { background: var(--block-soft); }
.chip.is-on { background: var(--ink); color: var(--paper); box-shadow: none; }
.chip--danger { color: var(--danger); box-shadow: inset 0 0 0 2px #ecc5bc; }

.input {
  width: 100%;
  background: var(--paper); color: var(--ink-strong);
  border: 0; border-radius: 12px; padding: .6em .75em;
  font-size: 15px; font-weight: 600;
  box-shadow: inset 0 0 0 2px rgba(78, 110, 77, .25);
}
.input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--ink); }
.input--big { font-size: 20px; font-weight: 800; }
textarea.input { resize: vertical; min-height: 70px; }

input[type=range] { width: 100%; accent-color: var(--ink); }
input[type=color] { width: 44px; height: 32px; border: 0; padding: 0; background: none; border-radius: 8px; cursor: pointer; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--ink); }

/* ---------- HOME ---------- */
.home__stage { position: absolute; inset: 0; }
.home__copy { position: absolute; left: 40px; top: 32px; max-width: 380px; pointer-events: none; z-index: 2; }
.home__title {
  margin: 0; font-weight: 900; font-size: clamp(44px, 5.6vw, 84px); line-height: .86;
  letter-spacing: -.035em; color: var(--ink); text-transform: uppercase;
}
.home__lede { margin: 14px 0 0; font-size: clamp(14px, 1.25vw, 17px); line-height: 1.35; font-weight: 700; }
.home__caption {
  position: absolute; left: 40px; bottom: 44px; max-width: 300px; margin: 0; z-index: 2;
  font-size: 14px; line-height: 1.35; font-weight: 600; color: var(--ink); pointer-events: none;
}
.home__caption strong { font-weight: 900; }
.home__actions {
  position: absolute; left: 50%; bottom: 5.5vh; transform: translateX(-50%); z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: 12px; width: min(420px, 86vw);
}
.home__secondary { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.home__secondary .btn { background: rgba(255,255,255,.85); }
.home__hint { position: absolute; right: 40px; bottom: 44px; margin: 0; max-width: 220px; text-align: right; font-size: 12px; font-weight: 700; opacity: .6; pointer-events: none; z-index: 2; }

/* ---------- QUESTIONNAIRE ---------- */
.view--new { overflow-y: auto; }
.q-wrap { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 48px 16px; }
.q-card {
  width: min(520px, 100%); min-height: min(64vh, 640px);
  background: var(--block); color: var(--ink);
  border-radius: var(--radius); padding: 28px 40px 40px;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 18px;
  position: relative;
  animation: view-in .3s var(--ease);
}
.q-card--wide { width: min(760px, 100%); }
.q-step { position: absolute; top: 26px; left: 40px; font-size: 14px; font-weight: 900; letter-spacing: .04em; }
.q-progress { position: absolute; top: 34px; left: 110px; right: 40px; height: 4px; background: rgba(47, 74, 46, .15); border-radius: 4px; overflow: hidden; }
.q-progress__bar { height: 100%; background: var(--ink); transition: width .3s var(--ease); }
.q-title { margin: 0; font-size: clamp(28px, 3.4vw, 42px); line-height: 1.04; font-weight: 900; letter-spacing: -.02em; color: var(--ink); }
.q-hint { margin: 0 0 10px; font-size: 15px; line-height: 1.35; }
.q-options { display: flex; flex-wrap: wrap; gap: 8px; }
.q-option {
  background: var(--paper); color: var(--ink);
  border-radius: var(--pill); padding: .7em 1.15em; font-size: 17px; font-weight: 800;
  transition: transform .15s var(--ease), background .15s;
}
.q-option:hover { transform: translateY(-2px); }
.q-option.is-picked { background: var(--ink); color: var(--paper); }
.q-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.q-tile {
  background: var(--paper); border-radius: 18px; padding: 8px 8px 10px;
  display: flex; flex-direction: column; gap: 4px; align-items: stretch;
  transition: transform .15s var(--ease), box-shadow .15s;
}
.q-tile:hover { transform: translateY(-3px); }
.q-tile.is-picked { box-shadow: inset 0 0 0 3px var(--ink); }
.q-tile__canvas { width: 100%; height: 108px; display: block; }
.q-tile__label { font-size: 15px; font-weight: 900; text-align: left; padding-left: 4px; }
.q-slider__ends { display: flex; justify-content: space-between; font-size: 14px; margin-top: 6px; }
.q-range { height: 28px; }
.q-names { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.q-input { width: 100%; border: 0; border-radius: 14px; padding: .65em .8em; background: var(--paper); color: var(--ink-strong); font-weight: 800; font-size: 15px; }
.q-input::placeholder { color: rgba(78, 110, 77, .55); }
.q-input--big { font-size: 22px; }
.q-next { width: min(520px, 100%); font-size: clamp(20px, 2.6vw, 34px); padding: .65em 1em; }
.q-back { opacity: .8; }

/* ---------- STAGE (any renderer container) ---------- */
.stage { position: absolute; inset: 0; }
.ot-stage { overflow: hidden; }
.ot-stage > * { position: absolute; left: 0; top: 0; }
.ot-bg { inset: 0; width: 100%; height: 100%; z-index: 0; }
.ot-bg__media, .ot-bg__tint { position: absolute; inset: 0; }
.ot-bg img, .ot-bg video { width: 100%; height: 100%; object-fit: cover; display: block; }
.ot-3d { inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
.ot-3d canvas { display: block; }
.ot-stage > canvas { z-index: 2; display: block; }
.ot-media { inset: 0; width: 100%; height: 100%; z-index: 3; pointer-events: none; }
.ot-media__item { position: absolute; left: 0; top: 0; width: 100px; height: 100px; will-change: transform; }
.ot-media__item img, .ot-media__item video { width: 100%; height: 100%; object-fit: contain; display: block; }
.ot-media__item.is-selected { outline: 3px solid currentColor; outline-offset: 4px; border-radius: 6px; }
.ot-tip {
  z-index: 4; pointer-events: none;
  background: rgba(20, 24, 20, .86); color: #fff; border-radius: 10px;
  padding: 7px 10px; font-size: 12px; font-weight: 600; line-height: 1.35;
  display: flex; flex-direction: column; max-width: 260px;
  opacity: 0; transition: opacity .12s;
}
.ot-tip.is-on { opacity: 1; }
.ot-tip strong { font-weight: 800; font-size: 13px; }
.stage__hint { position: absolute; left: 16px; bottom: 12px; margin: 0; font-size: 12px; font-weight: 700; color: var(--ink); background: rgba(255,255,255,.8); padding: 4px 9px; border-radius: 8px; pointer-events: none; z-index: 5; }

/* ---------- CUSTOMIZE ---------- */
.cz { position: absolute; inset: 0; display: grid; grid-template-columns: minmax(300px, 33%) 1fr; gap: var(--gap); padding: var(--gap); }
.cz__panel { display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.cz__controls { flex: 1; min-height: 0; overflow-y: auto; background: var(--block); border-radius: var(--radius); padding: 10px 14px; scrollbar-width: thin; }
.cz__save { display: flex; flex-direction: column; gap: 10px; }
.cz__save .btn--hero { width: 100%; }
.cz__name { font-size: 17px; font-weight: 800; }
.cz__minor { display: flex; justify-content: space-between; gap: 12px; padding: 0 6px; }
.cz__preview { position: relative; border-radius: 6px; overflow: hidden; box-shadow: 0 0 0 2px var(--block); }

.cz-section { border-bottom: 2px solid rgba(47, 74, 46, .14); }
.cz-section:last-child { border-bottom: 0; }
.cz-section__title { list-style: none; cursor: pointer; font-size: 22px; font-weight: 900; padding: 14px 6px; display: flex; justify-content: space-between; align-items: center; }
.cz-section__title::-webkit-details-marker { display: none; }
.cz-section__title::after { content: '+'; font-size: 22px; transition: transform .2s var(--ease); }
.cz-section[open] > .cz-section__title::after { transform: rotate(45deg); }
.cz-section__body { display: flex; flex-direction: column; gap: 14px; padding: 0 6px 18px; }

.ctl { display: flex; flex-direction: column; gap: 6px; }
.ctl__label { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; font-weight: 800; color: var(--ink-strong); }
.ctl__value { font-variant-numeric: tabular-nums; opacity: .7; }
.ctl__ends { display: flex; justify-content: space-between; font-size: 11px; font-weight: 700; opacity: .75; margin-top: -2px; }
.ctl__note { margin: -4px 0 0; font-size: 13px; font-weight: 600; line-height: 1.35; }
.ctl__inline { display: flex; gap: 10px; align-items: center; }
.ctl--color { flex-direction: row; justify-content: space-between; align-items: center; background: rgba(255,255,255,.5); padding: 6px 8px 6px 12px; border-radius: 12px; }
.ctl--toggle { flex-direction: row; align-items: center; gap: 10px; }
.ctl--toggle .ctl__label { flex: 1; }
.ctl--row { flex-direction: row; align-items: center; gap: 12px; flex-wrap: wrap; }
.ctl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.ctl-grid--names { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }

/* ---------- CALENDAR ---------- */
.cal { position: absolute; inset: 0; display: grid; grid-template-columns: 1fr 200px; gap: var(--gap); padding: var(--gap); }
.cal__main { position: relative; border-radius: 6px; overflow: hidden; box-shadow: 0 0 0 2px var(--block); }
.cal__nav { display: flex; flex-direction: column; gap: 12px; }
.cal__name {
  position: absolute; z-index: 5; top: 14px; left: 16px; margin: 0;
  font-size: 15px; font-weight: 900; padding: 6px 12px; border-radius: 10px;
  background: rgba(255,255,255,.82); color: var(--ink); pointer-events: none;
}
.cal__bottom { position: absolute; z-index: 5; left: 12px; right: 12px; bottom: 12px; display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; pointer-events: none; }
.cal__bottom > * { pointer-events: auto; }
.cal__focus {
  display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border-radius: 14px;
  background: rgba(255,255,255,.88); color: var(--ink-strong); max-width: 340px;
}
.cal__focus-day { font-size: 22px; font-weight: 900; line-height: 1.05; }
.cal__focus-date { font-size: 13px; font-weight: 700; }
.cal__focus-count { font-size: 12px; font-weight: 600; opacity: .75; margin-bottom: 4px; }
.cal__focus .link-btn { align-self: flex-start; }
.cal__tools { display: flex; gap: 6px; }
.tool {
  min-width: 40px; height: 40px; padding: 0 12px; border-radius: 12px;
  background: rgba(255,255,255,.88); color: var(--ink-strong); font-weight: 900; font-size: 15px;
  box-shadow: inset 0 0 0 2px var(--block);
}
.tool:hover { background: var(--block-soft); }

/* ---------- ARCHIVE ---------- */
.view--archive { overflow-y: auto; }
.arc { max-width: 1180px; margin: 0 auto; padding: 40px var(--gap) 80px; }
.arc__head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; }
.arc__title { margin: 0; font-size: clamp(40px, 6vw, 72px); font-weight: 900; letter-spacing: -.03em; text-transform: uppercase; }
.arc__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.arc__note { font-size: 14px; font-weight: 700; margin: 10px 0 28px; opacity: .8; }
.arc__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.arc-empty { font-size: 18px; }
.arc-card { background: var(--block); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.arc-card.is-main { box-shadow: inset 0 0 0 3px var(--ink); }
.arc-card__thumb { aspect-ratio: 3 / 2; border-radius: 18px; overflow: hidden; background: var(--paper); display: grid; place-items: center; }
.arc-card__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.arc-card__empty { font-size: 22px; font-weight: 900; }
.arc-card__meta { padding: 0 4px; }
.arc-card__name { margin: 0; font-size: 20px; font-weight: 900; line-height: 1.1; word-break: break-word; }
.arc-card__date { margin: 4px 0 0; font-size: 12px; font-weight: 700; opacity: .8; }
.arc-card__actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- SHEET (modal) ---------- */
.scrim { position: fixed; inset: 0; z-index: 100; background: rgba(30, 40, 30, .28); display: flex; justify-content: flex-end; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: min(480px, 100%); height: 100%; background: var(--block-soft); color: var(--ink);
  display: flex; flex-direction: column; box-shadow: -10px 0 40px rgba(0,0,0,.12);
  animation: slide-in .28s var(--ease);
}
@keyframes slide-in { from { transform: translateX(40px); opacity: 0; } }
.sheet__head { display: flex; justify-content: space-between; align-items: center; padding: 22px 24px 8px; }
.sheet__title { margin: 0; font-size: 28px; font-weight: 900; letter-spacing: -.01em; }
.sheet__body { flex: 1; overflow-y: auto; padding: 8px 24px 20px; }
.sheet__text { font-size: 16px; line-height: 1.4; }
.sheet__actions { display: flex; gap: 10px; align-items: center; padding: 14px 24px 22px; border-top: 2px solid rgba(47,74,46,.12); }
.sheet__actions .spacer { flex: 1; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; font-size: 26px; line-height: 1; font-weight: 700; }
.icon-btn:hover { background: var(--block); }
.ev-form { display: flex; flex-direction: column; gap: 16px; }
.atts { display: flex; flex-wrap: wrap; gap: 8px; }
.att { position: relative; width: 84px; height: 84px; border-radius: 12px; overflow: hidden; background: var(--paper); }
.att img, .att video { width: 100%; height: 100%; object-fit: cover; display: block; }
.att__x { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; font-size: 16px; line-height: 1; }

/* ---------- toast ---------- */
#toast {
  position: fixed; z-index: 200; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: var(--ink-strong); color: #fff; padding: 12px 18px; border-radius: 14px;
  font-size: 14px; font-weight: 700; max-width: min(520px, 90vw); text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s var(--ease);
}
#toast.is-on { opacity: 1; transform: translate(-50%, 0); }

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