:root {
    --blue: #a6efe7;
    --green: #b8f88f;
    --translucent-green: #7abf5fa8;
    --orange: #ffb24c;

    /* --ui-scale: min(1vw, 1vh); Base unit for scaling UI elements */
}

.content-scroll__viewport {
    scrollbar-width: none; /* Firefox */
}

.content-scroll__viewport::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.crt-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 9999;

    background:
        repeating-linear-gradient(
            to bottom,
            rgba(0, 0, 0, 0.08),
            rgba(0, 0, 0, 0.08) 1px,
            transparent 2px,
            transparent 4px
        );

    mix-blend-mode: multiply;
    box-shadow: inset 0 0 120px rgba(0, 0, 0, 0.6);
    opacity: 1;
}

.monitor {
    --ui-scale: calc(1vmin * 0.9);
    
    width: min(100vw, 100vh);
    height: min(100vw, 100vh);

    display: flex;
    justify-content: center;
    align-items: center;

    padding: calc(4 * var(--ui-scale));
    box-sizing: border-box;

    background: linear-gradient(145deg, #8a8a8a, #5f5f5f);
    border-radius: calc(4 * var(--ui-scale));
}

/* wrap screen in a scaler */
.screen-wrapper {
    transform: scale(0.9); /* adjust this */
    transform-origin: center;
}

@font-face {
  font-family: 'IBM BIOS';
  src: url("../fonts/Px437_IBM_BIOS-2y.ttf") format("truetype");
}

html {
    font-size: 1vmin; /* 1% of the smaller viewport dimension, used for overall scaling */
}

html, body {
    margin: 0;
}

body {
    height: 100vh;
    overflow: hidden;
    background: rgb(0, 0, 0);

    display: flex;
    justify-content: center;
    align-items: center;

    transform: perspective(900px) rotateX(0.5deg); /* subtle 3D tilt for CRT effect */
}

.text {
    font-family: sans-serif; /* fallback for now */
}

/* Fixed aspect ratio screen */
.screen {
    position: relative; 
    aspect-ratio: 1 / 1;
    width: 100%;
    height: 100%;

    background: black;
    border-radius: calc(1.5 * var(--ui-scale));
    overflow: hidden;

    position: relative;

    text-shadow: /* subtle red and cyan shadows for chromatic aberration effect */
        1px 0 rgba(255, 0, 0, 0.15),
       -1px 0 rgba(0, 255, 255, 0.15); 

    border-radius: calc(1.5 * var(--ui-scale)); /* rounded corners for monitor frame*/
    overflow: hidden; /* important for clean corners */
}

.title {
    display: flex;
    gap: calc(0.8 * var(--ui-scale)); /* space between boxes */
    padding: calc(1 * var(--ui-scale)); /* space from edges */
}

.title__box {
    display: flex;
    align-items: center;

    margin-top: calc(1 * var(--ui-scale));
    height: calc(10 * var(--ui-scale)); 
}

.title__box--logo {
    width: calc(10 * var(--ui-scale));
    background: var(--blue);

    justify-content: center;
}

.title__box--logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.title__box--page-name {
    width: calc(20 * var(--ui-scale));
    background: var(--blue);
}

.title__text {
    margin-left: calc(0.5 * var(--ui-scale));
    font-size: calc(2 * var(--ui-scale));
    font-family: "Press Start 2P", monospace;
    letter-spacing: calc(0.2 * var(--ui-scale));
}

.title__box--letter-scramble {
    width: calc(72 * var(--ui-scale));
    background: transparent;

    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.letter-scramble__bar {
    height: calc(1 * var(--ui-scale));
    width: 100%;
    background: var(--blue);
}

.letter-scramble__text {
    flex: 1; /* take up remaining space between bars */
    display: flex;
    align-items: center;
    padding: 0 calc(0.5 * var(--ui-scale)); /* horizontal padding */

    font-family: monospace;
    font-size: calc(1.6 * var(--ui-scale));
    line-height: .9; 
    color: var(--green);
}

.options {
    display: flex;
    gap: calc(1 * var(--ui-scale));
    padding: calc(1 * var(--ui-scale));
}

.options__box {
    width: calc(var(--box-width) * var(--ui-scale));   /* important: creates room */
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 calc(1 * var(--ui-scale));
    height: calc(3 * var(--ui-scale));

    border: calc(0.4 * var(--ui-scale)) solid var(--blue);
}

.options__label {
    font-family: "Press Start 2P", monospace;
    font-size: calc(1.5 * var(--ui-scale));
    color: var(--blue);
}

.patient-info {
    gap: calc(1 * var(--ui-scale));
    padding: calc(1 * var(--ui-scale));
}

.patient-info__text-box {
    width: calc(25 * var(--ui-scale));

    display: flex;
    flex-direction: column;

    border-bottom: calc(0.4 * var(--ui-scale)) solid var(--green);
}

.patient-info__header {
    border-bottom: calc(0.4 * var(--ui-scale)) solid var(--green);
    padding-bottom: calc(0.5 * var(--ui-scale));
}

.patient-info__header-text {
    margin-left: calc(2 * var(--ui-scale));

    font-size: calc(1.5 * var(--ui-scale));
    font-family: "Press Start 2P", monospace;
    letter-spacing: calc(0.2 * var(--ui-scale));
    color: var(--green);
}

.patient-info__field-row {
    display: flex;
    gap: calc(1 * var(--ui-scale));
    margin-top: calc(2 * var(--ui-scale));
}

.patient-info__field-label {
    margin-left: calc(2 * var(--ui-scale));
    margin-bottom: calc(1 * var(--ui-scale));
    display: block;
    font-size: calc(1 * var(--ui-scale));
    font-family: "Press Start 2P", monospace;
    color: var(--green);
}

.patient-info__field-value--top-row {
    margin-left: calc(2 * var(--ui-scale));
    display: block;
    font-size: calc(4 * var(--ui-scale));
    font-family: "IBM BIOS", monospace;
    color: var(--green);
}

.patient-info__field-value--bottom-row {
    margin-left: calc(2 * var(--ui-scale));
    display: block;
    font-size: calc(3 * var(--ui-scale));
    font-family: "IBM BIOS", monospace;
    color: var(--green);
}

.content-scroll {
    display: flex;
    gap: calc(1 * var(--ui-scale));
    padding: calc(1 * var(--ui-scale));
}

.content-scroll__viewport {
    margin-top: calc(3 * var(--ui-scale));
    flex: 1;
    display: flex;
    flex-direction: column;

    height: calc(57 * var(--ui-scale)); /* temporary fixed height */
    overflow-y: auto;

    padding-right: calc(1 * var(--ui-scale));
}

.content-scroll__bar {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.scrollbar__cap {
    font-family: monospace;
    color: var(--green);
    font-size: calc(2 * var(--ui-scale));
}

.scrollbar__track {
    position: relative;

    display: flex;
    flex-direction: column;
    align-items: center;

    height: calc(37.6 * var(--ui-scale)); /* IMPORTANT */

    touch-action: none;
}

.scrollbar__fill {
    font-family: "Press Start 2P", monospace;
    font-size: calc(1.5 * var(--ui-scale));
    color: var(--translucent-green);

    writing-mode: vertical-rl;
    text-orientation: upright;
    letter-spacing: calc(0.2 * var(--ui-scale));
}

.scrollbar__thumb {
    position: absolute;

    width: calc(2 * var(--ui-scale));
    height: calc(2 * var(--ui-scale));

    background: var(--green);

    top: 0; /* will be moved with JS later */

    cursor: default;
}

.content-scroll__text--orange-header {
    margin-left: calc(5 * var(--ui-scale));
    margin-bottom: calc(3 * var(--ui-scale));

    font-size: calc(1.5 * var(--ui-scale));
    font-family: "Press Start 2P", monospace;
    letter-spacing: calc(0.2 * var(--ui-scale));
    color: var(--orange);
}

.content-scroll__text--orange-body {
    margin-left: calc(5 * var(--ui-scale));
    margin-bottom: calc(1 * var(--ui-scale));

    font-size: calc(4 * var(--ui-scale));
    font-family: "IBM BIOS", monospace;
    letter-spacing: calc(0.2 * var(--ui-scale));
    color: var(--orange);
}

.content-scroll__text--green-body {
    margin-left: calc(5 * var(--ui-scale));
    margin-bottom: calc(3 * var(--ui-scale));

    font-size: calc(2 * var(--ui-scale));
    font-family: "Press Start 2P", monospace;
    letter-spacing: calc(0.2 * var(--ui-scale));
    color: var(--green);
}