/* css/cartoony.css: CodedLife's UI design system, the CodedCartoony world (Paper dark palette) of CodedDesign
   (@kenselasie/codeddesign 0.1.5, https://codeddesign.codedguy.com/). Single source of truth for menus, sheets, forms,
   notices and the loading screen; read DESIGN.md first. Rules: use these tokens & primitives only (no new hex in
   components), 2px cream strokes, plush blurred shadows (never zero-blur hard offsets), Fredoka for display, Nunito for
   body, tilt only stickers. The in-play HUD keeps the graphite glass system in style.css. */

:root {
  /* colour: Paper dark (cream-on-ink) */
  --cc-bg: #16121e;          /* page ground, wells behind fields */
  --cc-surface: #2a2438;     /* cards, sheets, bubbles */
  --cc-surface-veil: rgba(42, 36, 56, 0.62); /* the surface, see-through: a card over live play (the match's end) */
  --cc-raised: #362e48;      /* controls on a surface: keycaps, segment tracks, quiet buttons */
  --cc-raised-2: #443a58;    /* hover on raised */
  --cc-track: #54486a;       /* progress / slider / switch tracks */
  --cc-text: #fff7ef;        /* primary text */
  --cc-stroke: #fff7ef;      /* the 2px outline */
  --cc-stroke-soft: rgba(255, 247, 239, 0.35); /* resting field borders */
  --cc-divider: rgba(255, 247, 239, 0.12);
  --cc-steel: #e8d0be;       /* secondary text */
  --cc-concrete: #b09c94;    /* tertiary text, captions */
  --cc-on-pastel: #2a2438;   /* text on gold & pastel stickers */
  --cc-gold: #ffc21a;        /* CodedLife taxi gold: the accent (primary CTA, selected, progress) */
  --cc-gold-soft: rgba(255, 194, 26, 0.14);
  --cc-pink: #ff8caf;
  --cc-pink-light: #ffbed2;
  --cc-blue: #3d78eb;
  --cc-blue-light: #7db0ff;
  --cc-mint: #a0e8be;
  --cc-green: #6edca0;
  --cc-danger: #ff8098;
  --cc-danger-soft: rgba(255, 128, 152, 0.14);
  --cc-ok-soft: rgba(110, 220, 160, 0.14);

  /* type */
  --cc-display: 'Fredoka', 'Nunito', system-ui, sans-serif;
  --cc-body: 'Nunito', system-ui, sans-serif;

  /* shape */
  --cc-stroke-w: 2px;
  --cc-r-s: 10px;
  --cc-r-m: 16px;
  --cc-r-l: 22px;
  --cc-r-pill: 999px;

  /* elevation (dark: soft & blurred) */
  --cc-s1: 0 4px 16px rgba(0, 0, 0, 0.35);
  --cc-s2: 0 8px 24px rgba(0, 0, 0, 0.4);
  --cc-s3: 0 14px 36px rgba(0, 0, 0, 0.45);
  --cc-s4: 0 22px 48px rgba(0, 0, 0, 0.5);

  /* motion: quick ease-out; a small overshoot for things that pop in */
  --cc-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --cc-pop: cubic-bezier(0.34, 1.56, 0.64, 1);
  --cc-fast: 0.16s;
}

/* ---- Card / sheet: an opaque surface with the cream outline ---- */
.cc-card {
  border: var(--cc-stroke-w) solid var(--cc-stroke);
  border-radius: var(--cc-r-l);
  background: var(--cc-surface);
  box-shadow: var(--cc-s3);
  color: var(--cc-text);
}

/* ---- Buttons: lift on hover, dip on press (aliases: the menu's .btn-primary / .btn-quiet / .btn-danger) ---- */
.cc-btn, .btn-primary, .btn-quiet, .btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 18px;
  border: var(--cc-stroke-w) solid var(--cc-stroke);
  border-radius: var(--cc-r-m);
  background: var(--cc-raised);
  color: var(--cc-text);
  font: 600 16px/1.1 var(--cc-display);
  letter-spacing: 0.01em;
  box-shadow: var(--cc-s1);
  cursor: pointer;
  transition: transform var(--cc-fast) ease-out, box-shadow var(--cc-fast) ease-out, background var(--cc-fast) ease-out;
}
.cc-btn:hover:not(:disabled), .btn-primary:hover:not(:disabled), .btn-quiet:hover:not(:disabled), .btn-danger:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--cc-s2);
}
.cc-btn:active:not(:disabled), .btn-primary:active:not(:disabled), .btn-quiet:active:not(:disabled), .btn-danger:active:not(:disabled) {
  transform: translateY(1px) scale(0.96);
  box-shadow: none;
}
.cc-btn:focus-visible, .btn-primary:focus-visible, .btn-quiet:focus-visible, .btn-danger:focus-visible {
  outline: 2px solid var(--cc-gold);
  outline-offset: 3px;
}
.cc-btn:disabled, .btn-primary:disabled, .btn-quiet:disabled, .btn-danger:disabled { opacity: 0.6; cursor: progress; }
.cc-btn--primary, .btn-primary { background: var(--cc-gold); color: var(--cc-on-pastel); }
.cc-btn--subtle, .btn-quiet { background: var(--cc-raised); }
.cc-btn--subtle:hover:not(:disabled), .btn-quiet:hover:not(:disabled) { background: var(--cc-raised-2); }
.cc-btn--danger, .btn-danger { background: var(--cc-danger); color: var(--cc-on-pastel); }

/* ---- Icon button: round, outlined (aliases: sheet close) ---- */
.cc-icon-btn, .settings-close {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border: var(--cc-stroke-w) solid var(--cc-stroke);
  border-radius: 50%;
  background: var(--cc-raised);
  color: var(--cc-text);
  box-shadow: var(--cc-s1);
  transition: transform var(--cc-fast) ease-out, background var(--cc-fast) ease-out;
}
.cc-icon-btn:hover, .settings-close:hover { background: var(--cc-raised-2); transform: rotate(-6deg); }
.cc-icon-btn:active, .settings-close:active { transform: scale(0.92); }
.cc-icon-btn:focus-visible, .settings-close:focus-visible { outline: 2px solid var(--cc-gold); outline-offset: 3px; }

/* ---- Sticker: a tilted label (tones: gold default, pink, mint, blue) ---- */
.cc-sticker {
  display: inline-block;
  padding: 6px 12px;
  border: var(--cc-stroke-w) solid var(--cc-stroke);
  border-radius: var(--cc-r-s);
  background: var(--cc-gold);
  color: var(--cc-on-pastel);
  font: 600 13px/1 var(--cc-display);
  letter-spacing: 0.01em;
  white-space: nowrap;
  box-shadow: var(--cc-s1);
  transform: rotate(-6deg);
}
.cc-sticker--pink { background: var(--cc-pink-light); }
.cc-sticker--mint { background: var(--cc-mint); }
.cc-sticker--blue { background: var(--cc-blue-light); }

/* ---- Speech bubble: callout with a tail on its left ---- */
.cc-bubble {
  position: relative;
  padding: 9px 16px 10px;
  border: var(--cc-stroke-w) solid var(--cc-stroke);
  border-radius: var(--cc-r-m);
  background: var(--cc-surface);
  box-shadow: var(--cc-s1);
  font-weight: 700;
}
.cc-bubble::before {
  content: '';
  position: absolute;
  left: -9px;
  bottom: 9px;
  width: 14px;
  height: 14px;
  border-left: var(--cc-stroke-w) solid var(--cc-stroke);
  border-bottom: var(--cc-stroke-w) solid var(--cc-stroke);
  background: inherit;
  transform: rotate(45deg) skew(8deg, 8deg);
}

/* bubble with its tail under its middle (a speech bubble over someone's head) */
.cc-bubble--down::before {
  left: 50%;
  bottom: -9px;
  margin-left: -7px;
  border-left: 0;
  border-right: var(--cc-stroke-w) solid var(--cc-stroke);
  transform: rotate(45deg);
}

/* ---- Keycap ---- */
.cc-key {
  display: inline-grid;
  place-items: center;
  min-width: 1.9em;
  padding: 1px 7px 2px;
  margin: 0 1px;
  border: var(--cc-stroke-w) solid var(--cc-stroke);
  border-bottom-width: 4px;
  border-radius: 8px;
  background: var(--cc-raised);
  color: var(--cc-gold);
  font: 600 12.5px/1.35 var(--cc-display);
  text-align: center;
}

/* ---- Pill tabs (aria-selected="true" is the current one) ---- */
.cc-tab {
  flex: none;
  padding: 8px 14px;
  border: var(--cc-stroke-w) solid transparent;
  border-radius: var(--cc-r-pill);
  color: var(--cc-steel);
  font: 600 14px/1.2 var(--cc-display);
  transition: background var(--cc-fast) ease-out, color var(--cc-fast) ease-out, border-color var(--cc-fast) ease-out;
}
.cc-tab:hover { color: var(--cc-text); background: var(--cc-raised); }
.cc-tab[aria-selected="true"] { border-color: var(--cc-stroke); background: var(--cc-gold); color: var(--cc-on-pastel); box-shadow: var(--cc-s1); }
.cc-tab:focus-visible { outline: 2px solid var(--cc-gold); outline-offset: 2px; }

/* ---- Text field ---- */
.cc-field {
  height: 46px;
  padding: 0 14px;
  border: var(--cc-stroke-w) solid var(--cc-stroke-soft);
  border-radius: var(--cc-r-m);
  background: var(--cc-bg);
  color: var(--cc-text);
  font: 500 15px/1 var(--cc-body);
  caret-color: var(--cc-gold);
  transition: border-color var(--cc-fast) ease-out, box-shadow var(--cc-fast) ease-out;
}
.cc-field:hover { border-color: rgba(255, 247, 239, 0.6); }
.cc-field:focus { outline: none; border-color: var(--cc-gold); box-shadow: 0 0 0 4px var(--cc-gold-soft); }

/* ---- Pill progress (set --p 0..1) ---- */
.cc-progress {
  height: 26px;
  padding: 3px;
  border: var(--cc-stroke-w) solid var(--cc-stroke);
  border-radius: var(--cc-r-pill);
  background: var(--cc-track);
  box-shadow: var(--cc-s2), inset 0 3px 0 rgba(0, 0, 0, 0.18);
}
.cc-progress > i {
  display: block;
  height: 100%;
  width: max(16px, calc(var(--p, 0) * 100%));
  border-radius: var(--cc-r-pill);
  background: linear-gradient(rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0) 55%), var(--cc-gold);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.14);
  transition: width 0.45s var(--cc-ease);
}

@media (prefers-reduced-motion: reduce) {
  .cc-btn, .btn-primary, .btn-quiet, .btn-danger, .cc-icon-btn, .settings-close, .cc-progress > i { transition: none; }
}
