/* THE GOD TERMINAL — the costume's fun apps (js/costume-fun.js): Calculator, Solitaire, Sketch Pad.
 * Off-palette like the rest of the costume. */

/* ───────── shared ───────── */
.cf-menubar {
  position: relative;
  z-index: 5;
  display: flex;
  flex: none;
  gap: 0.1rem;
  padding: 0.1rem 0.25rem;
  border-bottom: 1px solid #d8d4c4;
  background: linear-gradient(#fbfaf6, #ece9d8);
}
.cf-menu {
  min-height: 1.85rem;
  padding: 0 0.65rem;
  border: 0;
  border-radius: 2px;
  background: none;
  color: #000;
  font-size: 0.875rem;
  transition: transform 120ms cubic-bezier(.2, 1.6, .4, 1);
}
.cf-menu:hover, .cf-menu.is-open { background: var(--cs-select); color: #fff; }
.cf-menu.is-pressed { transform: scale(1.1); }
.cf-dd {
  position: absolute;
  z-index: 60;
  min-width: 13rem;
  padding: 2px;
  border: 1px solid #aca899;
  background: #fff;
  box-shadow: 2px 3px 6px rgba(0, 0, 0, 0.35);
}
.cf-dd-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  min-height: 2.2rem;
  padding: 0.2rem 1rem 0.2rem 0.3rem;
  border: 0;
  background: none;
  color: #000;
  font-size: 0.875rem;
  text-align: left;
  white-space: nowrap;
  transform-origin: 15% 50%;
  transition: transform 120ms cubic-bezier(.2, 1.6, .4, 1);
}
.cf-dd-item:hover:not(:disabled) { background: var(--cs-select); color: #fff; }
.cf-dd-item:disabled { color: #a0a0a0; }
.cf-dd-item.is-pressed { transform: scale(1.05); }
.cf-dd-check { flex: none; width: 1.2rem; text-align: center; font-weight: 700; }
.cf-dd-sep { margin: 2px 4px; border: 0; border-top: 1px solid #d3d0c4; }

.cf-fx {
  position: absolute;
  inset: 0;
  z-index: 40;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.cf-fly {
  position: absolute;
  z-index: 41;
  color: #fff;
  font: 900 1.7rem/1 'Arial Black', Impact, 'Helvetica Neue', Arial, sans-serif;
  letter-spacing: 0.02em;
  white-space: nowrap;
  pointer-events: none;
  text-shadow: 0 2px 0 #1a1a1a, 2px 0 0 #1a1a1a, -2px 0 0 #1a1a1a, 0 -2px 0 #1a1a1a, 0 4px 8px rgba(0, 0, 0, 0.45);
}
.cf-fly.is-science { color: #b9f0ff; font-size: 1.9rem; }
.cf-fly.is-copy { color: #ffe27a; font-size: 1.3rem; }

/* ═════════════════════════ Calculator ═════════════════════════ */
.cs-calc .cs-app-body { background: var(--cs-face); }
.cfc {
  --cfc-spring: cubic-bezier(.2, 1.6, .4, 1);
  --cfc-ink: #1f2a1b;
  --cfc-rows: 5;
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  outline: none;
}
.cfc.is-sci { --cfc-rows: 7; }
.cfc-stage {
  position: relative;
  display: flex;
  flex: 1;
  min-height: 0;
  padding: 0.55rem 0.6rem 0.6rem;
}

/* The body: champagne plastic with a soft bevel. */
.cfc-face {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex: 1;
  min-width: 0;
  padding: 0.7rem 0.8rem 0.85rem;
  border-radius: 1.1rem;
  background:
    radial-gradient(120% 60% at 30% 0%, rgba(255, 255, 255, 0.55), transparent 60%),
    linear-gradient(170deg, #f3f0e7 0%, #e1dccd 55%, #cdc6b3 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.85),
    inset 0 -3px 6px rgba(70, 55, 20, 0.16),
    0 0 0 1px rgba(110, 96, 64, 0.55),
    0 6px 14px rgba(40, 30, 10, 0.32);
}

/* ───────── the solar cells (its eyes) ───────── */
.cfc-solar {
  position: relative;
  z-index: 4;
  flex: none;
  align-self: center;
  padding: 0.3rem 0.5rem;
  border-radius: 0.55rem;
  background: linear-gradient(180deg, #4a4247, #29242a);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.7), 0 1px 0 rgba(255, 255, 255, 0.8);
  transform-origin: 50% 0;
}
.cfc-solar.is-pulled { animation: cfc-cling 0.24s ease-in-out infinite alternate; }
@keyframes cfc-cling { from { transform: scale(1, 1.08) translateY(1px); } to { transform: scale(.96, 1.2) translateY(3px); } }
.cfc-eyes { display: flex; gap: 0.9rem; --lx: 0rem; --ly: 0rem; }
.cfc-eye { position: relative; width: 2.7rem; height: 1.6rem; }
.cfc-eye-cell {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 0.32rem;
  background:
    repeating-linear-gradient(90deg, transparent 0 0.4rem, rgba(170, 150, 255, 0.12) 0.4rem calc(0.4rem + 1px)),
    linear-gradient(160deg, #5b4268 0%, #2c1f37 55%, #170f1f 100%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: transform 180ms var(--cfc-spring), filter 180ms;
}
.cfc-eye-cell::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(125deg, rgba(255, 255, 255, 0.22) 0 18%, transparent 19% 100%);
}
.cfc-eye-glint {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.78rem;
  height: 0.78rem;
  margin: -0.39rem 0 0 -0.39rem;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 38%, #ffffff 0 32%, #d8f2ff 46%, rgba(160, 220, 255, 0.35) 62%, transparent 72%);
  box-shadow: 0 0 6px 1px rgba(150, 215, 255, 0.55);
  translate: var(--lx) var(--ly);
  transition: translate 140ms ease-out, scale 160ms var(--cfc-spring), opacity 120ms;
}
.cfc-eye-x { position: absolute; inset: 0; display: block; pointer-events: none; }
.cfc-eye-x svg { display: block; width: 100%; height: 100%; overflow: visible; }
.cfc-eye-x path {
  display: none;
  fill: none;
  stroke: #c9eeff;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 2px rgba(150, 215, 255, 0.9));
}
.cfc-eye-x .m-star { fill: #fff3a0; stroke: #ffd84d; stroke-width: 1.2; filter: drop-shadow(0 0 3px rgba(255, 220, 80, 0.95)); }
.cfc-eyes[data-mood="happy"] .m-happy, .cfc-eyes[data-mood="sleep"] .m-sleep, .cfc-eyes[data-mood="star"] .m-star,
.cfc-eyes[data-mood="dizzy"] .m-dizzy, .cfc-eyes[data-mood="x"] .m-x { display: inline; }
.cfc-eyes:is([data-mood="happy"], [data-mood="sleep"], [data-mood="star"], [data-mood="dizzy"], [data-mood="x"]) .cfc-eye-glint { opacity: 0; }
.cfc-eyes[data-mood="dizzy"] .cfc-eye-x svg { animation: cfc-spin 0.6s linear infinite; }
.cfc-eyes[data-mood="star"] .cfc-eye-x svg { animation: cfc-twinkle 0.5s ease-in-out infinite alternate; }
@keyframes cfc-spin { to { transform: rotate(360deg); } }
@keyframes cfc-twinkle { from { transform: scale(.9) rotate(-8deg); } to { transform: scale(1.18) rotate(8deg); } }
.cfc-eyes[data-mood="wide"] .cfc-eye-cell { transform: scale(1.14, 1.22); }
.cfc-eyes[data-mood="wide"] .cfc-eye-glint { scale: 0.7; }
.cfc-eyes[data-mood="scared"] .cfc-eye-cell { transform: scale(1.1, 1.3); }
.cfc-eyes[data-mood="scared"] .cfc-eye-glint { scale: 0.5; animation: cfc-tremble 0.09s linear infinite alternate; }
.cfc-eyes[data-mood="shifty"] .cfc-eye-glint { animation: cfc-shifty 0.9s steps(1) infinite; }
.cfc-eyes[data-mood="sleep"] .cfc-eye-cell { filter: brightness(0.6); }
@keyframes cfc-tremble { from { transform: translate(-1px, 0); } to { transform: translate(1px, 1px); } }
@keyframes cfc-shifty { 0% { transform: translateX(-0.75rem); } 50% { transform: translateX(0.75rem); } }

/* Lab goggles (Science mode). */
.cfc-goggles {
  position: absolute;
  left: -9.5rem;
  right: -9.5rem;
  top: 50%;
  height: 0;
  display: none;
  pointer-events: none;
}
.cfc.is-sci .cfc-goggles { display: block; }
.cfc-goggles > svg:first-child {
  position: absolute;
  left: 0;
  top: -0.42rem;
  width: 100%;
  height: 0.84rem;
}
.g-strap { fill: #2a6b52; }
.cfc-goggles-frame {
  position: absolute;
  left: 50%;
  top: -1.48rem;
  width: 7.4rem;
  height: 2.96rem;
  margin-left: -3.7rem;
  overflow: visible;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.4));
}
.g-frame { fill: #36a07a; stroke: #1c5c45; stroke-width: 2; }
.g-rim-out { fill: none; stroke: #1c5c45; stroke-width: 11; }
.g-rim { fill: none; stroke: #3cae84; stroke-width: 7.5; }
.g-lens { stroke: rgba(255, 255, 255, 0.65); stroke-width: 1.5; }
.g-shine { fill: rgba(255, 255, 255, 0.6); }
.g-vent { fill: #1c5c45; }

/* ───────── the LCD ───────── */
.cfc-lcd {
  position: relative;
  z-index: 1;
  display: flex;
  flex: 1 0 auto;
  padding: 0.42rem;
  border-radius: 0.7rem;
  background: linear-gradient(180deg, #5a5b62, #2b2c31);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 1px 0 rgba(255, 255, 255, 0.85), inset 0 -1px 0 rgba(0, 0, 0, 0.5);
}
.cfc-glass {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
  min-width: 0;
  padding: 0.3rem 0.65rem 0.35rem;
  overflow: hidden;
  border-radius: 0.35rem;
  background:
    radial-gradient(130% 90% at 50% 0%, rgba(255, 255, 255, 0.22), transparent 55%),
    linear-gradient(180deg, #a8b794 0%, #c3cfac 16%, #cbd6b5 60%, #bac6a1 100%);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(0, 0, 0, 0.4);
  color: var(--cfc-ink);
}
.cfc-glass::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, 0.16) 52%, transparent 64%);
  pointer-events: none;
}
.cfc-top, .cfc-note { font-family: 'VT323', 'Lucida Console', monospace; line-height: 1; white-space: nowrap; }
.cfc-top {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  min-height: 1.1em;
  font-size: 1.45rem;
}
.cfc-anns { display: flex; flex: none; gap: 0.35rem; }
.cfc-ann { opacity: 0.08; }
.cfc-ann.on { opacity: 0.88; }
.cfc-ann-op { min-width: 0.6em; }
.cfc-top-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; text-align: right; opacity: 0.85; }
.cfc-digits {
  display: grid;
  grid-template-columns: repeat(13, minmax(0, 1fr));
  gap: 0.06rem;
  margin: 0.2rem 0 0.15rem;
  transform-origin: 100% 50%;
  filter: drop-shadow(1px 1.5px 0 rgba(30, 40, 20, 0.14));
}
.cfc-cellwrap { display: block; min-width: 0; }
.cfc-cell { display: block; width: 100%; height: auto; aspect-ratio: 44 / 67; overflow: visible; }
.cfc-cell .s { fill: var(--cfc-ink); opacity: 0.07; transition: opacity 160ms ease-out; }
.cfc-cell .s-p, .cfc-cell .s-m { opacity: 0.035; }
.cfc-cell .s.on { opacity: 0.92; transition: none; }
.cfc-note {
  display: flex;
  align-items: center;
  gap: 0.3em;
  min-height: 1.1em;
  overflow: hidden;
  font-size: 1.4rem;
}
.cfc-note-text { overflow: hidden; text-overflow: ellipsis; }
.cfc-note-emoji { flex: none; display: inline-block; font-family: 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif; font-size: 0.9em; }

/* ───────── mode chips ───────── */
.cfc-chips {
  position: relative;
  z-index: 3;
  display: grid;
  flex: none;
  grid-template-columns: minmax(0, 1.3fr) repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
}
.cfc-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-width: 0;
  min-height: 2.3rem;
  padding: 0 0.25rem;
  border: 1px solid #8e8670;
  border-radius: 999px;
  background: linear-gradient(#faf7ef, #ddd6c4);
  box-shadow: 0 2px 0 #a59d86, inset 0 1px 0 #fff;
  color: #3a3428;
  font-size: 0.875rem;
  font-weight: 700;
  transition: transform 130ms var(--cfc-spring), box-shadow 90ms;
}
.cfc-chip:hover { background: linear-gradient(#fffdf6, #e6e0cf); }
.cfc-chip.is-pressed { transform: translateY(1px) scale(1.08); box-shadow: 0 1px 0 #a59d86, inset 0 1px 0 #fff; }
.cfc-chip-icon { flex: none; font-family: 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif; font-size: 1rem; line-height: 1; }
.cfc-chip-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* On: the whole chip lights up in its own colour (Science mint, Tape amber, Flip pink). */
.cfc-chip[aria-pressed="true"] {
  border-color: #3f8a64;
  background: linear-gradient(#d9ffe9, #9fe6bf);
  box-shadow: 0 2px 0 #4f9a73, inset 0 1px 0 #fff, 0 0 10px rgba(90, 230, 150, 0.55);
  color: #174d33;
}
.cfc-chip[data-chip="tape"][aria-pressed="true"] {
  border-color: #a8812a;
  background: linear-gradient(#fff4cf, #ffd877);
  box-shadow: 0 2px 0 #b58c2c, inset 0 1px 0 #fff, 0 0 10px rgba(255, 200, 70, 0.55);
  color: #5a3f05;
}
.cfc-chip[data-chip="flip"][aria-pressed="true"] {
  border-color: #b0547f;
  background: linear-gradient(#ffe3f0, #ffb3d4);
  box-shadow: 0 2px 0 #b9658c, inset 0 1px 0 #fff, 0 0 10px rgba(255, 120, 180, 0.55);
  color: #6a1d42;
}

/* ───────── keys ───────── */
.cfc-keys {
  position: relative;
  z-index: 3;
  display: grid;
  flex: 0 1 auto;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  gap: 0.45rem;
  height: calc(var(--cfc-rows) * 4.2rem + (var(--cfc-rows) - 1) * 0.45rem);
  min-height: calc(var(--cfc-rows) * 2.55rem + (var(--cfc-rows) - 1) * 0.45rem);
}
.cfc:not(.is-sci) .cfc-key.is-sci { display: none; }
.cfc-key {
  --kb: linear-gradient(#fffdf8, #ebe5d6);
  --kl: #b3aa93;
  --kt: #2b2b2b;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0.55rem;
  background: var(--kb);
  color: var(--kt);
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 0.24rem 0 var(--kl), 0 0.38rem 0.5rem rgba(40, 30, 10, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.75), inset 0 -2px 3px rgba(0, 0, 0, 0.08);
  transition: translate 80ms ease-out, scale 170ms var(--cfc-spring), box-shadow 80ms ease-out, filter 120ms;
}
.cfc-key::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}
.cfc-key:hover { filter: brightness(1.04); }
.cfc-key.is-pressed, .cfc-key.is-down {
  translate: 0 0.17rem;
  scale: 1.07;
  box-shadow: 0 0.07rem 0 var(--kl), 0 0.12rem 0.25rem rgba(40, 30, 10, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.6), inset 0 2px 4px rgba(0, 0, 0, 0.12);
  transition: translate 50ms ease-out, scale 90ms ease-out, box-shadow 50ms;
}
.cfc-key-label { pointer-events: none; white-space: nowrap; }
.cfc-key.is-op { --kb: linear-gradient(#7d8dad, #56637f); --kl: #38425b; --kt: #fff; font-size: 1.65rem; }
.cfc-key.is-eq { --kb: linear-gradient(#ffad5c, #f07a14); --kl: #ad520a; --kt: #fff; font-size: 1.75rem; }
.cfc-key.is-clr { --kb: linear-gradient(#f07560, #cf412b); --kl: #8c2416; --kt: #fff; font-size: 1.15rem; }
.cfc-key.is-mem { --kb: linear-gradient(#dfdacd, #c3bcaa); --kl: #968f7b; --kt: #a3291b; font-size: 1rem; }
.cfc-key.is-fn { --kb: linear-gradient(#eeeae0, #d4cebd); --kl: #a29a85; --kt: #1f3f7a; font-size: 1.15rem; }
.cfc-key.is-fun { --kb: linear-gradient(#dcf8e8, #b2e7c9); --kl: #6aae8b; --kt: #1b5a3b; font-size: 1rem; }
.cfc-key:is(.is-op, .is-eq, .is-clr) .cfc-key-label { text-shadow: 0 1px 0 rgba(0, 0, 0, 0.28); }
.cfc-key[data-key="sand"] { font-size: 1.75rem; }
.cfc-key[data-key="pi"] { font: italic 700 1.7rem/1 'Times New Roman', Georgia, serif; }
.cfc-key[data-key="^"] .cfc-key-label { font-size: 1.25rem; }
.cfc-key[data-key="back"] { font-size: 1.35rem; }
.cfc-key.is-shiver { animation: cfc-shiver 0.1s linear infinite alternate; }
@keyframes cfc-shiver { from { transform: translate(-1.5px, 0) rotate(-2deg); } to { transform: translate(1.5px, 1px) rotate(2deg); } }

/* The void (canvas over the face while it's open). */
.cfc-bh {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: none;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  pointer-events: none;
}

/* Upside down. */
.cfc.is-flipped .cfc-face { rotate: 180deg; }

/* Speech bubble for the flip words (not rotated: it's for the reader). */
.cfc-bubble {
  position: absolute;
  left: 50%;
  top: 32%;
  z-index: 30;
  max-width: calc(100% - 2rem);
  padding: 0.45rem 1rem 0.55rem;
  border: 2px solid #222;
  border-radius: 1.1rem;
  background: #fff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  color: #222;
  font: 700 1.2rem/1.15 'Comic Sans MS', 'Comic Sans', 'Chalkboard SE', cursive;
  text-align: center;
  white-space: nowrap;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.cfc-bubble.is-word { background: #fff3a0; font-size: 2.4rem; letter-spacing: 0.04em; }

/* ───────── show your work ───────── */
.cfc-work {
  position: absolute;
  inset: 0.6rem;
  z-index: 25;
  overflow: hidden;
  padding: 0.4rem 1rem 1rem 3.4rem;
  border-radius: 0.3rem;
  background:
    linear-gradient(90deg, transparent 2.75rem, #f19a9a 2.75rem, #f19a9a calc(2.75rem + 2px), transparent calc(2.75rem + 2px)),
    repeating-linear-gradient(180deg, transparent 0 calc(2.1rem - 1px), #b5cdee calc(2.1rem - 1px) 2.1rem),
    linear-gradient(#fffef6, #fbf8ea);
  background-position: 0 0, 0 0.4rem, 0 0;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  color: #23398a;
  font-family: 'Segoe Print', 'Bradley Hand', 'Ink Free', 'Comic Sans MS', cursive;
  transform-origin: 50% 0;
}
.cfc-work::before {
  content: '';
  position: absolute;
  left: 0.75rem;
  top: 0;
  bottom: 0;
  width: 1rem;
  background: radial-gradient(circle at 50% 50%, #cfc9b8 0 0.38rem, transparent 0.42rem) 0 3rem / 1rem 9rem repeat-y;
}
.cfc-work-title { margin: 0; font-size: 1.35rem; line-height: 2.1rem; font-weight: 700; text-decoration: underline; text-underline-offset: 0.3rem; }
.cfc-work-lines { display: flex; flex-direction: column; }
.cfc-work-line { margin: 0; font-size: 1.05rem; line-height: 2.1rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cfc-work-line:nth-child(4n+1) { font-weight: 700; color: #1a2c6f; }
.cfc-work-final { margin: 0.1rem 0 0; font-size: 1.35rem; line-height: 2.1rem; font-weight: 700; }
.cfc-work-ansbox { position: relative; display: inline-block; padding: 0 0.4rem; }
.cfc-work-circle { position: absolute; inset: -0.35rem -0.9rem -0.5rem -0.9rem; pointer-events: none; }
.cfc-work-circle svg { display: block; width: 100%; height: 100%; overflow: visible; }
.cfc-work-circle path { fill: none; stroke: #d8352a; stroke-width: 3; stroke-linecap: round; }
.cfc-work-stamp {
  position: absolute;
  right: 1.2rem;
  bottom: 1.1rem;
  padding: 0 0.45rem;
  border: 3px solid #d42a1e;
  border-radius: 0.45rem;
  color: #d42a1e;
  font: 900 2.6rem/1.15 Impact, 'Arial Black', sans-serif;
  transform: rotate(-14deg);
  opacity: 0.92;
  mix-blend-mode: multiply;
}
.cfc-work-duck { position: absolute; right: 0.9rem; top: 0.6rem; width: 4.2rem; }
.cfc-work-duck svg { display: block; width: 100%; height: auto; overflow: visible; }
.cfc-work-duck path { fill: none; stroke: #23398a; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.cfc-work-duck circle { fill: #23398a; }

/* ───────── the paper tape ───────── */
.cfc-tape {
  position: absolute;
  z-index: 1;
  width: 11.6rem;
  pointer-events: auto;
}
.cfc-tape[data-side="right"] { left: calc(100% + 1px); }
.cfc-tape[data-side="left"] { right: calc(100% + 1px); }
.cfc-printer {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  height: 2.9rem;
  padding: 0 0.4rem 0 0.7rem;
  border: 1px solid #8a8068;
  background: linear-gradient(180deg, #f2eee3 0%, #ddd6c3 70%, #c8c0a9 100%);
  box-shadow: inset 0 1px 0 #fff, 2px 3px 6px rgba(0, 0, 0, 0.35);
}
.cfc-tape[data-side="right"] .cfc-printer { border-radius: 0 0.7rem 0.4rem 0; border-left: 0; }
.cfc-tape[data-side="left"] .cfc-printer { border-radius: 0.7rem 0 0 0.4rem; border-right: 0; flex-direction: row-reverse; padding: 0 0.7rem 0 0.4rem; }
.cfc-printer-slot {
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  bottom: 0.32rem;
  height: 0.32rem;
  border-radius: 0.2rem;
  background: #2b2620;
  box-shadow: inset 0 1px 2px #000, 0 1px 0 rgba(255, 255, 255, 0.6);
}
.cfc-printer-led {
  flex: none;
  width: 0.55rem;
  height: 0.55rem;
  margin-bottom: 0.4rem;
  border-radius: 50%;
  background: #5b2a20;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.5);
}
.cfc-printer-led.is-on { background: #ff5a3c; box-shadow: 0 0 6px 2px rgba(255, 80, 50, 0.8); }
.cfc-tear {
  margin-left: auto;
  margin-bottom: 0.4rem;
  width: 2.1rem;
  height: 2.1rem;
  border: 1px solid #8a8068;
  border-radius: 50%;
  background: linear-gradient(#fffdf6, #ddd6c3);
  box-shadow: 0 1px 0 #a59d86, inset 0 1px 0 #fff;
  color: #3a3428;
  font-size: 1.05rem;
  line-height: 1;
  transition: transform 130ms var(--cfc-spring);
}
.cfc-tape[data-side="left"] .cfc-tear { margin-left: 0; margin-right: auto; }
.cfc-tear.is-pressed { transform: scale(1.18) rotate(-12deg); }
.cfc-paper {
  position: relative;
  z-index: 1;
  width: 10.2rem;
  margin: -0.45rem auto 0;
  transform-origin: 50% 0;
  filter: drop-shadow(2px 4px 4px rgba(0, 0, 0, 0.32));
}
.cfc-paper.is-torn { position: absolute; left: 0; right: 0; top: 2.9rem; pointer-events: none; }
.cfc-paper-clip {
  position: relative;
  overflow: hidden;
  background:
    repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.018) 0 2px, transparent 2px 5px),
    linear-gradient(90deg, #f3f1e8, #fffef9 12%, #fffef9 88%, #f0eee4);
}
.cfc-tape-lines { display: flex; flex-direction: column; padding: 0.55rem 0 0.3rem; }
.cfc-tape-line {
  padding: 0 0.55rem;
  overflow: hidden;
  color: #2a2a35;
  font: 700 0.875rem/1.5 'Courier New', 'Lucida Console', monospace;
  text-align: right;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.cfc-tape-line.is-total { color: #c0281c; }
.cfc-tape-line.is-sub { color: #6b6b75; }
.cfc-tape-line.is-note { color: #5b5b66; font-weight: 400; font-style: italic; text-align: left; }
.cfc-tape-line.is-error { color: #c0281c; text-align: center; letter-spacing: 0.04em; }
.cfc-tape-line.is-clear { color: #9a9aa2; text-align: center; font-weight: 400; }
.cfc-curl {
  --roll: 0;
  height: calc(1.3rem + var(--roll) * 1.6rem);
  margin-top: -1px;
  border-radius: 0 0 46% 46% / 0 0 100% 100%;
  background: linear-gradient(180deg, #fffef9 0%, #f0eee4 28%, #d4d0c1 58%, #f9f8f1 80%, #c9c5b5 100%);
  box-shadow: 0 6px 6px -3px rgba(0, 0, 0, 0.3);
}

/* Phones: the tape is a drawer over the keys. */
.cfc-tape[data-side="drawer"] {
  right: 0.9rem;
  bottom: 0.9rem;
  z-index: 22;
  display: flex;
  flex-direction: column;
  width: 11.5rem;
}
.cfc-tape[data-side="drawer"] .cfc-printer { flex: none; border-radius: 0.7rem 0.7rem 0.3rem 0.3rem; border: 1px solid #8a8068; }
.cfc-tape[data-side="drawer"] .cfc-paper { display: flex; flex-direction: column; flex: 1; min-height: 0; width: 9.8rem; }
.cfc-tape[data-side="drawer"] .cfc-paper-clip { flex: 1; min-height: 0; }

@media (pointer: coarse) {
  .cfc-chip { min-height: 2.75rem; }
  .cfc-tear { width: 2.6rem; height: 2.6rem; }
  .cfc-printer { height: 3.3rem; }
  .cf-menu { min-height: 2.5rem; }
  .cf-dd-item { min-height: 2.75rem; }
}
@media (max-width: 599px) {
  .cfc-stage { padding: 0.4rem; }
  .cfc-face { padding: 0.6rem 0.6rem 0.75rem; gap: 0.5rem; }
  .cfc-keys { gap: 0.4rem; height: calc(var(--cfc-rows) * 4.6rem + (var(--cfc-rows) - 1) * 0.4rem); }
  .cfc-note { white-space: normal; }
}

html[data-reduced-motion="on"] .cfc-eyes[data-mood] .cfc-eye-glint,
html[data-reduced-motion="on"] .cfc-eyes .cfc-eye-x svg,
html[data-reduced-motion="on"] .cfc-key.is-shiver,
html[data-reduced-motion="on"] .cfc-solar.is-pulled { animation: none; }

/* ═════════════════════════ Solitaire ═════════════════════════ */
.cs-cards .cs-app-body { background: var(--cs-face); }
.cfk {
  --cfk-spring: cubic-bezier(.2, 1.6, .4, 1);
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  outline: none;
}
.cfk-toolbar {
  position: relative;
  z-index: 3;
  display: flex;
  flex: none;
  align-items: center;
  gap: 0.2rem;
  padding: 0.25rem 0.4rem;
  border-bottom: 1px solid #c9c5b4;
  background: linear-gradient(180deg, #fdfcf9 0%, #f3f1e8 55%, #e2dfd0 100%);
  box-shadow: inset 0 1px 0 #fff;
}
.cfk-tool {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.6rem;
  padding: 0.2rem 0.6rem 0.2rem 0.35rem;
  border: 1px solid transparent;
  border-radius: 4px;
  background: none;
  color: #1b1b1b;
  font-size: 0.875rem;
  white-space: nowrap;
  transition: transform 120ms var(--cfk-spring), background-color 120ms, border-color 120ms;
}
.cfk-tool-icon { flex: none; width: 1.9rem; height: 1.9rem; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25)); }
.cfk-tool-icon svg { display: block; width: 100%; height: 100%; overflow: visible; }
.cfk-tool:hover:not(:disabled) { border-color: #cbc6b2; background: linear-gradient(#fff, #f1efe6); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }
.cfk-tool.is-pressed { transform: scale(1.1); background: linear-gradient(#e6e3d6, #f8f7f2); }
.cfk-tool:disabled { color: #9b9b9b; }
.cfk-tool:disabled .cfk-tool-icon, .cfk-tool:disabled .cfk-back-swatch { filter: grayscale(1) opacity(0.45); }
.cfk-tool.is-busy { margin-left: auto; border-color: #d9b44a; background: linear-gradient(#fff8dc, #ffe69a); font-weight: 700; }
.cfk-tool.is-busy:hover:not(:disabled) { border-color: #c79a1c; background: linear-gradient(#fffbe8, #ffdf7a); }
.cfk-sep { align-self: stretch; width: 1px; margin: 0.35rem 0.25rem; background: #c9c5b4; box-shadow: 1px 0 0 #fff; }
.cfk-segs { display: flex; flex: none; margin: 0 0.3rem; border: 1px solid #8e8a7a; border-radius: 4px; overflow: hidden; box-shadow: 0 1px 0 #fff; }
.cfk-seg {
  min-height: 2.2rem;
  padding: 0 0.7rem;
  border: 0;
  background: linear-gradient(#ffffff, #ebe8dc);
  color: #222;
  font-size: 0.875rem;
  transition: transform 120ms var(--cfk-spring);
}
.cfk-seg + .cfk-seg { border-left: 1px solid #a8a492; }
.cfk-seg.is-on { background: linear-gradient(#3f7ee0, #2b62c6); color: #fff; box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35); }
.cfk-seg.is-pressed { transform: scale(1.08); }
.cfk-back-swatch {
  flex: none;
  width: 1.45rem;
  height: 2rem;
  border-radius: 3px;
  background-size: 100% 100%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  transform: rotate(-6deg);
}

/* The felt. */
.cfk-felt {
  position: relative;
  isolation: isolate;   /* its card and cascade layers stay below the window's own sparkle canvas */
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .16 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(120% 90% at 50% 35%, #2a9a49 0%, #1c7d39 48%, #11592a 100%);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.35);
}
.cfk-table { position: absolute; inset: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.cfk-cascade { position: absolute; inset: 0; z-index: 2000; display: none; width: 100%; height: 100%; pointer-events: none; }
.cfk-slot {
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: var(--cw);
  height: var(--ch);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: calc(var(--cw) * 0.08);
  background: rgba(0, 0, 0, 0.13);
  box-shadow: inset 0 1px 5px rgba(0, 0, 0, 0.3);
}
.cfk-slot i { color: rgba(255, 255, 255, 0.26); font: 700 calc(var(--cw) * 0.42) / 1 Georgia, 'Times New Roman', serif; font-style: normal; pointer-events: none; }
.cfk-slot.is-stock i { opacity: 0; font-family: 'Segoe UI Symbol', Arial, sans-serif; font-size: calc(var(--cw) * 0.55); transition: opacity 200ms; }
.cfk-slot.is-stock.is-empty i { opacity: 1; }
.cfk-slot.is-stock.is-done i { opacity: 0.25; }
.cfk-slot.is-waste, .cfk-slot.is-tab { border-style: dashed; border-color: rgba(255, 255, 255, 0.12); background: rgba(0, 0, 0, 0.07); }

.cfk-card {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--cw);
  height: var(--ch);
  border-radius: calc(var(--cw) * 0.08);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 0 0 0.5px rgba(0, 0, 0, 0.25);
  touch-action: none;
  transition: scale 150ms var(--cfk-spring), box-shadow 150ms;
}
.cfk-face {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}
.cfk-card.is-lifted {
  scale: 1.07;
  box-shadow: 0 16px 24px rgba(0, 0, 0, 0.42), 0 5px 8px rgba(0, 0, 0, 0.3);
  transition: scale 120ms var(--cfk-spring), box-shadow 120ms;
}

.cfk-status {
  display: flex;
  flex: none;
  align-items: center;
  gap: 1rem;
  min-height: 1.9rem;
  padding: 0.15rem 0.7rem;
  border-top: 1px solid #c9c5b4;
  background: linear-gradient(#f6f4ec, #e6e2d3);
  color: #222;
  font-size: 0.875rem;
}
.cfk-status-msg { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #333; }
.cfk-stat { flex: none; font-variant-numeric: tabular-nums; }
.cfk-stat b { display: inline-block; min-width: 2.2em; }
.cf-fly.is-plus { color: #fff36b; font-size: 1.35rem; }
.cf-fly.is-minus { color: #ff9a9a; font-size: 1.35rem; }

/* You win! */
.cfk-win {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2100;
  width: min(25rem, calc(100% - 1.5rem));
  border: 3px solid var(--cs-frame);
  border-top: 0;
  border-radius: 0.5rem 0.5rem 0.3rem 0.3rem;
  background: var(--cs-face);
  box-shadow: 4px 6px 18px rgba(0, 0, 0, 0.5);
  transform: translate(-50%, -50%);
}
.cfk-win-bar {
  display: flex;
  align-items: center;
  height: 2rem;
  margin: 0 -3px;
  padding: 0 0.6rem;
  border-radius: 0.5rem 0.5rem 0 0;
  background: linear-gradient(180deg, #0a5ef7 0%, #3d8cff 8%, #0b5ff2 22%, #0656ea 60%, #0353e8 85%, #0447c9 100%);
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 700;
  text-shadow: 1px 1px 1px #0f1a63;
}
.cfk-win-body { display: flex; align-items: center; gap: 0.9rem; padding: 1rem 1rem 0.4rem; }
.cfk-win-trophy { flex: none; width: 5.2rem; height: 4rem; }
.cfk-win-trophy svg { display: block; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.25)); }
.cfk-win-text { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.cfk-win-text b { font-size: 1.6rem; color: #0a246a; }
.cfk-win-text span { font-size: 0.9375rem; color: #222; }
.cfk-win-text .cfk-win-note { color: #6b5a1e; font-style: italic; }
.cfk-win-btns { display: flex; justify-content: center; padding: 0.6rem 1rem 0.9rem; }

@media (pointer: coarse) {
  .cfk-tool { min-height: 2.75rem; }
  .cfk-seg { min-height: 2.6rem; }
}
@media (max-width: 599px) {
  .cfk-toolbar { gap: 0; padding: 0.2rem 0.25rem; }
  .cfk-tool { justify-content: center; min-width: 2.75rem; padding: 0.2rem; }
  .cfk-tool .cfk-tool-label { display: none; }
  .cfk-tool.is-busy .cfk-tool-label { display: inline; }
  .cfk-tool.is-busy { padding: 0.2rem 0.45rem; }
  .cfk-seg { padding: 0 0.5rem; }
  .cfk-sep { display: none; }
  .cfk-status { gap: 0.7rem; padding: 0.15rem 0.5rem; }
}

/* ═════════════════════════ Sketch Pad ═════════════════════════ */
.cs-sketch .cs-app-body { background: var(--cs-face); }
.cfs {
  --cfs-spring: cubic-bezier(.2, 1.6, .4, 1);
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  outline: none;
}
.cfs-toolbar {
  position: relative;
  z-index: 3;
  display: flex;
  flex: none;
  align-items: center;
  gap: 0.2rem;
  padding: 0.25rem 0.45rem;
  border-bottom: 1px solid #c9c5b4;
  background: linear-gradient(180deg, #fdfcf9 0%, #f3f1e8 55%, #e2dfd0 100%);
  box-shadow: inset 0 1px 0 #fff;
}
.cfs-tbtn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.6rem;
  padding: 0.2rem 0.6rem 0.2rem 0.35rem;
  border: 1px solid transparent;
  border-radius: 4px;
  background: none;
  color: #1b1b1b;
  font-size: 0.875rem;
  white-space: nowrap;
  transition: transform 120ms var(--cfs-spring), background-color 120ms, border-color 120ms;
}
.cfs-tbtn-icon { flex: none; width: 1.85rem; height: 1.85rem; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25)); }
.cfs-tbtn-icon svg, .cfs-tool-icon svg, .cfs-disk svg { display: block; width: 100%; height: 100%; overflow: visible; }
.cfs-tbtn:hover:not(:disabled) { border-color: #cbc6b2; background: linear-gradient(#fff, #f1efe6); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }
.cfs-tbtn.is-pressed { transform: scale(1.1); }
.cfs-tbtn:disabled { color: #9b9b9b; }
.cfs-tbtn:disabled .cfs-tbtn-icon { filter: grayscale(1) opacity(0.45); }

/* The button that draws the eye. */
.cfs-better {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.5rem;
  margin-left: auto;
  padding: 0 1.1rem 0 0.8rem;
  overflow: hidden;
  border: 1px solid #b07c00;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff6c4 0%, #ffd84d 45%, #f2a918 100%);
  box-shadow: 0 2px 0 #9a6400, 0 0 14px rgba(255, 196, 50, 0.55), inset 0 1px 0 #fff;
  color: #4d3000;
  font-size: 0.9375rem;
  font-weight: 700;
  white-space: nowrap;
  transition: transform 140ms var(--cfs-spring), box-shadow 140ms;
}
.cfs-better::after {
  content: '';
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: 0;
  width: 2.4rem;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.85), transparent);
  transform: translateX(-3rem) skewX(-20deg);
  animation: cfs-shimmer 3.4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes cfs-shimmer { 0%, 62% { transform: translateX(-3rem) skewX(-20deg); } 100% { transform: translateX(14rem) skewX(-20deg); } }
.cfs-better-spark { display: inline-block; font-family: 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif; animation: cfs-twinkle 1.6s ease-in-out infinite alternate; }
@keyframes cfs-twinkle { from { transform: scale(.9) rotate(-10deg); } to { transform: scale(1.15) rotate(12deg); } }
.cfs-better:hover:not(:disabled) { box-shadow: 0 2px 0 #9a6400, 0 0 22px rgba(255, 196, 50, 0.85), inset 0 1px 0 #fff; }
.cfs-better.is-pressed { transform: scale(1.1); }
.cfs-better:disabled { filter: saturate(0.5) brightness(0.95); }

.cfs-main { display: grid; flex: 1; grid-template-columns: auto minmax(0, 1fr); min-height: 0; }
.cfs-tools {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.45rem;
  border-right: 1px solid #c9c5b4;
  background: var(--cs-face);
}
.cfs-toolgrid { display: grid; grid-template-columns: repeat(2, 2.75rem); gap: 3px; }
.cfs-tool {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid #b4b0a0;
  border-radius: 4px;
  background: linear-gradient(#ffffff, #e9e6da);
  box-shadow: 0 1px 0 #fff inset, 0 1px 1px rgba(0, 0, 0, 0.12);
  transition: transform 130ms var(--cfs-spring), background-color 120ms;
}
.cfs-tool-icon { width: 1.75rem; height: 1.75rem; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25)); }
.cfs-tool:hover { background: linear-gradient(#fffdf5, #f1eee2); }
.cfs-tool.is-on { border-color: #6a6658; background: linear-gradient(#e6e2d4, #f8f6ee); box-shadow: inset 1px 2px 3px rgba(0, 0, 0, 0.3); }
.cfs-tool.is-pressed { transform: scale(1.12); }
.cfs-opts {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 2rem;
  padding: 3px;
  border: 1px solid #8e8a7a;
  background: #fff;
  box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.2);
}
.cfs-opts:empty { visibility: hidden; }
.cfs-opt {
  display: grid;
  place-items: center;
  min-height: 2.4rem;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: none;
  transition: transform 120ms var(--cfs-spring);
}
.cfs-opt i { display: block; width: var(--d); height: var(--d); border-radius: 50%; background: #222; }
.cfs-opt.is-on { background: var(--cs-select); }
.cfs-opt.is-on i { background: #fff; }
.cfs-opt.is-stamp { font: 1.45rem/1 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif; }
.cfs-opt.is-pressed { transform: scale(1.15); }

.cfs-work { position: relative; overflow: auto; background: #808080; box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.35); }
.cfs-paper {
  position: relative;
  margin: 10px;
  background: #fff;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.35), 0 4px 14px rgba(0, 0, 0, 0.25);
}
.cfs-doc, .cfs-over { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.cfs-over { cursor: crosshair; touch-action: none; }
.cfs-wipe {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #ffffff 92%, rgba(255, 255, 255, 0));
  transform: scaleX(0);
  transform-origin: 0 50%;
  pointer-events: none;
}
.cfs-cursor {
  --d: 10px;
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  width: var(--d);
  height: var(--d);
  margin: calc(var(--d) / -2) 0 0 calc(var(--d) / -2);
  border: 1.5px solid rgba(0, 0, 0, 0.55);
  border-radius: 50%;
  outline: 1px solid rgba(255, 255, 255, 0.75);
  opacity: 0;
  pointer-events: none;
  font: calc(var(--d) * 0.82) / 1 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif;
  transition: opacity 120ms;
}
.cfs-cursor[data-tool="stamp"] { border: 0; outline: 0; filter: opacity(0.55); }
.cfs-cursor[data-tool="spray"] { border-style: dotted; }
.cfs-cursor[data-tool="fill"] { border-color: var(--c, #000); }

.cfs-palette {
  display: flex;
  flex: none;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.55rem;
  border-top: 1px solid #c9c5b4;
  background: linear-gradient(#f6f4ec, #e6e2d3);
}
.cfs-current {
  display: grid;
  flex: none;
  place-items: center;
  width: 2.9rem;
  height: 2.9rem;
  border: 1px solid #8e8a7a;
  background: #fff;
  box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.25);
}
.cfs-current i { display: block; width: 2.1rem; height: 2.1rem; border: 1px solid #444; background: var(--c, #000); }
.cfs-swatches { display: grid; grid-template-columns: repeat(14, 1.85rem); grid-auto-rows: 1.4rem; gap: 2px; }
.cfs-swatch {
  padding: 0;
  border: 1px solid #555;
  background: var(--c);
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.45), inset -1px -1px 0 rgba(0, 0, 0, 0.2);
  transition: transform 120ms var(--cfs-spring);
}
.cfs-swatch.is-on { position: relative; z-index: 1; outline: 2px solid #000; outline-offset: 1px; }
.cfs-swatch.is-pressed { transform: scale(1.2); }

/* ───────── the gallery ───────── */
.cfs-gallery {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  overflow: hidden;
  padding: 1rem;
}
.cfs-gallery[hidden] { display: none; }
.cfs-wall {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(90deg, rgba(255, 220, 180, 0.035) 0 2px, transparent 2px 28px),
    radial-gradient(ellipse 70% 60% at 50% 30%, #6b2338 0%, #4a1626 60%, #2e0c17 100%);
  transition: filter 420ms ease-out;
}
.cfs-gallery:not(.is-lit) .cfs-wall { filter: brightness(0.35); }
.cfs-floor {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 14%;
  border-top: 0.45rem solid #24140a;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.45), transparent 40%),
    repeating-linear-gradient(90deg, #5e3c22 0 5.5rem, #4f3119 5.5rem 11rem);
}
.cfs-spot {
  position: absolute;
  left: -45%;
  right: -45%;
  top: -30%;
  bottom: -25%;
  background: radial-gradient(ellipse 46% 58% at 50% 18%, rgba(255, 238, 196, 0.4), rgba(255, 238, 196, 0.1) 55%, transparent 75%);
  opacity: 0;
  transition: opacity 360ms ease-out;
  pointer-events: none;
}
.cfs-gallery.is-lit .cfs-spot { opacity: 1; }
.cfs-hang { position: relative; z-index: 1; display: flex; align-items: center; gap: 2rem; }
.cfs-art { position: relative; display: flex; flex-direction: column; align-items: center; }
.cfs-lamp {
  position: relative;
  z-index: 2;
  width: 38%;
  height: 0.7rem;
  margin-bottom: 0.55rem;
  border-radius: 0.4rem;
  background: linear-gradient(#fff0b8, #c99a3a 55%, #8a5f18);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}
.cfs-lamp::after {
  content: '';
  position: absolute;
  left: -30%;
  right: -30%;
  top: 100%;
  height: 7rem;
  background: linear-gradient(rgba(255, 240, 200, 0.4), transparent);
  clip-path: polygon(25% 0, 75% 0, 100% 100%, 0 100%);
  opacity: 0;
  transition: opacity 300ms;
  pointer-events: none;
}
.cfs-gallery.is-lit .cfs-lamp::after { opacity: 1; }
.cfs-frame {
  position: relative;
  padding: 1.5rem;
  border-radius: 3px;
  background: linear-gradient(135deg, #7d4f10 0%, #f6d77a 16%, #b8862b 32%, #fff0b0 48%, #a8741c 63%, #f3cf6a 80%, #6e440c 100%);
  box-shadow:
    0 0 0 2px #3d2405,
    inset 0 0 0 2px #fff3b8,
    inset 0 0 0 6px #8f6418,
    inset 0 0 0 8px #ffe9a0,
    inset 0 0 0 10px #a37422,
    0 24px 44px rgba(0, 0, 0, 0.65),
    0 6px 12px rgba(0, 0, 0, 0.4);
}
.cfs-mat {
  position: relative;
  overflow: hidden;
  padding: 0.3rem;
  background: #3a2509;
  box-shadow: inset 0 0 0 2px #ffe9a0, inset 0 3px 8px rgba(0, 0, 0, 0.7);
}
.cfs-painting { display: block; box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.4); }
.cfs-gloss {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.5) 50%, transparent 70%);
  opacity: 0;
  pointer-events: none;
}
.cfs-orn {
  position: absolute;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background:
    radial-gradient(circle, #fff6c8 0 16%, #d6a43c 18% 34%, #7d4f10 36% 40%, #f3cf6a 42% 56%, #8a5a14 58% 62%, transparent 64%);
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.5));
}
.cfs-orn.is-tl { left: -0.7rem; top: -0.7rem; }
.cfs-orn.is-tr { right: -0.7rem; top: -0.7rem; }
.cfs-orn.is-bl { left: -0.7rem; bottom: -0.7rem; }
.cfs-orn.is-br { right: -0.7rem; bottom: -0.7rem; }
.cfs-rope {
  display: block;
  width: 112%;
  height: 2.4rem;
  margin-top: 0.9rem;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 50' preserveAspectRatio='none'%3E%3Cpath d='M14 13Q150 46 286 13' fill='none' stroke='%235e0716' stroke-width='8' stroke-linecap='round'/%3E%3Cpath d='M14 13Q150 46 286 13' fill='none' stroke='%23c4142f' stroke-width='5' stroke-linecap='round'/%3E%3Cpath d='M30 17Q150 41 270 17' fill='none' stroke='%23ff7a8a' stroke-width='1.2' stroke-opacity='.6'/%3E%3Crect x='7' y='10' width='9' height='40' fill='%23b8862b'/%3E%3Crect x='284' y='10' width='9' height='40' fill='%23b8862b'/%3E%3Ccircle cx='11.5' cy='9' r='7' fill='%23f3cf6a'/%3E%3Ccircle cx='288.5' cy='9' r='7' fill='%23f3cf6a'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
}
.cfs-label {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  width: 15.5rem;
  padding: 0.9rem 1rem;
  border-radius: 2px;
  background: linear-gradient(#fdfcf8, #f2efe6);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  color: #222;
  font-family: Georgia, 'Times New Roman', serif;
  opacity: 0;
  transform: translateX(16px);
  transition: opacity 420ms ease-out, transform 480ms var(--cfs-spring);
}
.cfs-label.is-in { opacity: 1; transform: none; }
.cfs-label-title { font-size: 1.1rem; font-style: italic; line-height: 1.25; }
.cfs-label-artist { font-size: 0.9375rem; }
.cfs-label-medium { color: #555; font-size: 0.875rem; }
.cfs-label-blurb { margin: 0.25rem 0; font-size: 0.875rem; line-height: 1.4; }
.cfs-label-price { font-size: 0.9375rem; font-weight: 700; }
.cfs-label-loan { color: #666; font-size: 0.875rem; }
.cfs-gbtns {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 360ms ease-out, transform 420ms var(--cfs-spring);
  pointer-events: none;
}
.cfs-gbtns.is-in { opacity: 1; transform: none; pointer-events: auto; }
.cfs-gbtn {
  min-height: 2.6rem;
  padding: 0 1.15rem;
  border: 1px solid #1d1009;
  border-radius: 999px;
  background: linear-gradient(#fdfcf7, #e2dbc9);
  box-shadow: 0 2px 0 #160c05, 0 5px 12px rgba(0, 0, 0, 0.45), inset 0 1px 0 #fff;
  color: #222;
  font-size: 0.9375rem;
  font-weight: 700;
  transition: transform 130ms var(--cfs-spring);
}
.cfs-gbtn.is-gold { border-color: #7a4f00; background: linear-gradient(180deg, #fff6c4 0%, #ffd84d 45%, #f2a918 100%); color: #4d3000; }
.cfs-gbtn.is-pressed { transform: scale(1.1); }

/* ───────── Save As ───────── */
.cfs-dlg-back { position: absolute; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(0, 0, 0, 0.2); }
.cfs-dlg {
  width: min(26rem, calc(100% - 1.5rem));
  border: 3px solid var(--cs-frame);
  border-top: 0;
  border-radius: 0.5rem 0.5rem 0.2rem 0.2rem;
  background: var(--cs-face);
  box-shadow: 4px 6px 18px rgba(0, 0, 0, 0.5);
}
.cfs-dlg-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 2rem;
  margin: 0 -3px;
  padding: 0 0.3rem 0 0.6rem;
  border-radius: 0.5rem 0.5rem 0 0;
  background: linear-gradient(180deg, #0a5ef7 0%, #3d8cff 8%, #0b5ff2 22%, #0656ea 60%, #0353e8 85%, #0447c9 100%);
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 700;
  text-shadow: 1px 1px 1px #0f1a63;
}
.cfs-dlg-body { display: flex; flex-direction: column; gap: 0.55rem; padding: 0.8rem; font-size: 0.875rem; }
.cfs-row { display: grid; grid-template-columns: 6.4rem minmax(0, 1fr); align-items: center; gap: 0.5rem; }
.cfs-select {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2rem;
  padding: 0 2rem 0 0.45rem;
  border: 1px solid #7f9db9;
  background: #fff;
}
.cfs-select::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 1.4rem;
  border-left: 1px solid #c3d3fd;
  background: linear-gradient(#eef3fd, #c6d7fb) no-repeat, #fff;
}
.cfs-folder { width: 1.1rem; height: 0.85rem; border-radius: 2px; background: linear-gradient(#ffe58a, #eeb023); box-shadow: inset 0 0 0 1px #c08a14; }
.cfs-files {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 0.25rem 1rem;
  height: 5.4rem;
  padding: 0.35rem;
  overflow: hidden;
  border: 1px solid #7f9db9;
  background: #fff;
}
.cfs-file { display: flex; align-items: center; gap: 0.35rem; color: #222; }
.cfs-file-icon { width: 1.05rem; height: 1.2rem; border: 1px solid #6b7a90; background: linear-gradient(180deg, #8fd0ff 0 45%, #6bbf59 45% 100%); }
.cfs-field {
  min-height: 2rem;
  padding: 0 0.45rem;
  border: 1px solid #7f9db9;
  outline: none;
  background: #fff;
  color: #000;
  font: max(0.9375rem, 16px) var(--cs-font);
  user-select: text;
  -webkit-user-select: text;
}
.cfs-field:focus { box-shadow: 0 0 0 2px #98b8ea; }
.cfs-field::selection { background: var(--cs-select); color: #fff; }
.cfs-select::before {
  content: '';
  position: absolute;
  right: 0.42rem;
  top: 50%;
  z-index: 1;
  margin-top: -2px;
  border: 5px solid transparent;
  border-top-color: #4d6185;
}
.cfs-dlg-btns { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.2rem; }
.cfs-saving { display: flex; align-items: center; gap: 0.9rem; padding: 0.7rem 0.3rem 0.9rem; }
.cfs-saving-col { flex: 1; min-width: 0; }
.cfs-disk { position: relative; flex: none; width: 3.1rem; height: 3.1rem; animation: cfs-disk 0.45s ease-in-out infinite alternate; }
@keyframes cfs-disk { from { transform: rotate(-9deg) scale(1); } to { transform: rotate(9deg) scale(1.06); } }
.cfs-disk.is-done { animation: none; }
.cfs-disk.is-done::after {
  content: '✓';
  position: absolute;
  right: -0.5rem;
  bottom: -0.4rem;
  display: grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #2e9e4f;
  color: #fff;
  font: 900 1rem/1 var(--cs-font);
}
.cfs-prog-msg { margin: 0 0 0.45rem; font-size: 0.9375rem; overflow-wrap: anywhere; }
.cfs-prog {
  position: relative;
  height: 1.4rem;
  overflow: hidden;
  border: 1px solid #5a6a8e;
  border-radius: 3px;
  background: #e2e7f1;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}
.cfs-prog-back, .cfs-prog-fill { position: absolute; inset: 2px; transform: scaleX(0); transform-origin: 0 50%; }
.cfs-prog-back { background: #fff; box-shadow: 0 0 8px #fff; transition: transform 180ms ease-out; }
.cfs-prog-fill {
  background:
    repeating-linear-gradient(90deg, transparent 0 0.85rem, #e2e7f1 0.85rem calc(0.85rem + 2px)),
    linear-gradient(180deg, #e2fbe2 0%, #7de57d 22%, #33c033 52%, #22a822 78%, #6bd86b 100%);
  transition: transform 120ms ease-out;
}
.cfs-thumb { position: absolute; z-index: 60; width: 96px; height: 72px; border: 3px solid #fff; box-shadow: 0 6px 14px rgba(0, 0, 0, 0.45); pointer-events: none; }
.cf-fly.is-saved { color: #b7ffcf; font-size: 2rem; }
.cf-fly.is-about { color: #fff6a8; font-size: 1.15rem; }

@media (pointer: coarse) {
  .cfs-tbtn { min-height: 2.75rem; }
  .cfs-field, .cfs-select { min-height: 2.6rem; }
}
@media (max-width: 599px) {
  .cfs-toolbar { gap: 0; padding: 0.2rem 0.3rem; }
  .cfs-tbtn { justify-content: center; min-width: 2.75rem; padding: 0.2rem; }
  .cfs-tbtn-label { display: none; }
  .cfs-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .cfs-tools { gap: 0.35rem; padding: 0.35rem; border-right: 0; border-bottom: 1px solid #c9c5b4; }
  .cfs-toolgrid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .cfs-tool { width: auto; }
  .cfs-opts { flex-direction: row; min-height: 2.75rem; }
  .cfs-opts:empty { display: none; }
  .cfs-opt { flex: 1; min-width: 0; min-height: 2.6rem; }
  .cfs-paper { margin: 6px; }
  .cfs-swatches { flex: 1; grid-template-columns: repeat(8, minmax(0, 1fr)); grid-auto-rows: 2.6rem; }
  .cfs-hang { flex-direction: column; gap: 0.8rem; }
  .cfs-label { width: calc(100% - 1rem); max-width: 22rem; padding: 0.7rem 0.85rem; transform: translateY(12px); }
  .cfs-frame { padding: 1rem; }
  .cfs-rope { height: 1.8rem; margin-top: 0.6rem; }
  .cfs-gallery { justify-content: flex-start; gap: 0.7rem; padding-top: 1.4rem; }
}
html[data-reduced-motion="on"] .cfs-better::after,
html[data-reduced-motion="on"] .cfs-better-spark,
html[data-reduced-motion="on"] .cfs-disk { animation: none; }
