@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600&display=swap');
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body { background: #000; color: #fff; font-family: monospace; display: flex; flex-direction: column; }
#header { padding: 10px 16px; background: #1a1a1a; display: flex; justify-content: space-between; align-items: center; font-family: 'Sora', sans-serif; flex-shrink: 0; }
#header-left { display: flex; align-items: center; }
#header-center { display: flex; gap: 12px; align-items: center; }
#header-right { display: flex; gap: 12px; align-items: center; }
#panelSelector { display: flex; border: 1px solid #444; border-radius: 8px; overflow: hidden; }
#panelSelector button { border: none; border-radius: 0; border-right: 1px solid #333; padding: 8px 14px; }
#panelSelector button:last-child { border-right: none; }
#coordsBox { display: flex; gap: 5px; align-items: center; }
#coordsBox input { background: #222; color: #B45309; border: 1px solid #B45309; padding: 6px 10px; width: 200px; font-family: monospace; font-size: 12px; border-radius: 4px; }
#coordsBox button { background: #B45309; color: #000; border: none; padding: 6px 12px; border-radius: 4px; font-size: 12px; cursor: pointer; }
#coordsBox button:hover { background: #D97706; }
#branding { display: flex; align-items: center; gap: 6px; font-size: 15px; }
#branding .brand-inou { color: #B45309; font-weight: 600; }
#branding .brand-health { color: #888; font-weight: 300; }
#panels { display: flex; flex: 1; overflow: hidden; min-height: 0; }
.panel { flex: 1; min-width: 0; display: flex; flex-direction: column; border-right: 1px solid #333; }
.panel:last-child { border-right: none; }
.panel-header { padding: 5px 10px; background: #2a2a2a; font-size: 12px; display: flex; gap: 6px; align-items: center; }
.panel-header .series-name { color: #B45309; font-weight: 500; }
.panel-header .study-select { max-width: 45%; }
.panel-header .series-select { min-width: 0; }
.panel-content { flex: 1; display: flex; justify-content: center; align-items: center; overflow: hidden; position: relative; min-height: 0; }
.panel-content.zoomed { cursor: grab; }
.panel-content.panning { cursor: grabbing; }
.panel-content img { max-width: 100%; max-height: 100%; }
.thumbnails { height: 110px; background: #111; display: flex; padding: 8px 16px; gap: 10px; align-items: stretch; font-family: 'Sora', sans-serif; }
.wl-presets { display: flex; gap: 8px; flex-shrink: 0; }
.wl-preset { display: flex; flex-direction: column; align-items: center; cursor: pointer; opacity: 0.7; transition: opacity 0.15s; }
.wl-preset:hover { opacity: 1; }
.wl-preset.active { opacity: 1; }
.wl-preset img { height: 70px; width: auto; border: 2px solid transparent; border-radius: 4px; }
.wl-preset.active img { border-color: #B45309; }
.wl-preset span { font-size: 10px; color: #888; margin-top: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.wl-preset.active span { color: #B45309; }
.slice-scrubber { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 0 20px; min-width: 200px; max-width: 500px; }
.scrubber-label { font-size: 11px; color: #666; margin-bottom: 8px; }
.scrubber-track { height: 8px; background: #222; border-radius: 4px; position: relative; cursor: pointer; }
.scrubber-fill { height: 100%; background: linear-gradient(90deg, #F59E0B, #B45309); border-radius: 4px; position: absolute; left: 0; top: 0; pointer-events: none; }
.scrubber-handle { width: 16px; height: 16px; background: #B45309; border-radius: 50%; position: absolute; top: 50%; transform: translate(-50%, -50%); cursor: grab; box-shadow: 0 0 8px rgba(245,158,11,0.5); }
.scrubber-handle:active { cursor: grabbing; }
.scrubber-ticks { display: flex; justify-content: space-between; margin-top: 6px; font-size: 10px; color: #444; }
.thumb { height: 70px; cursor: pointer; opacity: 0.6; }
.thumb:hover { opacity: 0.8; }
.thumb.active { opacity: 1; border: 2px solid #B45309; }
select { 
	background: #1a1a1a; 
	color: #fff; 
	border: 1px solid #333; 
	padding: 8px 32px 8px 12px; 
	border-radius: 8px; 
	font-family: 'Sora', sans-serif; 
	font-size: 13px;
	cursor: pointer;
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 10px center;
	transition: border-color 0.15s, background-color 0.15s;
}
select:hover { background-color: #222; border-color: #444; }
select:focus { outline: none; border-color: #B45309; }
button { 
	background: #1a1a1a; 
	color: #fff; 
	border: 1px solid #333; 
	padding: 8px 16px; 
	border-radius: 8px;
	font-family: 'Sora', sans-serif;
	font-size: 13px;
	cursor: pointer; 
	transition: background-color 0.15s, border-color 0.15s;
}
button:hover { background: #222; border-color: #444; }
button:disabled { background: #111; color: #555; cursor: not-allowed; border-color: #222; }
button:disabled:hover { background: #111; }

.sync-label {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	color: #888;
	cursor: pointer;
}
.sync-label input[type="checkbox"] {
	appearance: none;
	width: 14px;
	height: 14px;
	border: 1px solid #444;
	border-radius: 3px;
	background: #1a1a1a;
	cursor: pointer;
	position: relative;
}
.sync-label input[type="checkbox"]:checked {
	background: #B45309;
	border-color: #B45309;
}
.sync-label input[type="checkbox"]:checked::after {
	content: '';
	position: absolute;
	left: 4px;
	top: 1px;
	width: 4px;
	height: 8px;
	border: solid #000;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}
.sync-label span { white-space: nowrap; }

#coordDisplay {
	position: fixed;
	bottom: 45px;
	right: 20px;
	background: rgba(0,0,0,0.8);
	padding: 5px 12px;
	font-size: 13px;
	color: #B45309;
	border: 1px solid rgba(245,158,11,0.3);
	border-radius: 4px;
	z-index: 1000;
	font-variant-numeric: tabular-nums;
}
#wlHint {
	position: fixed;
	background: rgba(0,0,0,0.9);
	padding: 6px 12px;
	font-size: 12px;
	font-family: 'Sora', sans-serif;
	color: #fff;
	border: 1px solid rgba(255,255,255,0.3);
	border-radius: 6px;
	z-index: 2000;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.15s;
}
#wlHint.show { opacity: 1; }
#debugInfo {
	color: #f88;
	font-size: 11px;
	display: none;
}
.rect-overlay {
	position: absolute;
	border: 2px solid #ff0;
	background: rgba(255, 255, 0, 0.1);
	pointer-events: none;
}
.img-wrapper {
	position: relative;
	display: inline-block;
	transition: transform 0.15s ease-out;
	transform-origin: center center;
}
.crosshair-h, .crosshair-v {
	position: absolute;
	background: rgba(245, 158, 11, 0.7);
	pointer-events: none;
}
.crosshair-h {
	height: 1px;
	left: 0;
	right: 0;
}
.crosshair-v {
	width: 1px;
	top: 0;
	bottom: 0;
}
.panel-label {
	position: absolute;
	top: 5px;
	left: 5px;
	color: #B45309;
	font-size: 14px;
	font-weight: bold;
	text-shadow: 1px 1px 2px #000;
}
#helpBtn {
	background: #222;
	border: 2px solid #B45309;
	color: #B45309;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	font-size: 16px;
	font-weight: bold;
	cursor: pointer;
	margin-left: 20px;
	line-height: 24px;
	text-align: center;
	padding: 0;
}
#helpBtn:hover { background: #B45309; color: #000; }

/* Image info overlay - premium medical display */
.image-overlay {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	pointer-events: none;
	font-family: "Sora", -apple-system, BlinkMacSystemFont, sans-serif;
	z-index: 10;
}

/* Corner info blocks */
.overlay-top-left {
	position: absolute;
	top: 16px;
	left: 16px;
	display: flex;
	flex-direction: column;
	gap: 0;
}
.overlay-top-right {
	position: absolute;
	top: 16px;
	right: 16px;
	text-align: right;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 0;
}
.overlay-bottom-left {
	position: absolute;
	bottom: 16px;
	left: 16px;
	display: flex;
	flex-direction: column;
	gap: 4px;
}
.overlay-bottom-right {
	position: absolute;
	bottom: 16px;
	right: 16px;
	text-align: right;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 6px;
}

/* Patient and study info */
.overlay-patient {
	font-size: 15px;
	font-weight: 500;
	color: rgba(255,255,255,0.95);
	text-shadow: 0 1px 4px rgba(0,0,0,0.9), 0 0 20px rgba(0,0,0,0.6);
	letter-spacing: 0.3px;
	line-height: 20px;
}
.overlay-datetime {
	font-size: 13px;
	color: rgba(255,255,255,0.95);
	text-shadow: 0 1px 4px rgba(0,0,0,0.9);
	line-height: 20px;
}
.overlay-accession {
	font-size: 13px;
	color: rgba(255,255,255,0.5);
	text-shadow: 0 1px 3px rgba(0,0,0,0.8);
	line-height: 20px;
}
.overlay-institution {
	font-size: 13px;
	color: rgba(255,255,255,0.5);
	text-shadow: 0 1px 3px rgba(0,0,0,0.8);
	line-height: 20px;
}
.overlay-study {
	font-size: 11px;
	font-weight: 400;
	color: rgba(255,255,255,0.6);
	text-shadow: 0 1px 3px rgba(0,0,0,0.8);
	line-height: 20px;
}

/* Series name - prominent orange accent */
.overlay-series {
	font-size: 15px;
	font-weight: 600;
	color: #B45309;
	text-shadow: 0 0 12px rgba(245,158,11,0.4), 0 1px 4px rgba(0,0,0,0.9);
	letter-spacing: 0.5px;
	line-height: 20px;
}

/* Slice info */
.overlay-slice {
	font-size: 20px;
	font-weight: 300;
	color: rgba(255,255,255,0.95);
	text-shadow: 0 1px 4px rgba(0,0,0,0.9);
	font-variant-numeric: tabular-nums;
}
.overlay-slice-total {
	font-size: 13px;
	color: rgba(255,255,255,0.5);
}
.overlay-pos {
	font-size: 13px;
	font-weight: 400;
	color: rgba(255,255,255,0.9);
	text-shadow: 0 1px 3px rgba(0,0,0,0.8);
	font-variant-numeric: tabular-nums;
	line-height: 20px;
}
.overlay-thickness {
	font-size: 10px;
	color: rgba(255,255,255,0.4);
	line-height: 20px;
}

/* W/L display - elegant pill design */
.overlay-wl {
	display: flex;
	gap: 12px;
	align-items: center;
	align-self: flex-end;
	background: rgba(0,0,0,0.4);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	padding: 8px 14px;
	border-radius: 20px;
	border: 1px solid rgba(255,255,255,0.2);
}
.overlay-wl-item {
	display: flex;
	align-items: baseline;
	gap: 6px;
}
.overlay-wl-label {
	font-size: 10px;
	font-weight: 500;
	color: rgba(255,255,255,0.4);
	text-transform: uppercase;
	letter-spacing: 1px;
}
.overlay-wl-value {
	font-size: 14px;
	font-weight: 500;
	color: rgba(255,255,255,0.9);
	font-variant-numeric: tabular-nums;
	min-width: 55px;
	text-align: right;
}
.overlay-wl-value.wl-adjusted {
	color: #ffeb3b !important;
	text-shadow: 0 0 8px rgba(255,235,59,0.5);
}
.overlay-wl-divider {
	width: 1px;
	height: 16px;
	background: rgba(255,255,255,0.15);
}

/* Orientation markers - elegant edge labels */
.overlay-orient {
	position: absolute;
	font-size: 20px;
	font-weight: 600;
	color: rgba(245,158,11,0.7);
	text-shadow: 0 0 10px rgba(0,0,0,0.9), 0 0 20px rgba(0,0,0,0.6);
	letter-spacing: 1px;
}
.overlay-orient-top {
	top: 16px;
	left: 50%;
	transform: translateX(-50%);
}
.overlay-orient-bottom {
	bottom: 16px;
	left: 50%;
	transform: translateX(-50%);
}
.overlay-orient-left {
	left: 16px;
	top: 50%;
	transform: translateY(-50%);
}
.overlay-orient-right {
	right: 16px;
	top: 50%;
	transform: translateY(-50%);
}

/* Zoom indicator */
.overlay-zoom {
	font-size: 12px;
	font-weight: 500;
	color: rgba(255,255,255,0.6);
	background: rgba(0,0,0,0.4);
	padding: 4px 10px;
	border-radius: 12px;
	display: none;
}
.overlay-zoom.active {
	display: inline-block;
	color: #B45309;
}
/* Tour overlay */
#tourOverlay {
	display: none;
	position: fixed;
	top: 0; left: 0; right: 0; bottom: 0;
	background: rgba(0,0,0,0.5);
	z-index: 3000;
}
#tourOverlay.show { display: block; }
#tourSpotlight {
	position: absolute;
	border: 3px solid #B45309;
	border-radius: 8px;
	box-shadow: 0 0 0 9999px rgba(0,0,0,0.5), 0 0 20px #B45309;
	pointer-events: none;
	transition: all 0.3s ease;
	z-index: 1;
}
#tourTooltip {
	position: absolute;
	background: #111;
	border: 2px solid #B45309;
	color: #fff;
	padding: 15px 20px;
	max-width: 450px;
	border-radius: 8px;
	font-size: 14px;
	line-height: 1.5;
	z-index: 3001;
	display: block;
}
#tourTooltip h3 { color: #B45309; margin: 0 0 8px 0; font-size: 16px; }
#tourTooltip p { margin: 0 0 12px 0; }
#tourTooltip .tour-nav { display: flex; justify-content: space-between; align-items: center; }
#tourTooltip .tour-nav button {
	background: #B45309; color: #000; border: none; padding: 6px 16px;
	border-radius: 4px; cursor: pointer; font-weight: bold;
}
#tourTooltip .tour-nav button:hover { background: #0aa; }
#tourTooltip .tour-skip { background: transparent !important; color: #888 !important; }
#tourTooltip .tour-step { color: #666; font-size: 12px; }
#tourBtn {
	background: #222; border: 1px solid #555; color: #B45309;
	padding: 5px 10px; cursor: pointer; font-size: 12px;
}
#tourBtn:hover { background: #333; }
#helpModal {
	display: none;
	position: fixed;
	top: 0; left: 0; right: 0; bottom: 0;
	background: rgba(0,0,0,0.8);
	z-index: 2000;
	justify-content: center;
	align-items: center;
}
#helpModal.show { display: flex; }
#helpContent {
	background: #111;
	border: 1px solid #B45309;
	padding: 20px 30px;
	max-width: 400px;
	font-size: 14px;
	line-height: 1.8;
}
#helpContent h2 { color: #B45309; margin: 0 0 15px 0; font-size: 18px; }
#helpContent table { width: 100%; }
#helpContent td { padding: 4px 0; }
#helpContent td:first-child { color: #ff0; width: 140px; }
#helpContent hr { border: none; border-top: 1px solid #333; margin: 12px 0; }


/* Light background overlay adjustments (for X-rays, etc.) */
.panel.light-bg .overlay-patient,
.panel.light-bg .overlay-accession,
.panel.light-bg .overlay-study-desc,
.panel.light-bg .overlay-datetime,
.panel.light-bg .overlay-institution {
	color: rgba(0,0,0,0.7);
	text-shadow: 0 1px 2px rgba(255,255,255,0.8);
}
.panel.light-bg .overlay-series {
	color: #92400E;
	text-shadow: 0 1px 2px rgba(255,255,255,0.8);
}
.panel.light-bg .overlay-slice {
	color: rgba(0,0,0,0.9);
	text-shadow: 0 1px 2px rgba(255,255,255,0.8);
}
.panel.light-bg .overlay-slice-total {
	color: rgba(0,0,0,0.5);
}
.panel.light-bg .overlay-pos,
.panel.light-bg .overlay-thickness {
	color: rgba(0,0,0,0.7);
	text-shadow: 0 1px 2px rgba(255,255,255,0.8);
}
.panel.light-bg .overlay-orient {
	color: rgba(0,0,0,0.7);
	text-shadow: 0 1px 3px rgba(255,255,255,0.9);
}
.panel.light-bg .overlay-wl {
	background: rgba(255,255,255,0.6);
	border-color: rgba(0,0,0,0.2);
}
.panel.light-bg .overlay-wl-label {
	color: rgba(0,0,0,0.5);
}
.panel.light-bg .overlay-wl-value {
	color: rgba(0,0,0,0.9);
}
