/* Tusk & Crown - the unified game frame: styles (shared/frame.js = window.TCFrame). Nov 29, 2026. docs/unified-ui-frame-spec.md.
   Every class starts tcf-. Loaded after the theme (theme.css) and the page's own styles; it never edits the generated UI v2 files.
   Pictures: --tcf-img-<name> from frame-art.css (tools/build.mjs writes it from the skin's packs/themes/<skin>/files/frame/frame.json),
   plates cut in three with the end caps from frame.json (--tcf-ks-<name> = the slice, --tcf-kc-<name> = cap / height).
   Colours are the collection's default palette (games/_defaults.json); the build swaps them to each skin's colours like any game code.
   Sizes (CSS px = pt): top bar 44 under the top safe area, 16 in from the sides, 8 apart; Back 44 tall; Help and Menu 44 x 44;
   Menu sheet rows 48, sliders 44; bottom bar buttons 48, 8 above the bottom safe area; level picker three 44 buttons, 8 under the bar. */
:root{--tcf-hit:44px;--tcf-edge:16px;--tcf-gap:8px;--tcf-safe-t:calc(env(safe-area-inset-top,0px) + var(--tc-frost, 0px));--tcf-safe-b:env(safe-area-inset-bottom,0px);
  --tcf-ink:#f3e6c8;--tcf-ink2:#bfa983;--tcf-acc:#ffd86b;--tcf-dark:#1a130e;--tcf-redink:#fff3e6;--tcf-bg1:#2b1d12;--tcf-bg2:#1a110b;--tcf-line:#9a6b12;
  --tcf-font:var(--ui-font-display,Georgia,"Times New Roman",serif);--tcf-font-b:var(--ui-font-body,"Trebuchet MS",Verdana,sans-serif)}

/* ---- icons (the kit's pictures, never smoothed) ---- */
.tcf-ic{display:block;flex:none;width:30px;height:30px;background:center/contain no-repeat;image-rendering:pixelated;image-rendering:crisp-edges;pointer-events:none;font-style:normal}
.tcf-i-back,.tcf-i-next{background-image:var(--tcf-img-back)}.tcf-i-next{transform:scaleX(-1)}
.tcf-i-help{background-image:var(--tcf-img-help)}.tcf-i-menu{background-image:var(--tcf-img-menu)}.tcf-i-close{background-image:var(--tcf-img-close)}
.tcf-i-check{background-image:var(--tcf-img-check)}.tcf-i-music{background-image:var(--tcf-img-music)}.tcf-i-music-off{background-image:var(--tcf-img-music-off)}
.tcf-i-sfx{background-image:var(--tcf-img-sfx)}.tcf-i-sfx-off{background-image:var(--tcf-img-sfx-off)}.tcf-i-undo{background-image:var(--tcf-img-undo)}
.tcf-i-hint{background-image:var(--tcf-img-hint)}.tcf-i-restart{background-image:var(--tcf-img-restart)}.tcf-i-pause{background-image:var(--tcf-img-pause)}
.tcf-i-play{background-image:var(--tcf-img-play)}.tcf-i-levels{background-image:var(--tcf-img-levels)}.tcf-i-flag{background-image:var(--tcf-img-flag)}
.tcf-i-plus{background-image:var(--tcf-img-plus)}.tcf-i-minus{background-image:var(--tcf-img-minus)}.tcf-i-leave{background-image:var(--tcf-img-leave)}
.tcf-i-sliders{background-image:var(--tcf-img-sliders)}.tcf-i-home{background-image:var(--tcf-img-home)}.tcf-i-tutorial{background-image:var(--tcf-img-tutorial)}
.tcf-i-shuffle{background-image:var(--tcf-img-shuffle)}.tcf-i-repeat{background-image:var(--tcf-img-repeat)}.tcf-i-hourglass{background-image:var(--tcf-img-hourglass)}
.tcf-i-trophy{background-image:var(--tcf-img-trophy)}.tcf-i-speed{background-image:var(--tcf-img-speed)}.tcf-i-online{background-image:var(--tcf-img-online)}
.tcf-i-list{background-image:var(--tcf-img-list)}.tcf-i-quit{background-image:var(--tcf-img-quit)}.tcf-i-new{background-image:var(--tcf-img-new)}

/* ---- plates: a square (sq), and wide plates cut in three (wide, big = primary, red = destructive, pill = the title plaque) ---- */
.tcf-sq{position:relative;flex:none;display:flex;align-items:center;justify-content:center;box-sizing:border-box;width:44px;height:44px;min-width:44px;min-height:44px;margin:0;padding:0;border:0;border-radius:0;
  background:var(--tcf-img-sq) center/100% 100% no-repeat;color:var(--tcf-ink);cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent;filter:drop-shadow(0 2px 0 rgba(0,0,0,.45));image-rendering:pixelated}
.tcf-sq[aria-pressed="true"],.tcf-sq.tcf-on{background-image:var(--tcf-img-sq-on)}
.tcf-sq:active,.tcf-plate:active{filter:brightness(.88) drop-shadow(0 1px 0 rgba(0,0,0,.45));transform:translateY(1px)}
.tcf-sq:disabled,.tcf-plate:disabled{opacity:.45;pointer-events:none}
.tcf-sq[hidden],.tcf-plate[hidden]{display:none}
.tcf-plate{--bh:44px;--tcf-k:var(--tcf-img-wide);--tcf-s:var(--tcf-ks-wide);--tcf-c:var(--tcf-kc-wide);
  position:relative;display:inline-flex;align-items:center;justify-content:center;gap:6px;box-sizing:border-box;height:var(--bh);min-height:var(--bh);min-width:44px;margin:0;
  padding:0 calc(var(--bh) * var(--tcf-c) * .6);border:1px solid transparent;border-radius:0;background:none;
  border-image:var(--tcf-k) var(--tcf-s) fill / calc(var(--bh) / 2) calc(var(--bh) * var(--tcf-c)) stretch;image-rendering:pixelated;
  color:var(--tcf-ink);font:700 15px/1.1 var(--tcf-font);letter-spacing:.02em;text-transform:var(--ui-btn-case,none);text-decoration:none;white-space:nowrap;
  text-shadow:0 2px 0 rgba(0,0,0,.75),0 0 3px rgba(0,0,0,.5);cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent;filter:drop-shadow(0 2px 0 rgba(0,0,0,.45))}
.tcf-plate .tcf-ic{width:24px;height:24px}
.tcf-plate.tcf-big{--tcf-k:var(--tcf-img-big);--tcf-s:var(--tcf-ks-big);--tcf-c:var(--tcf-kc-big);color:var(--tcf-dark);text-shadow:0 1px 0 rgba(255,255,255,.5)}
.tcf-plate.tcf-red{--tcf-k:var(--tcf-img-red);--tcf-s:var(--tcf-ks-red);--tcf-c:var(--tcf-kc-red);color:var(--tcf-redink)}
.tcf-plate.tcf-full{display:flex;width:100%;--bh:48px}
.tcf-plate.tcf-small{--bh:44px;font-size:15px;flex:none}
.tcf-l{pointer-events:none}

/* ---- the top bar: Back | name on the plaque | Help, Menu ---- */
.tcf-bar{display:flex;align-items:center;gap:8px;box-sizing:border-box;height:calc(44px + var(--tcf-safe-t));padding:var(--tcf-safe-t) 16px 0}
.tcf-bar>.tcf-back{--bh:44px;flex:none;max-width:120px;padding:0 12px 0 8px;gap:4px;-webkit-user-select:none;user-select:none}
.tcf-bar>.tcf-back .tcf-ic{width:26px;height:26px}
.tcf-back-t{pointer-events:none}   /* the word on Back is not a target of its own (the whole plate is) */
/* a name too long for the plaque: Back keeps only its arrow on a 44 pt square (frame.js fitTitle) */
.tcf-bar.tcf-tight>.tcf-back{width:44px;max-width:44px;min-width:44px;padding:0;justify-content:center}
.tcf-bar.tcf-tight>.tcf-back .tcf-back-t{display:none}
/* safeTop: false - the page's own box already keeps the top safe area clear */
.tcf-bar.tcf-nosafe{height:44px;padding-top:0}
.tcf-bar>.tcf-title{flex:1 1 0;min-width:0;display:flex;justify-content:center;align-items:center;height:44px}
/* the name plaque: the kit's pill, or the game's own plaque art (TCFrame.plaque({ img, cut, h }) sets --tcf-plaque and its cut) */
.tcf-plaque{--bh:44px;box-sizing:border-box;display:block;max-width:100%;height:var(--bh);margin:0;padding:0 calc(var(--bh) * var(--tcf-kc-pill) * .62);border:1px solid transparent;
  border-image:var(--tcf-img-pill) var(--tcf-ks-pill) fill / calc(var(--bh) / 2) calc(var(--bh) * var(--tcf-kc-pill)) stretch;image-rendering:pixelated;
  line-height:calc(var(--bh) - 2px);white-space:nowrap;overflow:hidden;text-align:center;flex:none}
.tcf-plaque.tcf-own{padding:0 var(--tcf-plaque-pad,16px);border-image:var(--tcf-plaque) var(--tcf-plaque-cut) fill / var(--tcf-plaque-bw) stretch}
/* hidden on a screen with the game's own big title sign: the bar keeps its place, so Back, Help and Menu do not move */
.tcf-plaque[hidden]{display:block;visibility:hidden}
.tcf-bar>.tcf-sq .tcf-ic{width:32px;height:32px}
.tcf-bar>.tcf-sq[hidden]{display:none}

/* ---- sheets: one backdrop; the Menu and Help are bottom sheets, a confirm sits in the middle ---- */
.tcf-ov{position:fixed;inset:0;z-index:2147482000;display:flex;align-items:flex-end;justify-content:center;background:rgba(0,0,0,.55);-webkit-tap-highlight-color:transparent;touch-action:none}
.tcf-ov[hidden]{display:none}
html.tc-sa .tcf-ov{bottom:auto;height:var(--tcvh)}
.tcf-sheet{position:relative;box-sizing:border-box;width:100%;max-width:430px;max-height:calc(100% - var(--tcf-safe-t) - 52px);display:flex;flex-direction:column;outline:none;
  padding:0 16px max(16px, var(--tcf-safe-b));color:var(--tcf-ink);font:15px/1.3 var(--tcf-font-b);touch-action:auto;
  background:linear-gradient(var(--tcf-bg1),var(--tcf-bg2));border:2px solid var(--tcf-line);border-bottom:0;border-radius:16px 16px 0 0;box-shadow:0 -10px 30px rgba(0,0,0,.6),inset 0 1px 0 rgba(255,255,255,.12)}
.tcf-sheet *{box-sizing:border-box}
.tcf-sheet-h{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:60px;padding:8px 0;flex:none}
.tcf-sheet-t{margin:0;font:800 21px/1.1 var(--tcf-font);color:var(--tcf-acc);text-transform:var(--ui-btn-case,none);letter-spacing:.04em;text-shadow:0 2px 0 rgba(0,0,0,.6)}
.tcf-sheet-b{overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;min-height:0;display:flex;flex-direction:column;gap:8px;padding-bottom:4px}
.tcf-sec{display:flex;flex-direction:column;gap:8px;padding:8px 0;border-top:1px solid rgba(255,255,255,.1)}
.tcf-sec:first-child{border-top:0;padding-top:0}
.tcf-sec[hidden]{display:none}
.tcf-run{padding-top:12px}

/* sound: mute square, name and level, then the slider (44 tall) */
.tcf-mix{display:grid;grid-template-columns:44px 1fr;grid-template-rows:auto 44px;column-gap:12px;align-items:center}
.tcf-mix[hidden]{display:none}
.tcf-mix .tcf-mute{grid-row:1 / span 2}
.tcf-mix-t{display:flex;justify-content:space-between;align-items:baseline;font:700 15px/1.2 var(--tcf-font);padding:0 2px}
.tcf-mix-t b{color:var(--tcf-acc);font-variant-numeric:tabular-nums;min-width:3ch;text-align:right}
.tcf-mix.tcf-off .tcf-mix-t b{color:var(--tcf-ink2)}
.tcf-mix.tcf-off .tcf-range{opacity:.5}
.tcf-range{--tcf-p:50%;-webkit-appearance:none;appearance:none;display:block;width:100%;height:44px;margin:0;padding:0;background:transparent;cursor:pointer;touch-action:none;outline:none}
.tcf-range::-webkit-slider-runnable-track{height:10px;border-radius:5px;border:1px solid rgba(0,0,0,.6);background:linear-gradient(90deg,var(--tcf-acc) var(--tcf-p),rgba(0,0,0,.55) var(--tcf-p));box-shadow:inset 0 1px 2px rgba(0,0,0,.6)}
.tcf-range::-webkit-slider-thumb{-webkit-appearance:none;width:30px;height:30px;margin-top:-11px;border-radius:50%;border:2px solid var(--tcf-dark);background:radial-gradient(circle at 40% 35%,#fff7d6,var(--tcf-acc) 55%,#b8841f);box-shadow:0 2px 4px rgba(0,0,0,.6)}
.tcf-range::-moz-range-track{height:10px;border-radius:5px;border:1px solid rgba(0,0,0,.6);background:rgba(0,0,0,.55)}
.tcf-range::-moz-range-progress{height:10px;border-radius:5px;background:var(--tcf-acc)}
.tcf-range::-moz-range-thumb{width:28px;height:28px;border-radius:50%;border:2px solid var(--tcf-dark);background:var(--tcf-acc)}
.tcf-range:focus-visible::-webkit-slider-thumb{outline:2px solid var(--tcf-ink);outline-offset:2px}

/* rows: a switch, a choice, a button (48 tall) */
.tcf-row{display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;min-height:48px !important;margin:0;padding:2px 2px;border:0;background:none;color:inherit;text-align:left;
  font:700 15px/1.2 var(--tcf-font);cursor:pointer;-webkit-tap-highlight-color:transparent;touch-action:manipulation}
.tcf-row[hidden]{display:none}
.tcf-row-t{display:flex;flex-direction:column;min-width:0}
.tcf-row-t small{font:500 12px/1.3 var(--tcf-font-b);color:var(--tcf-ink2);margin-top:2px}
.tcf-switch{flex:none;width:68px;height:36px;background:var(--tcf-img-sw-off) center/100% 100% no-repeat;image-rendering:pixelated;filter:drop-shadow(0 2px 0 rgba(0,0,0,.45))}
.tcf-swrow.tcf-on .tcf-switch{background-image:var(--tcf-img-sw-on)}
.tcf-choice,.tcf-btnrow,.tcf-content{cursor:default}
/* a choice: the label, then its plates on a line of their own (kit plates; the picked one is the "big" plate) */
.tcf-choice{flex-wrap:wrap;row-gap:6px}
.tcf-choice>.tcf-row-t{flex:1 1 100%}
.tcf-seg{display:flex;gap:8px;flex:1 1 100%;min-width:0}
.tcf-seg>.tcf-segb{flex:1 1 0;min-width:0;padding:0 12px;font-size:14px}
/* a game's own panel inside the Menu */
.tcf-content{flex-direction:column;align-items:stretch}
.tcf-content-b{width:100%;font:500 14px/1.35 var(--tcf-font-b)}

/* help and confirm */
.tcf-help-l{margin:0 0 8px;padding:0 0 0 20px;display:flex;flex-direction:column;gap:8px;font-size:15px;line-height:1.35}
.tcf-confirm{align-items:center;padding:16px}
.tcf-confirm .tcf-sheet{border-radius:16px;border-bottom:2px solid var(--tcf-line);max-width:360px;padding:16px;gap:8px}
.tcf-c-t{text-align:center}
.tcf-c-x{margin:0;text-align:center;color:var(--tcf-ink)}
.tcf-c-row{display:flex;gap:8px;margin-top:8px}
.tcf-c-row .tcf-plate{flex:1 1 0;min-width:0}

/* ---- the bottom action bar (48 tall buttons) and the level picker (three 44 tall buttons) ---- */
.tcf-actions{display:flex;gap:8px;padding:0 16px;margin:0 0 calc(8px + var(--tcf-safe-b))}
.tcf-actions.tcf-fixed{position:fixed;left:0;right:0;bottom:0;z-index:40;max-width:430px;margin-left:auto;margin-right:auto}
.tcf-actions>.tcf-plate{--bh:48px;flex:1 1 0;min-width:0}
.tcf-levels{display:flex;justify-content:center;align-items:center;gap:8px;margin:8px 16px 0}
.tcf-levels>.tcf-plate{min-width:132px}
@media (min-width:600px) and (min-height:600px){.tcf-actions{max-width:560px;margin-left:auto;margin-right:auto;padding:0 24px}}
@media (prefers-reduced-motion:reduce){.tcf-sq:active,.tcf-plate:active{transform:none}}
/* actions({ icons: 'wide' }): no icons on a phone */
@media (max-width:599px){.tcf-actions.tcf-icons-wide .tcf-ic{display:none}}
.tcf-help-x{margin:0 0 8px}
/* the Kingdom's reward toasts (shared/meta.js, 56 under the safe area) would land on the level picker: below it on pages that have one */
html:has(.tcf-levels) .tcm-toasts{top:calc(calc(env(safe-area-inset-top,0px) + var(--tc-frost, 0px)) + 108px) !important}
/* a bottom sheet never reaches over the top bar (44 + 8): Help, Menu and Back stay tappable above a tall Help (wave 2 fresh-eyes test) */
/* Tall Home Screen app (Nov 30, 2026; html.tc-tall and --tc-frost, set by the build's tcFitApp snippet, tools/build.mjs TALL_FROST): the
   bar sits under the strip iOS frosts because the build writes every calc(env(safe-area-inset-top) + var(--tc-frost, 0px)) as "that plus var(--tc-frost, 0px)".
   On the home page's title screen the lowered Menu square would lie on the logo: it waits until the title is tapped away. */
html.tc-tall:has(#tccTitle:not(.gone)) .tcf-bar{visibility:hidden}
