/* Group Fun Hub form system: one look for every input, select, textarea and button on every page.
   Injected as the LAST stylesheet on every page by scripts/build-nav.mjs, so it wins over section styles.
   ":root:root body" raises specificity on purpose: section stylesheets (kids, couples, celebrations)
   and older page rules must not reintroduce their own heights, radii or fonts.
   Two surfaces: dark (default, on the night background) and light (inside paper panels and dialogs). */
/* The hidden attribute always hides, even when a component sets display (flex/grid buttons, labels, timers). */
[hidden]{display:none!important}

:root{
  --ctl-h:48px; --ctl-h-sm:40px; --ctl-h-lg:56px; --ctl-r:14px; --ctl-pad:14px;
  --ctl-font:500 16px/1.25 Inter,system-ui,sans-serif;
  --ctl-dark-bg:#0f2633; --ctl-dark-bg-hover:#132e3d; --ctl-dark-line:#ffffff2e; --ctl-dark-text:#fbf5ea; --ctl-dark-ph:#8fa6ad;
  --ctl-light-bg:#ffffff; --ctl-light-line:#e3d6c0; --ctl-light-text:#1d1a16; --ctl-light-ph:#9a8f80;
  --ctl-focus:#e8b659; --ctl-focus-ring:0 0 0 4px #e8b65938;
  --chev-dark:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23fbf5ea' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --chev-light:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%231d1a16' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* ---------- text inputs, selects, textareas (dark surface default) ---------- */
:root:root body :is(input:not([type=checkbox],[type=radio],[type=range],[type=color],[type=file],[type=hidden],[type=submit],[type=button],[type=reset],[type=image]),select,textarea){
  box-sizing:border-box; display:block; width:100%; max-width:100%; min-height:var(--ctl-h); margin-top:6px;
  padding:0 var(--ctl-pad); border-radius:var(--ctl-r); border:1.5px solid var(--ctl-dark-line);
  background-color:var(--ctl-dark-bg); color:var(--ctl-dark-text); font:var(--ctl-font); letter-spacing:0;
  box-shadow:none; outline:none; -webkit-appearance:none; appearance:none;
  transition:border-color .15s ease,box-shadow .15s ease,background-color .15s ease;
}
/* textarea/select refinements must outrank the shared base rule above (same specificity, later) */
:root:root:root body textarea{padding:12px var(--ctl-pad); min-height:112px; line-height:1.5; resize:vertical}
:root:root:root body select{padding-right:42px; background-image:var(--chev-dark); background-repeat:no-repeat; background-position:right 16px center; background-size:12px 8px; cursor:pointer; text-overflow:ellipsis}
:root:root body :is(input,select,textarea):hover:not(:focus,:disabled){border-color:#ffffff4d}
:root:root body :is(input:not([type=checkbox],[type=radio],[type=range]),select,textarea):focus,
:root:root body :is(input:not([type=checkbox],[type=radio],[type=range]),select,textarea):focus-visible{border-color:var(--ctl-focus); box-shadow:var(--ctl-focus-ring); outline:none}
:root:root body :is(input,textarea)::placeholder{color:var(--ctl-dark-ph); opacity:1}
:root:root body :is(input,select,textarea):disabled{opacity:.55; cursor:not-allowed}
:root:root body :is(input,textarea)[aria-invalid=true],:root:root body :is(input,textarea):user-invalid{border-color:#ff8fa0}
/* inputs placed inline (join codes, steppers) keep the same height without the label gap */
:root:root body :is(.row,.join-code,.cel-join,.adder,.stepper,.pairadd,form.row) > :is(input,select){margin-top:0}

/* ---------- light surfaces: paper panels, cards, dialogs ---------- */
:root:root body :is(.panel,.card,.cel-paper,dialog,#gs-pop,.couple-setup) :is(input:not([type=checkbox],[type=radio],[type=range],[type=color],[type=file],[type=hidden],[type=submit],[type=button],[type=reset],[type=image]),select,textarea){
  background-color:var(--ctl-light-bg); border-color:var(--ctl-light-line); color:var(--ctl-light-text);
}
:root:root body :is(.panel,.card,.cel-paper,dialog,.couple-setup) select{background-image:var(--chev-light)}
:root:root body :is(.panel,.card,.cel-paper,dialog,.couple-setup) :is(input,select,textarea):hover:not(:focus,:disabled){border-color:#cbbb9f}
:root:root body :is(.panel,.card,.cel-paper,dialog,.couple-setup) :is(input,textarea)::placeholder{color:var(--ctl-light-ph)}
:root:root body :is(.panel,.card,.cel-paper,dialog,.couple-setup) :is(input,select,textarea):focus{border-color:var(--ctl-focus); box-shadow:var(--ctl-focus-ring)}

/* ---------- deliberate variants, same family ---------- */
/* compact fields inside list rows (Secret Santa people: hint + email) */
:root:root body .pmain input{min-height:var(--ctl-h-sm); margin-top:6px; padding:0 12px; font-size:14px; border-radius:12px}
/* kids answer field: bigger, bold, uppercase game input in the shared shape */
:root:root body #word-answer{min-height:var(--ctl-h-lg); font:700 22px/1 Inter,system-ui,sans-serif; letter-spacing:.08em; text-transform:uppercase; text-align:center;
  border-radius:var(--ctl-r); border:1.5px solid var(--ctl-dark-line); background-color:var(--ctl-dark-bg); color:var(--ctl-dark-text); padding:0 var(--ctl-pad)}
:root:root body #word-answer:focus{border-color:var(--ctl-focus); box-shadow:var(--ctl-focus-ring)}

/* ---------- labels ---------- */
:root:root body :is(.field,label.field){display:block; font:600 14px/1.35 Inter,system-ui,sans-serif; margin-bottom:14px}
:root:root body .field .opt{font-weight:400; opacity:.75}

/* ---------- checkboxes & radios ---------- */
:root:root body :is(input[type=checkbox],input[type=radio]):not(.tg input,.seg input,.picker input,.colors input){width:20px; height:20px; min-height:0; margin:0; accent-color:#1d5a41; cursor:pointer; flex:none}

/* ---------- buttons: one shape, three sizes ---------- */
:root:root body .btn{min-height:var(--ctl-h); padding:0 22px; border-radius:99px; font:700 15px/1 Inter,system-ui,sans-serif; letter-spacing:.01em; white-space:nowrap}
:root:root body .btn.sm{min-height:var(--ctl-h-sm); padding:0 16px; font-size:14px}
:root:root body .btn.big{min-height:var(--ctl-h-lg); padding:0 24px; font-size:17px}
:root:root body .btn:focus-visible{outline:3px solid var(--ctl-focus); outline-offset:3px}
:root:root body .btn:disabled{opacity:.5; cursor:not-allowed; transform:none}
:root:root body .icon-btn{width:var(--ctl-h); height:var(--ctl-h)}

/* Kids games buttons follow the same system (they used a separate mint arcade style) */
:root:root body.kids-page .arcade-button{min-height:var(--ctl-h); padding:0 22px; border-radius:99px; border:0; font:700 15px/1 Inter,system-ui,sans-serif;
  color:#fff; background:linear-gradient(180deg,#e0344f,#c8203f); box-shadow:0 10px 22px -10px #c8203f,inset 0 1px 0 #ffffff40}
:root:root body.kids-page .arcade-button:hover{filter:brightness(1.06); transform:translateY(-1px); background:linear-gradient(180deg,#e0344f,#c8203f)}
:root:root body.kids-page .arcade-button.secondary{background:transparent; color:#fbf5ea; box-shadow:inset 0 0 0 1.5px #ffffff38}
:root:root body.kids-page .arcade-button.secondary:hover{background:#ffffff0d}
:root:root body.kids-page .arcade-button:focus-visible{outline:3px solid var(--ctl-focus); outline-offset:3px}

/* Segmented controls: same height family */
:root:root body .seg span{min-height:36px; display:flex; align-items:center}

@media (max-width:520px){
  /* 16px text stops iOS zooming into fields; keep comfortable touch targets */
  :root:root body .btn{padding:0 18px}
}
@media (prefers-reduced-motion:reduce){:root:root body :is(input,select,textarea,.btn){transition:none}}

/* Main menu on phones: one swipeable row instead of wrapping onto several lines */
@media (max-width:700px){
  :root:root body .site-head{flex-wrap:wrap}
  :root:root body .site-head nav{order:2; width:100%; margin:6px 0 0; display:flex; flex-wrap:nowrap; gap:4px; overflow-x:auto; scrollbar-width:none;
    -webkit-mask-image:linear-gradient(90deg,#000 85%,transparent); mask-image:linear-gradient(90deg,#000 85%,transparent)}
  :root:root body .site-head nav::-webkit-scrollbar{display:none}
  :root:root body .site-head nav a{flex:none; white-space:nowrap}
}

/* Dates and times. Safari lays out its own inner date field: keep it vertically centred, left aligned
   and free of the inner border and offset it otherwise draws inside the box. */
:root:root:root body :is(input[type=date],input[type=time],input[type=datetime-local],input[type=month]){display:flex;align-items:center;height:var(--ctl-h);padding:0 var(--ctl-pad);line-height:normal;text-align:left;min-width:0}
:root:root body :is(input[type=date],input[type=time],input[type=datetime-local],input[type=month])::-webkit-date-and-time-value{margin:0;padding:0;border:0;background:none;text-align:left;min-height:1.25em}
:root:root body :is(input[type=date],input[type=time],input[type=datetime-local],input[type=month])::-webkit-datetime-edit{margin:0;padding:0;border:0;background:none}
:root:root body :is(input[type=date],input[type=time],input[type=datetime-local],input[type=month])::-webkit-datetime-edit-fields-wrapper{padding:0}
:root:root body :is(input[type=date],input[type=time],input[type=datetime-local],input[type=month])::-webkit-calendar-picker-indicator{margin:0 0 0 auto;opacity:.6;cursor:pointer}
:root:root body :is(input[type=date],input[type=time],input[type=datetime-local],input[type=month])::-webkit-calendar-picker-indicator{filter:invert(.92)}
:root:root body :is(.panel,.card,.cel-paper,dialog,.couple-setup) :is(input[type=date],input[type=time],input[type=datetime-local],input[type=month])::-webkit-calendar-picker-indicator{filter:none}

/* Currency + amount side by side (Secret Santa budget): the shared full-width rule must not swallow the amount */
:root:root:root body .money{display:flex;gap:8px;align-items:stretch}
:root:root:root body .money select{width:96px;flex:none}
:root:root:root body .money input{flex:1 1 auto;min-width:0;width:auto}

/* Two fields in one row (card, gift, food order, trivia): side by side on wide screens, stacked on phones */
:root:root body label.field.grow{flex:1 1 180px;min-width:0}
