/* Winter Letters · visual & interaction refinements, 2026-11-27 */
:root {
  --shadow: 0 20px 60px rgba(10, 33, 44, .15);
  --ease: cubic-bezier(.22, .8, .25, 1);
}
::selection { color: #fff; background: #527e78; }
body { background: #eaf1f1; }
button, a, input, textarea { -webkit-tap-highlight-color: transparent; }
button:active:not(:disabled), .btn:active:not(:disabled) { transform: translateY(0) scale(.98); }
button:disabled { cursor: not-allowed; }
.brand { text-decoration: none; }
.brand-mark { transition: transform .5s var(--ease), background .2s; }
.brand:hover .brand-mark { transform: rotate(18deg); background: rgba(255,255,255,.17); }
.ambient {
  background:
    radial-gradient(ellipse at 8% 14%, rgba(255,255,255,.9), transparent 34%),
    radial-gradient(ellipse at 90% 90%, rgba(178,207,213,.42), transparent 40%),
    linear-gradient(145deg, #f3f7f5, #e5eff1 65%, #edf1eb);
}
.snow { opacity: .58; }
.snow::after {
  position: absolute; inset: -20% 0 0; content: "";
  background-image: radial-gradient(1px 1px at 22px 42px, rgba(255,255,255,.95) 98%, transparent),
    radial-gradient(2px 2px at 182px 126px, rgba(255,255,255,.7) 98%, transparent);
  background-size: 230px 240px; animation: ui-snow 36s linear infinite;
}
.snow-off .snow { display: none; }
@keyframes ui-snow { to { transform: translate3d(36px, 35vh, 0); } }
.topbar::before { background: linear-gradient(105deg, rgba(12,34,46,.98), rgba(20,54,64,.95)); }
.tab { position: relative; }
.tab[aria-selected="true"] { box-shadow: 0 4px 16px rgba(0,0,0,.16), inset 0 0 0 1px rgba(255,255,255,.65); }
.snow-toggle {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 38px; min-height: 38px; padding: 0 10px; border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px; color: #eaf3f0; background: rgba(255,255,255,.06); font-size: 11px;
}
.snow-toggle:hover { background: rgba(255,255,255,.13); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.home-view { border-radius: 26px; box-shadow: 0 25px 70px rgba(10,33,44,.18); }
.home-view::after {
  position: absolute; inset: 0; content: ""; pointer-events: none;
  background: linear-gradient(115deg, transparent 25%, rgba(255,255,255,.08) 42%, transparent 58%);
  transform: translateX(-100%); animation: ui-light 9s ease-in-out 2s infinite;
}
@keyframes ui-light { 0%, 65% { transform: translateX(-100%); } 90%, 100% { transform: translateX(100%); } }
.home-copy h1 { text-shadow: 0 3px 24px rgba(0,0,0,.18); }
.home-copy p { font-size: 15px; }
.btn { min-height: 44px; font-size: 12px; letter-spacing: .02em; }
.btn-primary { box-shadow: 0 9px 25px rgba(0,0,0,.15); }
.btn-dark { background: linear-gradient(135deg, #275b52, #1d4845); box-shadow: 0 5px 14px rgba(39,91,82,.16); }
.btn-dark:hover:not(:disabled) { background: linear-gradient(135deg, #326b60, #234f4b); box-shadow: 0 8px 20px rgba(39,91,82,.22); }
.btn:disabled { opacity: .55; transform: none; }
.pane { border-radius: 21px; }
.pane-heading h2 { font-size: 25px; }
.field label { color: #3f6067; font-size: 12px; }
.field input, .field textarea { border-radius: 11px; font-size: 14px; }
.field input { height: 42px; padding-inline: 12px; }
.field textarea { min-height: 96px; padding: 11px 12px; }
.field input:hover, .field textarea:hover { border-color: #b8cccb; }
.field-foot { font-size: 11px; }
.field-hint { display: block; margin-top: 4px; color: #829597; font-size: 10px; }
.theme-chip { min-height: 36px; padding-inline: 13px; font-size: 11px; }
.editor-actions .btn { min-height: 42px; font-size: 11px; }
.status { font-size: 11px; }
.draft-state { display: block; margin-top: 5px; color: #829597; font-size: 9px; font-weight: 400; letter-spacing: 0; }
.inspiration-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.text-btn { padding: 3px 0; border: 0; color: #517b78; background: transparent; font-size: 11px; }
.text-btn:hover { color: #214f49; text-decoration: underline; text-underline-offset: 3px; }
.text-btn + .text-btn { margin-left: 12px; }
#char-count.near-limit { color: var(--berry); font-weight: 700; }
.card-preview { box-shadow: inset 0 0 0 1px rgba(33,83,99,.06), 0 12px 30px rgba(31,66,74,.09); }
.card-preview[data-theme="snow"] { background: radial-gradient(circle at 82% 17%, rgba(255,255,255,.94), transparent 19%), linear-gradient(145deg,#dfeff2,#abcfd8 53%,#f3ead8); }
.card-preview[data-theme="pine"] { background: radial-gradient(circle at 82% 17%,rgba(255,255,255,.22),transparent 19%),linear-gradient(145deg,#173d3a,#416f63 58%,#9ab8a5); }
.card-preview[data-theme="berry"] { background: radial-gradient(circle at 82% 17%,rgba(255,255,255,.35),transparent 19%),linear-gradient(145deg,#66303f,#a45360 58%,#dfb29c); }
.card-preview.ui-tickle { animation: ui-card .38s var(--ease); }
@keyframes ui-card { 50% { transform: translateY(-3px) rotate(.25deg); box-shadow: 0 18px 38px rgba(31,66,74,.16); } }
.card-message { font-size: 14px; line-height: 1.95; }
.card-to, .card-top, .card-bottom { font-size: 10px; }
.card-brand { font-size: 9px; }
.wall-description, .wall-state, .wall-paging { font-size: 11px; }
.wall-card { transition: transform .22s var(--ease), box-shadow .22s; animation: ui-wall-in .4s var(--ease) both; }
.wall-card:nth-child(2) { animation-delay: .04s; }
.wall-card:nth-child(3) { animation-delay: .08s; }
.wall-card:nth-child(4) { animation-delay: .12s; }
.wall-card:hover { transform: translateY(-3px) rotate(-.15deg); box-shadow: 0 16px 34px rgba(23,55,66,.1); }
@keyframes ui-wall-in { from { opacity: 0; transform: translateY(8px); } }
.wall-message { font-size: clamp(15px,1.4vw,18px); }
.wall-to { font-size: 11px; }
.wall-bottom { font-size: 10px; }
.wall-empty { position: relative; font-size: 13px; }
.empty-action { margin-top: 12px; }
.nav-position button { position: relative; }
.nav-position button::before { position: absolute; inset: -10px; content: ""; }
.nav-hint, .screen-label { font-size: 10px; }
.toast { border-radius: 14px; font-size: 12px; box-shadow: 0 15px 45px rgba(8,29,40,.22); }
.review-dialog { border-radius: 22px; }
.review-dialog > p { font-size: 12px; }
.review-check { font-size: 12px; cursor: pointer; }
.review-check input { width: 17px; height: 17px; }
.share-dialog { width: min(520px, 100%); }
.share-link { display: flex; gap: 8px; margin: 16px 0 10px; }
.share-link input { min-width: 0; flex: 1; height: 42px; padding: 0 11px; border: 1px solid #d5e2e0; border-radius: 10px; color: #36565d; background: #f7faf8; font-size: 12px; }
.share-link .btn { flex: 0 0 auto; min-height: 42px; }
.share-note { color: #71878a; font-size: 11px; line-height: 1.7; }
.share-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.share-actions .btn { flex: 1; }
[hidden] { display: none !important; }

@media (max-width: 760px) {
  html, body { height: 100%; min-height: 100%; overflow: hidden; }
  .app-shell { height: 100dvh; min-height: 0; grid-template-rows: 62px minmax(0,1fr) 64px; }
  .topbar { width: calc(100% - 24px); }
  .top-actions { gap: 4px; }
  .preview-tag { display: none; }
  .snow-toggle { min-width: 34px; min-height: 34px; padding: 0; }
  .snow-toggle span { display: none; }
  .tab { min-height: 38px; padding-inline: 10px; font-size: 12px; }
  .brand-name { font-size: 14px; }
  .stage { min-height: 0; padding: 10px; overflow: auto; overscroll-behavior: contain; }
  .view { height: auto; min-height: 100%; }
  .home-view { min-height: 100%; overflow: hidden; }
  .home-copy { padding: 70px 25px 100px; }
  .home-copy h1 { font-size: clamp(43px, 13vw, 62px); }
  .home-copy p { font-size: 14px; line-height: 1.9; }
  .home-actions .btn { min-height: 44px; padding-inline: 16px; font-size: 12px; }
  .home-note { font-size: 10px; }
  .studio-view.active { display: flex; flex-direction: column; gap: 12px; min-height: max-content; }
  .editor-pane, .preview-pane { flex: none; }
  .pane { padding: 18px 16px; border-radius: 17px; }
  .pane-heading { margin-bottom: 14px; }
  .pane-heading h2 { font-size: 22px; }
  .pane-kicker { margin-bottom: 5px; font-size: 9px; }
  .step-tag { font-size: 10px; }
  .form-grid { gap: 13px; }
  .field { gap: 6px; }
  .field-row { gap: 10px; }
  .field label { font-size: 12px; }
  .field input { height: 43px; padding-inline: 11px; font-size: 16px; }
  .field textarea { height: auto; min-height: 112px; padding: 10px 11px; font-size: 16px; line-height: 1.75; resize: vertical; }
  .field-hint { font-size: 11px; line-height: 1.6; }
  .field-foot { font-size: 10px; }
  .theme-picker { flex-wrap: wrap; gap: 7px; }
  .theme-chip { min-height: 38px; padding-inline: 11px; font-size: 11px; }
  .text-btn { min-height: 30px; font-size: 12px; }
  .editor-bottom { gap: 9px; padding-top: 14px; }
  .editor-actions { gap: 8px; }
  .editor-actions .btn { min-height: 44px; padding-inline: 9px; font-size: 11px; }
  .status { min-height: 18px; font-size: 11px; }
  .preview-pane { min-height: 330px; }
  .preview-pane .pane-heading { margin-bottom: 10px; }
  .preview-pane .pane-heading h2 { font-size: 20px; }
  .preview-meta { font-size: 10px; }
  .card-preview { min-height: 245px; padding: 21px 19px; border-radius: 13px; }
  .card-center { padding: 18px 0; }
  .card-to { margin-bottom: 8px; font-size: 11px; }
  .card-center h3 { margin-bottom: 10px; font-size: 23px; }
  .card-message { min-height: 50px; font-size: 14px; line-height: 1.8; }
  .card-top, .card-bottom { font-size: 9px; }
  .wall-view.active { min-height: 100%; gap: 13px; }
  .wall-head { align-items: start; }
  .wall-head h2 { font-size: 24px; }
  .wall-description { max-width: 130px; font-size: 10px; }
  .wall-state, .wall-paging { font-size: 10px; }
  .wall-grid { flex: none; grid-template-columns: 1fr; grid-template-rows: none; gap: 10px; }
  .wall-card { min-height: 160px; padding: 17px; border-radius: 14px; }
  .wall-to { font-size: 11px; }
  .wall-message { font-size: 15px; line-height: 1.8; }
  .wall-bottom { font-size: 10px; }
  .wall-refresh { min-height: 36px; font-size: 10px; }
  .arrow-btn { width: 36px; height: 36px; }
  .nav-hint { font-size: 9px; }
  .nav-position button { width: 7px; height: 7px; }
  .nav-arrows .arrow-btn { width: 38px; height: 38px; }
  .screen-label { font-size: 10px; }
  .toast { right: 12px; bottom: 76px; left: 12px; max-width: none; font-size: 12px; text-align: center; }
  .review-backdrop { padding: 14px; overflow: auto; }
  .review-dialog { padding: 21px; }
  .share-link { flex-direction: column; }
  .share-link input { flex: none; width: 100%; font-size: 12px; }
}
@media (max-width: 370px) {
  .tab { padding-inline: 8px; font-size: 11px; }
  .brand-caption { display: none; }
  .brand-name { font-size: 13px; }
  .snow-toggle { display: none; }
  .home-stamp { opacity: .75; }
  .field-row { grid-template-columns: 1fr; }
  .editor-actions { flex-direction: column; }
  .nav-hint { display: none; }
  .bottom-nav { grid-template-columns: 1fr auto; }
}
@media (max-height: 620px) and (min-width: 761px) {
  .app-shell { min-height: 0; }
  .stage { overflow: auto; }
  .studio-view.active { min-height: 520px; }
}
/* Directional page movement and wheel feedback. */
.wheel-icon {
  position: relative; display: inline-block; width: 14px; height: 21px;
  border: 1px solid #8ca2a2; border-radius: 8px; vertical-align: middle;
}
.wheel-icon i {
  position: absolute; top: 4px; left: 5px; width: 2px; height: 5px;
  border-radius: 2px; background: #668481; animation: ui-wheel 1.8s ease-in-out infinite;
}
.nav-hint { position: relative; display: flex; align-items: center; gap: 8px; }
.nav-hint::after {
  position: absolute; right: 0; bottom: -9px; left: 0; height: 2px; content: "";
  border-radius: 2px; background: #5d8d85; opacity: 0;
  transform: scaleX(var(--wheel-progress, 0)); transform-origin: left; transition: opacity .15s;
}
.nav-hint.scrolling::after { opacity: .8; }
.nav-hint.bump { animation: ui-boundary .35s ease; }
@keyframes ui-wheel { 0% { opacity: 0; transform: translateY(-1px); } 35% { opacity: 1; } 100% { opacity: 0; transform: translateY(6px); } }
@keyframes ui-boundary { 50% { transform: translateX(-4px); opacity: .55; } }
@media (min-width: 761px) {
  .stage[data-transition] { perspective: 1400px; }
  .stage[data-transition] .view { grid-area: 1 / 1; backface-visibility: hidden; }
  .stage[data-transition] .view.active { position: relative; z-index: 1; animation: ui-page-next .52s var(--ease) both; }
  .stage[data-transition="previous"] .view.active { animation-name: ui-page-previous; }
  .stage .view.leaving { z-index: 0; display: flex; pointer-events: none; animation: ui-leave-next .42s ease-in both; }
  .stage .studio-view.leaving { display: grid; }
  .stage .wall-view.leaving { flex-direction: column; }
  .stage[data-transition="previous"] .view.leaving { animation-name: ui-leave-previous; }
}
@keyframes ui-page-next {
  from { opacity: 0; transform: translate3d(58px,0,0) scale(.988); filter: blur(3px); }
  to { opacity: 1; transform: none; filter: none; }
}
@keyframes ui-page-previous {
  from { opacity: 0; transform: translate3d(-58px,0,0) scale(.988); filter: blur(3px); }
  to { opacity: 1; transform: none; filter: none; }
}
@keyframes ui-leave-next {
  from { opacity: 1; transform: none; }
  to { opacity: 0; transform: translate3d(-42px,0,0) scale(.992); }
}
@keyframes ui-leave-previous {
  from { opacity: 1; transform: none; }
  to { opacity: 0; transform: translate3d(42px,0,0) scale(.992); }
}
@media (max-width: 760px) {
  .wheel-icon { display: none; }
  .nav-hint::after { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .snow::after, .home-view::after { display: none; }
  .wheel-icon i { animation: none; }
  .stage[data-transition] .view, .stage .view.leaving { filter: none !important; }
}
