/* ZX Spectrum 48K inspired, highly accessible, professional CSS */
@font-face {
    font-family: 'pyrmont_brewery';
    src: url('pyrmont_brewery.woff2') format('woff2');
    font-display: swap;
}

:root {
    --zx-8x8-character-size: 18px;
    --zx-16x16-character-size: 36px;
}

html {
    font-family: 'pyrmont_brewery', 'DejaVu Sans Mono', monospace;
    font-size: var(--zx-8x8-character-size);
    line-height: 1.5;
    overflow-x: hidden;
    scroll-behavior: auto;
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center center;
}

body {
    background-color: #1a1a1a;
    color: #fff;
    margin-left: 9.7vw;
    margin-top: 0;
    padding: 0;
    font-family: 'pyrmont_brewery', 'DejaVu Sans Mono', monospace;
    font-size: var(--zx-8x8-character-size);
    box-sizing: border-box;
    width: calc(79.6vw);
}

header, nav, main, footer {
    border: 4px solid #fff;
    background: #222;
    box-shadow: none;
    border-radius: 0;
    padding: 8px;
    margin: 8px 0;
}

div {
    margin-bottom: 8px; /* 8px for ZX Spectrum 8x8 pixel spacing */
}

.tvsimulator {
    position: absolute;
    z-index: 1;
    top: 0px;
    bottom: 0px;
    left: 0px;
    right: 0px;
    height: 200000px;
    pointer-events: none;
    background: repeating-linear-gradient(to top, transparent 0px, transparent 1px, rgba(0,0,0,0) 1px, rgba(0,0,0,0.9) 4px);
    background-size: 100% 2px;
    opacity: 0.5;
}

span, p, h1, h2, h3, h4, h5, h6 {
    font-family: 'pyrmont_brewery', 'DejaVu Sans Mono', monospace;
    background: none;
    border-radius: 0;
}

p {
    width: 90%;
    margin: 0 auto 0px auto;
    background: #222;
    color: #fff;
    border: none; /* Remove border for ZX Spectrum authenticity */
    padding: 20px;
    padding-left: 24px;
    opacity: 1;
    border-radius: 0;
}

ul, ol {
    width: 90%;
    margin: 0 auto 2px auto;
    background: #222;
    color: #fff;
    border: none; /* Remove border for ZX Spectrum authenticity */
    padding: 18px 24px; /* Reduce horizontal padding for tighter look */
    border-radius: 0;
    list-style-position: inside;
    font-size: var(--zx-8x8-character-size);
}
ul {
    list-style-type: square;
}
ol {
    list-style-type: decimal;
}
li {
    margin-bottom: 6px;
    padding: 2px 0;
    border-bottom: none; /* Remove grid line for ZX Spectrum authenticity */
    border-radius: 0;
    font-size: var(--zx-8x8-character-size);
}
ul li::marker {
    font-size: var(--zx-16x16-character-size); /* Exactly double for ZX Spectrum style */
    color: #00ffff;
    font-weight: bold;
    content: "■ ";
}

/* ZX Spectrum list spacing */
ul li, ol li {
    margin-top: 2px;
    margin-bottom: 2px;
    padding-top: 0;
    padding-bottom: 0;
}

/* Accessibility: high contrast focus, readable links, alt text for images */
a {
    color: #ff0;
    background: #222;
    border-width: 0 !important;
    border-style: none !important;
    padding: 2px 4px;
    border-radius: 0;
    font-weight: bold;
    text-decoration: none !important;
    display: inline-block;
    vertical-align: baseline;
    line-height: 1.5;
}
a:focus, a:hover {
    animation: zx-flash 1s steps(1, end) infinite;
    outline: 3px solid #0f0;
    color: #fff;
    display: inline-block;
    vertical-align: baseline;
    line-height: 1.5;
}

img {
    border: 5px solid #fff; /* Ensure minimum 5px thickness */
    background: #222;
    border-radius: 0;
    max-width: 100%;
    height: auto;
}

button, input, select, textarea {
    font-family: 'pyrmont_brewery', 'DejaVu Sans Mono', monospace; /* Changed from 'DejaVu Sans Mono' only */
    font-size: var(--zx-8x8-character-size);
    background: #222;
    color: #fff;
    border: 2px solid #fff;
    border-radius: 0;
    padding: 6px 12px;
    margin: 4px 0;
}

select {
    width: 100%;
    min-width: 120px;
    max-width: 400px;
    box-sizing: border-box;
    padding: 6px 12px;
    margin: 4px 0;
}

/* Make number input spinbox arrows visible with ZX Spectrum styling */
input[type="number"] {
    padding-right: 20px; /* Make room for spinners */
    text-align: right;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    opacity: 1;
    height: 20px;
    width: 16px;
    background: #00ff00;
    cursor: pointer;
    border-radius: 0;
    margin: 0;
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
}

/* Firefox spinner support */
input[type="number"] {
    -moz-appearance: textfield;
    position: relative;
}

input[type="number"]::-moz-number-spinner {
    opacity: 1;
    background: #00ff00;
}

::-webkit-scrollbar {
    width: 16px;
    background: #222;
}
::-webkit-scrollbar-thumb {
    background: #fff;
    border-radius: 0;
}

/* Visually hidden for screen readers */
.visually-hidden {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ZX Spectrum border effect */
.spectrum-border {
    border: 8px solid #ff0000;
    box-shadow: 0 0 0 8px #00ff00, 0 0 0 16px #0000ff;
}

h1 {
    font-size: var(--zx-16x16-character-size); /* Changed from 2.5em to exactly double */
    margin-bottom: 20px;
    text-align: center;
    font-family: 'pyrmont_brewery', 'DejaVu Sans Mono', monospace; /* Ensure consistent font */
}

h2 {
    font-size: var(--zx-16x16-character-size); /* Changed from 1.8em to exactly double */
    margin-top: 40px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    font-family: 'pyrmont_brewery', 'DejaVu Sans Mono', monospace; /* Ensure consistent font */
}

h3 {
    color: #00ffff;
    font-size: var(--zx-8x8-character-size); /* Consistent base size */
    margin-top: 30px;
    margin-bottom: 15px;
    font-family: 'pyrmont_brewery', 'DejaVu Sans Mono', monospace; /* Ensure consistent font */
}

h4, h5, h6 {
    font-size: var(--zx-8x8-character-size); /* Consistent base size */
    margin-top: 20px;
    margin-bottom: 10px;
    font-family: 'pyrmont_brewery', 'DejaVu Sans Mono', monospace; /* Ensure consistent font */
}

/* Keyboard navigation help */
.skip-link {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
.skip-link:focus {
    left: 0;
    top: 0;
    width: auto;
    height: auto;
    background: #0f0;
    color: #000;
    z-index: 1000;
    padding: 8px;
    border: 4px solid #000;
}

/* Remove all border-radius and box-shadow for ZX Spectrum authenticity */
* {
    border-radius: 0 !important;
    box-shadow: none !important;
}

/* Remove bounding boxes the ZX Spectrum can't render */
header, nav, main, footer, p, ul, ol, li, a, img, button, input, select, textarea, .spectrum-border {
    border-width: 0 !important;
    border-style: none !important;
}

/* Flashing link effect for ZX Spectrum style - slowed down to match App.css */
a:hover, a:focus {
    animation: zx-flash 1s steps(1, end) infinite;
    outline: 3px solid #0f0;
    color: #fff;
    display: inline-block;
    vertical-align: baseline;
    line-height: 1.5;
}

/* ZX Spectrum video background */
.video-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    object-fit: cover;
    pointer-events: none;
}

@keyframes zx-flash {
    0% { background: #000; color: #fff; }
    50% { background: #0f0; color: #000; }
    100% { background: #000; color: #fff; }
}

@media (prefers-color-scheme: dark) {
    html, body {
        background-color: #303030;
        color: #fff;
    }
}
@media (prefers-color-scheme: light), screen {
    html, body {
        background-color: #dfdfdf;
        color: #000;
    }
}

a, .App-link, .App-link2, .App-link3, .Beer-link, .YourBeer-link {
    display: inline-block;
    vertical-align: baseline;
    line-height: 1.5;
}

a:hover, .App-link:hover, .App-link2:hover, .App-link3:hover, .Beer-link:hover, .YourBeer-link:hover {
    outline: none;
    box-shadow: none;
    border: none;
    vertical-align: baseline;
    line-height: 1.5;
}

.canvas-container {
    position: relative;
    width: 100vw;
    height: 60vh;
    min-height: 400px;
    background: linear-gradient(135deg, #2c2c2c 0%, #1a1a1a 100%);
    border-bottom: 2px solid #333;
}


#kasmHTMLCanvas {
    width: calc(79vw);
    max-width: 2000px;
    height: 150px;
    border: 2px solid #333;
    background: #000;
    display: block;
    margin: 10px 0;
    cursor: pointer;
}

.info-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.8);
    padding: 15px;
    border-radius: 8px;
    font-size: var(--zx-8x8-character-size); /* Changed from 14px to consistent base size */
    max-width: 300px;
    z-index: 10;
    color: white;
    border: 1px solid #333;
    font-family: 'pyrmont_brewery', 'DejaVu Sans Mono', monospace; /* Ensure consistent font */
}

.content-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.main-content {
    max-width: 700px;
    margin: 40px auto;
    padding: 24px;
    background: rgba(40,44,52,0.95);
    border-radius: 12px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.2);
}

/* Table styling for consistent font sizing */
table {
    font-family: 'pyrmont_brewery', 'DejaVu Sans Mono', monospace;
    font-size: var(--zx-8x8-character-size);
    border-collapse: collapse;
    width: 90%;
    margin: 0 auto 8px auto;
    border: none;
    border-radius: 0;
}

thead {
    font-family: 'pyrmont_brewery', 'DejaVu Sans Mono', monospace;
    font-size: var(--zx-8x8-character-size);
}

tbody {
    font-family: 'pyrmont_brewery', 'DejaVu Sans Mono', monospace;
    font-size: var(--zx-8x8-character-size);
}

th, td {
    font-family: 'pyrmont_brewery', 'DejaVu Sans Mono', monospace;
    font-size: var(--zx-8x8-character-size);
    padding: 8px;
    text-align: left;
    border: none;
    border-radius: 0;
    line-height: 1.5;
}

caption {
    font-family: 'pyrmont_brewery', 'DejaVu Sans Mono', monospace;
    font-size: var(--zx-8x8-character-size);
    color: #fff;
    background: #222;
    padding: 8px;
    border-radius: 0;
}

.webmidi-controls {
    margin: 20px 0;
    padding: 200px;
    background: #f9f9f9;
    border-radius: 4px;
}

@media (max-width: 768px) {
    .canvas-container {
        height: 50vh;
        min-height: 300px;
    }

    h1 {
        font-size: var(--zx-16x16-character-size); /* Changed from 2em to consistent double */
    }

    .info-overlay {
        position: relative;
        margin: 20px;
        max-width: none;
    }
}
