/* Kiosk UI – tuned for Surface Go 1 (1800×1200 @150 % ≈ 1200×800 CSS px), touch only. */

:root {
  --bg: #f6f3ec;
  --surface: #ffffff;
  --ink: #1f2328;
  --muted: #5f6368;
  --line: #dcd6c8;
  --accent: #1d5c7a;
  --accent-ink: #ffffff;
  --accent-soft: #e2eef3;
  --danger: #b42318;

  --s1: #e5484d;
  --s2: #f28c38;
  --s3: #f5c518;
  --s4: #8cc63f;
  --s5: #2fb36b;
  --face-ink: #2b2118;

  --radius: 18px;
  --tap: 72px;                 /* minimum touch target */
  font-size: clamp(16px, 1.45vw, 22px);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: "Ubuntu", "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;          /* no double-tap zoom */
  overscroll-behavior: none;           /* no pull-to-refresh / swipe navigation */
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; cursor: pointer; }
h1 { font-size: clamp(2rem, 4.4vw, 3.4rem); line-height: 1.1; margin: 0 0 .4em; font-weight: 700; letter-spacing: -.01em; text-align: center; }
h2 { font-size: 1.5rem; margin: 0 0 .8rem; }
.muted { color: var(--muted); }
.lead { font-size: 1.45rem; color: var(--muted); text-align: center; max-width: 34em; margin: 0 auto 2rem; line-height: 1.4; }
.mono { font-family: "Ubuntu Mono", ui-monospace, monospace; letter-spacing: .04em; white-space: nowrap; }

#app { position: fixed; inset: 0; }

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 2.5rem;
  animation: screen-in 280ms ease-out;
}
@keyframes screen-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------ buttons */
.btn {
  min-height: var(--tap);
  padding: 0 2.4rem;
  border-radius: 999px;
  border: 2px solid transparent;
  font-size: 1.35rem;
  font-weight: 600;
  transition: transform 120ms ease, background-color 120ms ease;
}
.btn:active { transform: scale(.96); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:disabled { opacity: .5; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-wide { width: 100%; }
.actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* ------------------------------------------------------------ smileys */
.rate-header { text-align: center; margin-bottom: clamp(1.5rem, 5vh, 3.5rem); }
.rate-header p { font-size: 1.4rem; margin: 0; }

.smileys {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: clamp(.75rem, 2.4vw, 2.5rem);
  width: min(94vw, 1500px);
}
.smiley {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .8rem;
  padding: .5rem;
  background: none;
  border: 0;
  border-radius: 24px;
  transition: transform 160ms cubic-bezier(.3, 1.5, .6, 1), opacity 200ms ease, filter 200ms ease;
}
.smiley .face { width: 100%; max-height: 38vh; filter: drop-shadow(0 6px 12px rgb(0 0 0 / .12)); }
.smiley:active { transform: scale(.93); }
.smiley-label { font-size: 1.15rem; font-weight: 600; color: var(--muted); text-align: center; }

.smileys.has-pick .smiley:not(.is-picked) { opacity: .25; }
.smiley.is-picked { transform: scale(1.12); }

.smileys.is-cooling .smiley { opacity: .35; filter: grayscale(.6); }
.smileys.is-cooling .smiley:active { transform: none; }

.cooldown { width: 220px; height: 6px; border-radius: 3px; background: var(--line); margin-top: 2.5rem; overflow: hidden; visibility: hidden; }
.cooldown.is-active { visibility: visible; }
.cooldown-bar { display: block; height: 100%; background: var(--accent); transform-origin: left; }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

/* face drawing */
.face-1 { --c: var(--s1); } .face-2 { --c: var(--s2); } .face-3 { --c: var(--s3); }
.face-4 { --c: var(--s4); } .face-5 { --c: var(--s5); }
.face-bg { fill: var(--c); }
.face .eye { fill: var(--face-ink); }
.face .mouth, .face .brow, .face .eye-smile { fill: none; stroke: var(--face-ink); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.face .mouth-open { fill: var(--face-ink); stroke: var(--face-ink); stroke-width: 4; stroke-linejoin: round; }
.face .tear { fill: #7cc4f0; }

/* ------------------------------------------------------------ thank you / done */
.thanks { display: flex; flex-direction: column; align-items: center; }
.thanks-face { width: min(26vmin, 240px); margin-bottom: 1.5rem; animation: pop 500ms cubic-bezier(.3, 1.6, .5, 1); }
.thanks-face .face { width: 100%; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }

.done-check { width: min(22vmin, 200px); margin-bottom: 1.5rem; }
.done-check svg { width: 100%; fill: none; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.done-check circle { stroke: var(--s5); fill: color-mix(in srgb, var(--s5) 12%, transparent); }
.done-check path { stroke: var(--s5); stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw 500ms 200ms ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ------------------------------------------------------------ sign-up */
#screen-signup { justify-content: stretch; align-items: stretch; padding: 1.5rem 2rem 1.25rem; }
.signup {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 2rem;
  height: 100%;
}
.signup-options { display: flex; flex-direction: column; min-height: 0; }
.option-list {
  flex: 1;
  overflow-y: auto;
  touch-action: pan-y;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: .7rem;
  padding: 2px 6px 1rem 2px;
}
.option-heading { margin: .8rem 0 0; font-size: .95rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.option {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: var(--tap);
  padding: .8rem 1.1rem;
  text-align: left;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 120ms ease, background-color 120ms ease;
}
.option[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
.option-box {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: var(--surface) center / 70% no-repeat;
}
.option[aria-checked="true"] .option-box {
  border-color: var(--accent);
  background-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}
.option-text { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.option-title { font-size: 1.2rem; font-weight: 600; }
.option-desc { font-size: .95rem; color: var(--muted); }
.option-desc:empty { display: none; }

.signup-entry { display: flex; flex-direction: column; min-height: 0; }
.label { font-size: 1.1rem; font-weight: 600; margin-bottom: .5rem; }
.text-field {
  width: 100%;
  height: 68px;
  padding: 0 1.1rem;
  font: inherit;
  font-size: 1.6rem;
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  user-select: text;
  caret-color: var(--accent);
}
.text-field:focus { border-color: var(--accent); }
.text-field.is-valid { border-color: var(--s5); }
.form-error { min-height: 1.6em; margin: .35rem 0 .25rem; color: var(--danger); font-weight: 600; }
.consent { font-size: .85rem; color: var(--muted); margin: .6rem 0 .9rem; line-height: 1.4; }
.signup-entry .actions { justify-content: flex-end; margin-top: auto; }

/* ------------------------------------------------------------ on-screen keyboard */
.keyboard { display: flex; flex-direction: column; gap: .5rem; }
.kb-row { display: flex; gap: .5rem; }
.kb-key {
  flex: 1 1 0;
  min-width: 0;
  min-height: 64px;
  padding: 0 .3rem;
  font-size: 1.35rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom-width: 3px;
  border-radius: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kb-key.kb-wide { flex-grow: 2.6; font-size: 1.1rem; }
.kb-key.kb-fn { background: #ece7dc; font-weight: 600; font-size: 1.15rem; }
.kb-key.is-down { background: var(--accent-soft); transform: translateY(2px); border-bottom-width: 1px; }

/* ------------------------------------------------------------ pairing */
.pair { width: min(760px, 100%); }
.pair h1 { font-size: 2.4rem; }
.pair p { text-align: center; font-size: 1.15rem; }
.pair .text-field { text-align: center; font-size: 2rem; }
.pair .keyboard { margin: .25rem 0 1.25rem; }

/* ------------------------------------------------------------ chrome */
.idle-bar { position: fixed; left: 0; right: 0; bottom: 0; height: 6px; background: rgb(0 0 0 / .05); }
.idle-bar span { display: block; height: 100%; background: var(--accent); opacity: .55; transform-origin: left; }
@keyframes idle-drain { from { transform: scaleX(1); } to { transform: scaleX(0); } }

.status {
  position: fixed;
  top: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .3rem .7rem;
  font-size: .8rem;
  color: var(--muted);
  background: rgb(255 255 255 / .75);
  border-radius: 999px;
}
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--s2); }
.status.is-offline .status-dot { background: var(--s1); }

.corner-hotspot { position: fixed; top: 0; left: 0; width: 80px; height: 80px; z-index: 5; }

dialog#maint {
  border: 0;
  border-radius: 24px;
  padding: 2rem;
  width: min(560px, 90vw);
  box-shadow: 0 20px 60px rgb(0 0 0 / .25);
}
dialog#maint::backdrop { background: rgb(0 0 0 / .35); }
#maint-info { display: grid; grid-template-columns: auto 1fr; gap: .5rem 1.25rem; margin: 0 0 1.5rem; }
#maint-info dt { color: var(--muted); }
#maint-info dd { margin: 0; font-weight: 600; word-break: break-word; }

/* Smaller / portrait screens (useful when testing on a laptop or phone) */
@media (max-width: 820px) {
  .smileys { grid-template-columns: repeat(5, 1fr); gap: .5rem; }
  .smiley-label { font-size: .8rem; }
  .signup { grid-template-columns: 1fr; overflow-y: auto; }
}
