:root {
    --bg: #242424;
    --table: #4d351e;
    --bill-w: 220px;
    --bill-h: 100px;
    --drawer-w: 300px;
    --drawer-h: 160px;
}

body {
    margin: 0;
    font-family: system-ui;
    background: linear-gradient(180deg, var(--bg), #1a1a1a);
    color: #e4e4e4;
    user-select: none;
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    gap: 1rem;
    background: rgb(32, 32, 32);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

header a {
    text-decoration: none;
}

header .left {
    display: flex;
    align-items: center;
}

header .center {
    text-align: center;
    cursor: help
}

header .right {
    display: flex;
    gap: 0.5rem;
}

footer {
    padding: 5px 18px;
    text-align: center;
    background: rgb(32, 32, 32);
    color: #ccc;
    position: relative;
}

footer a {
    color: #ccc;
}

.header-btn {
    background: #fff;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.3em;
    cursor: pointer;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: scale 0.2s, box-shadow 0.2s;
    padding: 0;
}

.header-btn:hover,
.header-btn:focus {
    scale: 1.3;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.10);
}

.header-btn:active {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.10);
}

.info-icon {
    pointer-events: none;
}

#table {
    position: relative;
    height: calc(100vh - 165px);
    margin: 8px;
    border-radius: 10px;
    background: linear-gradient(180deg, var(--table), #221004);
    box-shadow: inset 0 10px 30px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    touch-action: none;
}

.bill {
    position: absolute;
    width: var(--bill-w);
    height: var(--bill-h);
    cursor: grab;
    transform-origin: center center;
    transition: box-shadow 0.08s ease, transform 0.08s ease;
    perspective: 900px;
    border-radius: 5px;
    box-shadow: 0 0 1px rgba(0, 0, 0);
}

.bill.dragging {
    cursor: grabbing;
    box-shadow: 0 0 10px rgba(0, 0, 0);
}

.inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.28s cubic-bezier(.2, .85, .25, 1);
}

.face {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    box-sizing: border-box;
    backface-visibility: hidden;
    border-radius: 5px;
    font-weight: 700;
    font-size: 20px;
    background-image:
        repeating-linear-gradient(45deg,
            rgba(0, 0, 0, 0.05) 0,
            rgba(0, 0, 0, 0.05) 5px,
            transparent 5px,
            transparent 10px),
        linear-gradient(135deg, #f5f0e6, #d9d0b8);
    background-blend-mode: multiply;
}

.front {
    position: relative;
    width: var(--bill-w);
    height: var(--bill-h);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #d8d4b4;
    border-radius: 5px;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

.back {
    background-color: #d8d4b4;
    transform: rotateY(180deg);
    color: #2a593f;
    border: 2px solid rgba(0, 0, 0, 0.06);
    justify-content: center;
    font-size: 16px;
}

.bill .denom {
    position: absolute;
    font-weight: 1000;
    color: #2a593f;
    padding: 0px 5px;
    border-radius: 5px;
    pointer-events: none;
}

.denom-topleft {
    top: 0px;
    left: 0px;
    font-size: 1.4em;
}

.denom-topright {
    top: 0px;
    right: 0px;
    font-size: 0.8em;
}

.denom-bottomright {
    bottom: 0px;
    right: 0px;
    font-size: 1.4em;
}

.denom-bottomleft {
    bottom: 0px;
    left: 0px;
    font-size: 0.8em;
}

.bill-center {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.6em;
    font-weight: 800;
    color: #5a5a5a;
    letter-spacing: 0.04em;
    pointer-events: none;
    text-align: center;
    border-radius: 50px / 25px;
    padding: 5px 15px;
    border-style: double;
    border-color: #5a5a5a;
}

.drawer {
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    width: var(--drawer-w);
    height: var(--drawer-h);
    background: #b0b0b0;
    border: 4px solid #555;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    z-index: 0;
}

.lid {
    --metal1: #9aa1a7;
    --metal2: #c7ccd1;
    --metal3: #7f868d;
    background:
        radial-gradient(120% 80% at 30% 20%, #ffffff40, #00000000 50%),
        linear-gradient(180deg, var(--metal2), var(--metal1) 40%, var(--metal3));
    border: 1px solid #7c8288;
    border-radius: 0px 0px 4px 4px;
    box-shadow:
        inset 0 1px 0 #ffffff66,
        inset 0 -2px 6px #00000033,
        0 6px 16px #00000025;

    position: absolute;
    transform: translate(-50%, 0px);
    top: 0px;
    left: 50%;
    width: var(--drawer-w);
    height: calc(var(--drawer-h) + 3px);
    transition: transform 0.1s linear;
    cursor: grab;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.etched {
    font: 700 15px/1 system-ui;
    letter-spacing: 0.4em;
    background: linear-gradient(180deg, #e9ecef 0%, #aeb4bb 45%, #fafbfc 55%, #8f969d 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow:
        0.01em 0.05em 0 #22222255,
        0.07em -0.02em 0 #ccccccc8;
}

.lid:active {
    cursor: grabbing;
}

.handle {
    position: absolute;
    bottom: 10px;
    width: 40px;
    height: 8px;
    background: linear-gradient(to bottom, #999, #666);
    border-radius: 4px;
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.4),
        inset 0 -1px 2px rgba(0, 0, 0, 0.4);
}

.speech-bubble {
    /* Hide initially */
    position: absolute;
    top: 20px;
    left: 15%;
    right: calc(50% + var(--drawer-w) / 2 + 20px);
    padding: 8px 12px;
    background: rgba(256, 256, 256, 0.85);
    color: black;
    border: 2px solid #333;
    border-radius: 8px;
    text-align: center;
    z-index: 9999;
    pointer-events: none;
    transition: opacity 1s ease;
    flex-direction: column;
}

.speech-bubble::after {
    display: flex;
    content: "";
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 16px solid transparent;
    border-right: 16px solid transparent;
    border-bottom: 20px solid rgba(256, 256, 256, 0.85);
}

.speech-bubble-reject {
    display: flex;
    background: #ffcccc;
    color: #cc0000;
    border-color: #990000;
    border-radius: 10px;
    border-style: solid;
    border-width: 2px;
    pointer-events: all;
    padding: 4px 8px;
    width: fit-content;
    justify-self: center;
    margin-top: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

.speech-bubble-reject:hover {
    background: #ff9999;
    color: #990000;
}

.stats-pad {
    position: absolute;
    width: 150px;
    height: 250px;
    background-color: cornsilk;
    color: #181818;
    border-radius: 5px;
    border-color: lightgrey;
    border-width: 2px;
    border-style: solid;
    flex-direction: column;
    justify-content: flex-start;
    font-size: x-small;
    display: none;
    bottom: 0px;
    left: 0px;
}

.stats-pad h3 {
    font-size: large;
    margin: 0;
    text-align: center;
    border-bottom: 1px solid grey;
}

.stats-pad-row {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    border-bottom: 1px solid grey;
}

.stats-pad-key {
    text-align: left;
    padding-left: 10px;
}

.stats-pad-value {
    text-align: right;
    padding-right: 10px;
}

.tray {
    position: absolute;
    left: 50%;
    bottom: calc(var(--bill-w) / -2);
    transform: translateX(-50%);
    display: flex;
    width: fit-content;
    flex-direction: row;
    gap: 5px;
    background: #374151;
    padding: 10px;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.tray-slot {
    width: calc(var(--bill-h) + 10px);
    height: calc(var(--bill-w) + 10px);
    border-radius: 8px;
    background: #1f2937;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4);
}

.id-card {
    position: absolute;
    height: 90px;
    width: 180px;
    border-radius: 5px;
    padding: 10px;
    cursor: grab;
    box-shadow: inset 0 0 0 5px #254e70;
    background: linear-gradient(135deg, #f0f8ff 0%, #cce0ff 50%, #99c2ff 100%);
    color: #555a6e;
}

.id-card-header {
    display: block;
    font-size: 12px;
    text-align: center;
    margin-bottom: 5px;
    border-bottom: 1px solid darkgray;
    font-weight: 900;
}

.id-card-body {
    display: flex;
    flex-direction: row;
    gap: 10px;
    height: 50px;
}

.id-card-picture {
    display: block;
    width: 45px;
    height: 45px;
    background-color: grey;
}

.id-card-details {
    display: block;
    text-align: left;
}

.id-card-details span {
    display: block;
}

.id-card-ssn {
    display: block;
    text-align: right;
    border-top: 1px solid darkgray;
}

.receipt-dispenser {
    position: absolute;
    right: 20px;
    top: 20px;
    width: 200px;
    height: 100px;
    background: #f3f3f3;
    border-radius: 2px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: row;
    overflow: hidden;
}

.receipt-dispenser-title {
    background: #999999;
    color: #333;
    padding: 5px;
    font-weight: bold;
    font-size: 9pt;
    text-align: center;
    width: auto;
    padding: 3px;
    box-sizing: border-box;
    writing-mode: vertical-lr;
    rotate: 180deg;
}

.receipt-dispenser-body {
    flex: 1;
    padding: 10px;
    font-size: 0.8em;
    color: #666;
    font-weight: bold;
    overflow-y: auto;
    text-align: center;
    align-self: center;
}

.receipt {
    position: absolute;
    right: 20px;
    top: 20px;
    width: 180px;
    height: 100px;
    background: #fff;
    border: 2px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    padding: 10px;
    box-sizing: border-box;
    font-size: 0.9em;
    color: #333;
    flex-direction: column;
    display: flex;
    justify-content: space-between;
    cursor: grab;
}

.receipt::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('resources/images/bank-watermark.svg') no-repeat center center;
    background-size: 50%;
    opacity: 0.2;
    pointer-events: none;
}

.receipt-label {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    width: 100%;
    cursor: inherit;
}

.receipt-label input {
    flex: 1;
    min-width: 0;
    border-top: none;
    border-left: none;
    border-right: none;
    border-bottom: 1px dotted #ccc;
    cursor: pointer;
}

.receipt-label input:active,
input:focus {
    outline: none;
    box-shadow: none;
    border-color: inherit;
}

.howto-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.32);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.howto-popup[hidden] {
    display: none;
}

.howto-popup-content {
    background: #181818;
    padding: 32px 24px 20px 24px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    min-width: 280px;
    max-width: 90vw;
    position: relative;
    text-align: center;
}

.howto-popup-content p,
ul,
li,
ol,
h3 {
    text-align: left;
}

.howto-popup-content h2 {
    text-align: center;
}

.howto-popup-close {
    position: absolute;
    top: 10px;
    right: 14px;
    background: none;
    border: none;
    font-size: 5em;
    color: #888;
    cursor: pointer;
    transition: color 0.15s;
}

.howto-popup-close:hover {
    color: #222;
}

.howto-popup-play-button {
    background-color: #28a745;
    color: white;
    font-size: 2rem;
    font-weight: bold;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    animation: pulse 1.5s infinite;
    display: inline-block;
    text-align: center;
    width: auto;
}

.howto-popup-play-button:hover {
    background-color: #218838;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

.version-pill {
    margin-left: 10px;
    display: flex;
    padding: 4px 10px;
    border-radius: 999px;
    background-color: #eee;
    color: #333;
    font-size: 0.9rem;
    font-weight: 1000;
    font-family: sans-serif;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    pointer-events: all;
    cursor: pointer;
    transition: scale 0.2s ease;
}

.version-pill:hover {
    scale: 1.25;
}

.lore-popup {
    text-align: justify;
    margin: 0 15vw;
}

#refresh-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    display: none;
    flex-direction: column;
    justify-content: flex-start;
}

#refresh-overlay h5 {
    padding-left: 15%;
    padding-right: 15%;
    text-align: justify;
}

#refresh-button {
    background-color: #28a745;
    color: white;
    font-size: 2rem;
    font-weight: bold;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    animation: pulse 1.5s infinite;
    display: inline-block;
    text-align: center;
    width: auto;
}

#refresh-button:hover {
    background-color: #218838;
}

#stats-toggle {
    position: absolute;
    bottom: 0;
    left: 0;
    background: #fff;
    border: 1px solid #ccc;
    border-top-right-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5em;
    cursor: pointer;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: scale 0.2s, box-shadow 0.2s;
    padding: 0;
    z-index: 1000;
    filter: grayscale(100%);
}