/* XS-RestaurantCreator — kitchen docket rail.
   Kraft paper on a dark pass, Courier throughout, tickets clipped to a steel
   rail. Every surface in here is meant to look like something a kitchen would
   actually have on the wall. */

:root {
    --kraft:      #d9cdb4;
    --kraft-deep: #c9bb9d;
    --kraft-dark: #b6a684;
    --ink:        #1a1714;
    --ink-soft:   #4b443c;
    --ink-faint:  #7d7364;
    --stamp:      #c1272d;
    --stamp-dark: #8f1c21;
    --green:      #3f7d3f;
    --amber:      #c98a1e;
    --pass:       #16130f;
    --steel-top:  #6d6760;
    --steel-bot:  #2b2825;

    --tag: 'Courier New', 'Courier', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--tag);
    background: transparent;
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    user-select: none;
}

[hidden] { display: none !important; }

button, input, select, textarea {
    font: inherit;
    color: inherit;
    border: 0;
    background: none;
    outline: none;
}

button { cursor: pointer; }

/* Kraft. A flat colour reads as plastic, so every paper surface gets the same
   two-layer grain: a fine horizontal tooth and a wide blotch. */
.paper {
    background-color: var(--kraft);
    background-image:
        repeating-linear-gradient(0deg, rgba(60, 45, 20, .035) 0 1px, transparent 1px 3px),
        repeating-linear-gradient(90deg, rgba(60, 45, 20, .022) 0 1px, transparent 1px 4px),
        radial-gradient(120% 90% at 15% 0%, rgba(255, 250, 235, .5), transparent 55%),
        radial-gradient(90% 70% at 85% 100%, rgba(120, 95, 55, .16), transparent 60%);
}

/* Torn top edge.

   A mask, not a painted strip: the notches have to be genuinely transparent
   because whatever is behind them is the game, and it is a different colour
   every second. Two layers — the toothed strip along the top, then the rest of
   the element below it. */
.tear {
    --zig: 11px;
    -webkit-mask-image:
        conic-gradient(from -45deg at 50% var(--zig), transparent 25%, #000 0),
        linear-gradient(#000, #000);
    -webkit-mask-size: var(--zig) 100%, 100% calc(100% - var(--zig));
    -webkit-mask-position: 0 0, 0 var(--zig);
    -webkit-mask-repeat: repeat-x, no-repeat;
    mask-image:
        conic-gradient(from -45deg at 50% var(--zig), transparent 25%, #000 0),
        linear-gradient(#000, #000);
    mask-size: var(--zig) 100%, 100% calc(100% - var(--zig));
    mask-position: 0 0, 0 var(--zig);
    mask-repeat: repeat-x, no-repeat;
}

/* ------------------------------------------------------------------ HUD -- */

#hud {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 10;
}

.tag {
    position: absolute;
    top: 18px; left: 50%;
    transform: translateX(-50%) rotate(-1deg);
    padding: 7px 16px 8px;
    background: var(--kraft);
    color: var(--ink);
    font-size: 13px;
    letter-spacing: .12em;
    text-transform: uppercase;
    box-shadow: 0 5px 14px rgba(0, 0, 0, .55);
    border-left: 3px solid var(--stamp);
}

.tag b { font-weight: 700; }
.tag span { color: var(--ink-faint); }

/* The kitchen screen: open tickets, oldest at the top. */
#hud-rail {
    position: absolute;
    top: 20px; right: 22px;
    width: 252px;
    max-height: 76vh;
    overflow: hidden;
}

.rail-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 12px;
    background: linear-gradient(180deg, var(--steel-top), var(--steel-bot));
    color: #efe7d8;
    font-size: 11px;
    letter-spacing: .22em;
    border-top: 1px solid rgba(255, 255, 255, .22);
    box-shadow: 0 4px 10px rgba(0, 0, 0, .5);
}

#rail-count {
    background: var(--stamp);
    padding: 0 7px;
    letter-spacing: 0;
    font-weight: 700;
}

#rail-list { padding-top: 12px; }

.docket {
    position: relative;
    margin: 0 0 12px;
    padding: 18px 13px 11px;
    background-color: var(--kraft);
    box-shadow: 0 6px 14px rgba(0, 0, 0, .5);
    font-size: 12px;
    transform-origin: 50% 0;
}

.docket:nth-child(odd)  { transform: rotate(-1.1deg); }
.docket:nth-child(even) { transform: rotate(.9deg); }

/* A spine down the side rather than an outline, because the torn edge masks
   anything drawn around the box. */
.docket.ready { box-shadow: inset 5px 0 0 var(--green), 0 6px 14px rgba(0, 0, 0, .5); }
.docket.late  { box-shadow: inset 5px 0 0 var(--stamp), 0 6px 14px rgba(0, 0, 0, .5); }

/* A bill that has just been handed to you. The docket rules below are shared
   with the invoice slips in the panel, so a bill reads the same in both. */
#hud-bill {
    position: absolute;
    left: 22px; bottom: 22px;
    width: 250px;
    padding: 21px 14px 12px;
    background-color: var(--kraft);
    box-shadow: 0 6px 16px rgba(0, 0, 0, .55);
    transform: rotate(-1.2deg);
    font-size: 12px;
}

.docket-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    border-bottom: 1px dashed rgba(26, 23, 20, .35);
    padding-bottom: 5px;
    margin-bottom: 6px;
}

.docket-top b { font-size: 13px; }
.docket-top i { font-style: normal; color: var(--ink-faint); font-size: 11px; }

.docket-line {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 2px 0;
}

.docket-line em { font-style: normal; color: var(--ink-soft); }
.docket-line.done { color: var(--ink-faint); }
.docket-line.done .needed { color: var(--ink-faint); }

/* ---------------------------------------------------------------- PANEL -- */

#app {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(80% 70% at 50% 40%, rgba(30, 26, 21, .72), rgba(9, 8, 6, .93));
    z-index: 20;
}

.board {
    width: min(1180px, 94vw);
    height: min(820px, 90vh);
    display: flex;
    flex-direction: column;
    animation: drop .28s cubic-bezier(.2, .9, .3, 1.1);
}

@keyframes drop {
    from { transform: translateY(-14px) rotate(-.4deg); }
    to   { transform: none; }
}

/* The rail the tabs hang from. */
.rail {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 0 26px;
    height: 62px;
    flex: none;
}

.rail-wire {
    position: absolute;
    left: 0; right: 0; top: 12px;
    height: 9px;
    background: linear-gradient(180deg, #7e776e 0%, #55504a 45%, #23211e 100%);
    box-shadow: 0 3px 8px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .3);
}

.tabs { display: flex; gap: 8px; padding-top: 8px; }

.tab {
    position: relative;
    padding: 12px 16px 9px;
    background-color: var(--kraft-deep);
    color: var(--ink-soft);
    font-size: 12px;
    letter-spacing: .16em;
    text-transform: uppercase;
    box-shadow: 0 5px 12px rgba(0, 0, 0, .45);
    transform-origin: 50% 0;
    transform: rotate(-1deg);
    transition: transform .16s ease, color .16s ease, background-color .16s ease;
}

.tab:nth-child(even) { transform: rotate(1.2deg); }

/* The clip that holds it to the wire. */
.tab::after {
    content: '';
    position: absolute;
    top: -9px; left: 50%;
    width: 12px; height: 15px;
    margin-left: -6px;
    background: linear-gradient(180deg, #a9a29a, #4b4641);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .6);
}

.tab:hover { color: var(--ink); transform: rotate(0deg) translateY(2px); }

.tab.on {
    background-color: var(--kraft);
    color: var(--ink);
    transform: rotate(0deg) translateY(3px);
    box-shadow: 0 8px 18px rgba(0, 0, 0, .55), inset 0 0 0 2px var(--stamp);
}

.tab .dot {
    display: inline-block;
    width: 6px; height: 6px;
    margin-left: 7px;
    background: var(--stamp);
    vertical-align: middle;
}

.shut {
    margin-left: auto;
    margin-top: 8px;
    padding: 12px 15px 9px;
    background-color: var(--stamp);
    color: #fff2ec;
    font-size: 12px;
    letter-spacing: .16em;
    box-shadow: 0 5px 12px rgba(0, 0, 0, .45);
    transform: rotate(1deg);
    transition: transform .16s ease, background-color .16s ease;
}

.shut::after {
    content: '';
    position: absolute;
    top: -9px; left: 50%;
    width: 12px; height: 15px;
    margin-left: -6px;
    background: linear-gradient(180deg, #a9a29a, #4b4641);
}

.shut { position: relative; }
.shut:hover { background-color: var(--stamp-dark); transform: rotate(0deg) translateY(2px); }

/* The sheet everything is written on. */
.sheet {
    position: relative;
    flex: 1;
    --zig: 18px;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background-color: var(--kraft);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .7);

    -webkit-mask-image:
        conic-gradient(from -45deg at 50% var(--zig), transparent 25%, #000 0),
        linear-gradient(#000, #000);
    -webkit-mask-size: var(--zig) 100%, 100% calc(100% - var(--zig));
    -webkit-mask-position: 0 0, 0 var(--zig);
    -webkit-mask-repeat: repeat-x, no-repeat;
    mask-image:
        conic-gradient(from -45deg at 50% var(--zig), transparent 25%, #000 0),
        linear-gradient(#000, #000);
    mask-size: var(--zig) 100%, 100% calc(100% - var(--zig));
    mask-position: 0 0, 0 var(--zig);
    mask-repeat: repeat-x, no-repeat;
}



.sheet-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 30px 30px 16px;
    border-bottom: 2px solid rgba(26, 23, 20, .16);
}

.sheet-head h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.sheet-head p {
    margin-top: 5px;
    font-size: 12.5px;
    color: var(--ink-soft);
}

.docket-no {
    text-align: right;
    color: var(--ink-faint);
    font-size: 11px;
    letter-spacing: .18em;
}

.docket-no strong {
    display: block;
    font-size: 22px;
    color: var(--stamp);
    letter-spacing: .06em;
}

.sheet-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 22px 30px 28px;
}

.sheet-body::-webkit-scrollbar { width: 9px; }
.sheet-body::-webkit-scrollbar-track { background: rgba(26, 23, 20, .07); }
.sheet-body::-webkit-scrollbar-thumb { background: rgba(26, 23, 20, .3); }
.sheet-body::-webkit-scrollbar-thumb:hover { background: rgba(26, 23, 20, .5); }

/* ----------------------------------------------------------- COMPONENTS -- */

.stamp {
    display: inline-block;
    padding: 2px 9px 3px;
    border: 2px solid var(--stamp);
    color: var(--stamp);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .2em;
    text-transform: uppercase;
    transform: rotate(-6deg);
    opacity: .9;
}

.stamp.green { border-color: var(--green); color: var(--green); }
.stamp.amber { border-color: var(--amber); color: var(--amber); }
.stamp.flat  { transform: none; }

.rule {
    height: 0;
    border-top: 1px dashed rgba(26, 23, 20, .35);
    margin: 18px 0;
}

.hint {
    font-size: 12px;
    color: var(--ink-faint);
    line-height: 1.6;
}

.empty {
    padding: 46px 20px;
    text-align: center;
    color: var(--ink-faint);
    font-size: 13px;
    border: 2px dashed rgba(26, 23, 20, .22);
}

.empty b { display: block; font-size: 15px; color: var(--ink-soft); margin-bottom: 8px; letter-spacing: .1em; }

/* Buttons are rubber stamps and carbon slips. */
.btn {
    padding: 9px 15px;
    background: var(--ink);
    color: var(--kraft);
    font-size: 12px;
    letter-spacing: .14em;
    text-transform: uppercase;
    transition: background-color .15s ease, transform .12s ease;
}

.btn:hover { background: #322c26; transform: translateY(-1px); }
.btn:active { transform: none; }
.btn.red { background: var(--stamp); color: #fff2ec; }
.btn.red:hover { background: var(--stamp-dark); }
.btn.green { background: var(--green); color: #f0f6ec; }
.btn.ghost { background: none; color: var(--ink-soft); box-shadow: inset 0 0 0 2px rgba(26, 23, 20, .3); }
.btn.ghost:hover { background: rgba(26, 23, 20, .07); color: var(--ink); }
.btn.small { padding: 5px 10px; font-size: 11px; letter-spacing: .1em; }
.btn[disabled] { opacity: .35; pointer-events: none; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }

.field { display: block; margin-bottom: 14px; }

.field span {
    display: block;
    font-size: 11px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin-bottom: 5px;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 9px 11px;
    background: rgba(255, 252, 244, .5);
    box-shadow: inset 0 0 0 1px rgba(26, 23, 20, .3);
    font-size: 13px;
    user-select: text;
}

.field input:focus,
.field select:focus,
.field textarea:focus { box-shadow: inset 0 0 0 2px var(--stamp); }

.field textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
.field select { cursor: pointer; }

.cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.cols.two { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }

/* A card is a slip of paper pinned to the sheet. */
.slip {
    position: relative;
    padding: 15px 16px 14px;
    background-color: var(--kraft-deep);
    box-shadow: 0 3px 9px rgba(0, 0, 0, .22);
    transition: transform .16s ease, box-shadow .16s ease;
}

.slip.pick { cursor: pointer; }
.slip.pick:hover { transform: translateY(-2px) rotate(-.5deg); box-shadow: 0 8px 18px rgba(0, 0, 0, .3); }
.slip.on { box-shadow: 0 0 0 2px var(--stamp), 0 8px 18px rgba(0, 0, 0, .3); }

.slip h3 {
    font-size: 15px;
    letter-spacing: .06em;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.slip .meta { font-size: 11.5px; color: var(--ink-soft); line-height: 1.7; }
.slip .corner { position: absolute; top: 12px; right: 12px; }

/* Tables are printed lists. */
.list { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.list th {
    text-align: left;
    padding: 6px 10px;
    font-size: 10.5px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--ink-faint);
    border-bottom: 2px solid rgba(26, 23, 20, .25);
}
.list td { padding: 9px 10px; border-bottom: 1px dashed rgba(26, 23, 20, .22); }
.list tr:hover td { background: rgba(255, 252, 244, .35); }
.list .num { text-align: right; font-variant-numeric: tabular-nums; }
.list .pos { color: var(--green); }
.list .neg { color: var(--stamp); }

.pill {
    display: inline-block;
    padding: 2px 8px 3px;
    font-size: 10.5px;
    letter-spacing: .14em;
    text-transform: uppercase;
    background: rgba(26, 23, 20, .1);
    color: var(--ink-soft);
}

.pill.red   { background: rgba(193, 39, 45, .16); color: var(--stamp-dark); }
.pill.green { background: rgba(63, 125, 63, .16); color: var(--green); }
.pill.amber { background: rgba(201, 138, 30, .18); color: #8a5c10; }

/* Filter-as-you-type item box. */
.picker { position: relative; }

.picker-list {
    position: absolute;
    left: 0; right: 0; top: 100%;
    z-index: 6;
    max-height: 230px;
    overflow-y: auto;
    background-color: var(--kraft);
    box-shadow: 0 10px 24px rgba(0, 0, 0, .4), inset 0 0 0 2px var(--stamp);
}

.picker-list button {
    display: block;
    width: 100%;
    padding: 7px 11px;
    text-align: left;
    border-bottom: 1px dashed rgba(26, 23, 20, .18);
}

.picker-list button:hover { background: rgba(193, 39, 45, .12); }
.picker-list b { display: block; font-size: 12.5px; }
.picker-list i { font-style: normal; font-size: 11px; color: var(--ink-faint); }

.picker-none { padding: 10px 11px; font-size: 11.5px; color: var(--ink-faint); }

.picker-list::-webkit-scrollbar { width: 8px; }
.picker-list::-webkit-scrollbar-thumb { background: rgba(26, 23, 20, .3); }

/* The builder's list of placed things. */
.spots { display: flex; flex-direction: column; gap: 8px; }

.spot {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    background: rgba(255, 252, 244, .42);
    box-shadow: inset 0 0 0 1px rgba(26, 23, 20, .2);
    font-size: 12.5px;
}

.spot .swatch { width: 10px; height: 26px; flex: none; }

/* Inline controls sitting in a row or on a placed point. Same box as a field,
   just tighter. */
.spot select, .spot input, .row > select, .row > input, .list input {
    flex: none;
    padding: 5px 9px;
    font-size: 12px;
    background: rgba(255, 252, 244, .5);
    box-shadow: inset 0 0 0 1px rgba(26, 23, 20, .3);
}

.spot select:focus, .spot input:focus, .row > select:focus, .row > input:focus, .list input:focus {
    box-shadow: inset 0 0 0 2px var(--stamp);
}

.spot input[type="number"], .list input[type="number"] { width: 72px; text-align: right; }

.row > input[type="checkbox"] { padding: 0; background: none; box-shadow: none; width: auto; }

/* A name you can type over without it looking like a form. */
.spot .name input {
    width: 100%;
    padding: 2px 4px;
    font-size: 12.5px;
    background: transparent;
    box-shadow: none;
    user-select: text;
}

.spot .name input:hover { box-shadow: inset 0 0 0 1px rgba(26, 23, 20, .25); }
.spot .name input:focus { background: rgba(255, 252, 244, .7); box-shadow: inset 0 0 0 2px var(--stamp); }
.spot .name { flex: 1; min-width: 0; }
.spot .name b { display: block; }
.spot .name i { display: block; font-style: normal; font-size: 11px; color: var(--ink-faint); }

.needed { color: var(--stamp); }
.warned { color: #8a5c10; }

/* Placement overlay. */
#busy {
    position: fixed;
    inset: auto 0 42px 0;
    display: flex;
    justify-content: center;
    pointer-events: none;
    z-index: 30;
}

.busy-card {
    padding: 19px 22px 16px;
    background-color: var(--kraft);
    box-shadow: 0 10px 28px rgba(0, 0, 0, .6);
    text-align: center;
    transform: rotate(-.8deg);
}

.busy-card strong { display: block; margin: 8px 0 4px; font-size: 17px; letter-spacing: .1em; }
.busy-card p { font-size: 11.5px; color: var(--ink-soft); letter-spacing: .06em; }

@media (max-height: 760px) {
    .sheet-head { padding: 24px 24px 12px; }
    .sheet-head h1 { font-size: 20px; }
    .sheet-body { padding: 16px 24px 20px; }
}
