/** 
 * @filename    styles.css
 * @brief       ScillyScope styles
 * @author      Sarah Rosanna Busch
 * @version     1.0
 * @date        30 Nov 2025
 */

:root {
    --bg-color: black;
    --fore-color: grey;
    --accent-color: rgba(0, 255, 128, 0.2);
    --key-width: 60px;
    --spacer-width: 3rem; /* spaces right and left of scope screen */
}

* {
    box-sizing: border-box;
}

html, body {
	height: 100dvh; /* page sizing that behaves better on mobile */
	margin: 0;
}

body {
	font-family: sans-serif;
	min-height: 100dvh;
	background: var(--bg-color);
	color: var(--fore-color);
	display: flex;              
	align-items: center;        
	justify-content: center;    
}

#game {
	display: flex;
	flex-direction: column;
	width: min(100vw, 100vh);
	height: min(100vw, 100vh);
    max-height: 1000px;
	margin-bottom: env(safe-area-inset-bottom);
	overflow: hidden;
}

@media (max-width: 768px) {
    #game {
        height: 60vh;          /* full viewport height */
        max-height: none;       /* remove cap */
    }
}

/* ****************************** layout ****************************** */

.top-row {
	flex: 0.15;
    min-height: 8rem;
	display: flex;
	align-items: center;
    justify-content: center;
}

.middle-row {
	display: flex;
	align-items: center;
	flex: 0.55;
	overflow: hidden;
	width: 100%;
	max-width: calc(var(--key-width) * 16); 
	margin-inline: auto;
    margin-bottom: 1rem;
}

.left-spacer {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
    width: 3rem;
}

.center-space {
	flex: 1;  
	height: 100%;
}

.right-spacer {
	display: flex;
    flex-direction: column;
	align-items: center;
	justify-content: center;
	height: 100%;
    width: 3rem;
}

.bottom-row {
    display: flex;
    flex-direction: column;
	flex: 0.3;
	width: 100%;
	max-width: calc(var(--key-width) * 16); 
    margin: auto;
	align-items: center;
	background: #0b0b0b;
    border-radius: 10px;
}


/* ****************************** scope ****************************** */

#scope-screen {
    width: 100%;
    height: 100%;
	/* CRT tube */
	background: #111;
	border-radius: 32px;
	display: block;
	margin: 0 auto;
	position: relative;
	overflow: hidden;

	/* curved glass effect inside */
	background-image: 
        radial-gradient(ellipse at center, rgba(0, 255, 128, 0.05) 0%, #000 100%),
		radial-gradient(22% 17% at 15% 15%, rgba(255,255,255,0.1), rgba(255,255,255,0.02) 28%, transparent 60%);

	/* bezel edge */
	border: 4px solid #1a1a1a;   /* dark casing */
	outline: 2px solid #000;      /* crisp outer cutline */
	box-shadow:
		0 4px 12px rgba(0,0,0,0.6), /* drop shadow for depth */
		inset 0 0 64px var(--accent-color); /* slight highlight on bezel */
	/* reinforce bezel edge without affecting glow */
	filter: drop-shadow(0 0 8px var(--accent-color));
}

/* glass reflection element (child of #scope-screen) */
.scope-glass-reflection {
	position: absolute;
	top: 6%;
	left: 8%;
	right: 22%;
	height: 36%;
	border-radius: 22px;
	pointer-events: none;
	z-index: 10;

	/* layered reflection: soft band + small bright specular */
	background-image:
		linear-gradient(180deg, rgba(255,255,255,0.28), rgba(255,255,255,0.06)),
		radial-gradient(60% 40% at 18% 18%, rgba(255,255,255,0.65), rgba(255,255,255,0.08) 28%, transparent 60%);
	background-repeat: no-repeat;
	background-size: 100% 100%, 40% 60%;
	background-position: 0 0, 6% 8%;

	/* shape + curvature illusion */
	transform: skewY(-6deg);
	filter: blur(6px);
	opacity: 0.9;
	mix-blend-mode: screen;
}


/* ****************************** volume ****************************** */

#volume-slider {
	-webkit-appearance: none;
	appearance: none;
	writing-mode: vertical-lr;
	direction: rtl;
	flex: 0.8;
	background: transparent;
	accent-color: var(--fore-color);
	cursor: pointer;
}

/* Chrome, Edge, Safari */
#volume-slider::-webkit-slider-runnable-track {
	width: 100%;
	background: #222;              /* dark groove */
	border: 2px solid #444;        /* subtle border */
	border-radius: 6px;            /* rounded slot edges */
	box-shadow: inset 0 2px 4px rgba(0,0,0,0.6); /* recessed look */
}

/* Firefox */
#volume-slider::-moz-range-track {
	height: 100%;
	background: #222;
	border: 2px solid #444;
	border-radius: 6px;
	box-shadow: inset 0 2px 4px rgba(0,0,0,0.6);
}

/* Chrome, Edge, Safari */
#volume-slider::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 28px;
	height: 34px;
	border-radius: 25%; /* slightly rounded rectangle */

	/* metallic base */
	background: #ccc;
	border: 2px solid #666;
	box-shadow: inset -2px -2px 4px #999, inset 2px 2px 4px #fff;

	/* add grooves */
	background-image: 
		repeating-linear-gradient(
			to bottom,
			rgba(0,0,0,0.2) 0px,
			rgba(0,0,0,0.2) 2px,
			transparent 2px,
			transparent 6px
		);
	background-blend-mode: multiply;

	cursor: grab;
	margin: 0;
}

/* Firefox */
#volume-slider::-moz-range-thumb {
	width: 28px;
	height: 32px;
	border-radius: 25%;

	background: #ccc;
	border: 2px solid #666;
	box-shadow: inset -2px -2px 4px #999, inset 2px 2px 4px #fff;

	/* grooves */
	background-image: 
		repeating-linear-gradient(
			to bottom,
			rgba(0,0,0,0.2) 0px,
			rgba(0,0,0,0.2) 2px,
			transparent 2px,
			transparent 6px
		);
	background-blend-mode: multiply;

	cursor: grab;
}


/* ****************************** UI ****************************** */

#haiku {
	display: flex;
    flex-direction: column;
	gap: 0.25rem;
	background: #0b0b0b;
    border-radius: 10px;
	border: 1px solid #000;
    outline: 2px solid #222; 
    padding: 10px;
}

/* each row of word covers */
.word-row {
	display: flex;
	gap: 0.5rem;
}

/* cover buttons */
.word-cover {
	padding: 0.23rem 0.6rem;
    border: none;
	border-bottom: 1px solid #333;
    border-radius: 5px;
	background: #000;
    color: #666;
	cursor: pointer;
	transition: background-color 0.2s, transform 0.2s;
}

.active .word-cover:hover {
    border: none;
	border-bottom: 1px solid #0f0;
    color: #0f0;
}

.word-cover.highlight {
    border: none;
	border-bottom: 1px solid #0f0;
    color: #0f0;
}

.btn {
	background: #111;
	color: #0f0;
	border: 1px solid #2a2a2a;
	padding: 6px 10px;
	font: 14px monospace;
	cursor: pointer;
	border-radius: 4px;
}

.playing {
	outline: 2px solid #2f8;
	outline-offset: 2px;
}

.btn-record.recording {
	background: #600;
	color: #fff;
	box-shadow: 0 0 8px rgba(255, 0, 0, 0.25);
}

#recorded-sequence {
	flex: 1;
	min-width: 160px;
	background: #050505;
	color: #0f0;
	border: 1px solid #2a2a2a;
	padding: 6px 8px;
	font: 13px monospace;
	border-radius: 4px;
}

/* visually hidden helper for accessibility */
.visually-hidden {
	position: absolute !important;
	height: 1px; width: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

#decoder {	/* text input */
    display: flex;
    flex: 0.15;
    width: 100%;
	gap: 8px;
	padding: 8px 12px;
	border-top: 1px solid #222;
    border-radius: 10px;
}


/* ****************************** piano ****************************** */

#keyboard {
    display: flex;
	flex-wrap: nowrap;
    justify-content: center;
	flex: 0.85;
    width: 97%;
	overflow: hidden;
    padding-bottom: 10px;
}

.key-wrapper {
	position: relative;
	flex: 1 1 0%;
	min-width: 0;
    max-width: var(--key-width);
	overflow: visible;
}

.key {
	display: flex;
	align-items:end;
	justify-content: center;
	width: 100%;
	height: 100%;
	background: white;
	border: 1px solid #999;
	box-sizing: border-box;
	cursor: pointer;
	position: relative;
	z-index: 1;
	text-align: center;
	font-size: clamp(12px, 1vw, 18px);
	line-height: normal;
	overflow: hidden;
    padding-bottom: 5px;
    user-select: none;
}

.key.black {
	width: 60%;
	height: 58%;
	background: black;
	position: absolute;
	top: 0;
	right: -25%;
	z-index: 2;
	border: none;
	pointer-events: auto;
    padding-bottom: 5px;
}

/* White keys pressed effect */
.key:active {
    transform: translateY(3px);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.4);
    background: #f0f0f0; /* subtle darker shade */
}

/* Black keys pressed effect */
.key.black:active {
    transform: translateY(2px);
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.2);
    background: #222; /* slightly lighter black */
}

/* optional debug CSS — tweak to taste */
.key.debug-playing {
	background: rgba(47,136,0,0.9) !important;
}