*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
	--bg:      #1c1c1c;
	--bg2:     #252525;
	--bg3:     #2e2e2e;
	--bg4:     #383838;
	--border:  #3a3a3a;
	--border2: #484848;
	--accent:  #4e9fd4;
	--text:    #d4d4d4;
	--muted:   #6a6a6a;
	--sans:    Helvetica Neue, Helvetica, Arial, sans-serif;
	--mono:    Courier, monospace;
}

body {
	background: var(--bg);
	color: var(--text);
	font-family: var(--sans);
	font-size: 13px;
	font-weight: 400;
	min-height: 100vh;
	padding: 36px 20px 60px;
	-webkit-font-smoothing: antialiased;
}

.container { max-width: 1100px; margin: 0 auto; }

/* Header */
header {
	margin-bottom: 32px;
	border-bottom: 1px solid var(--border);
	padding-bottom: 20px;
}
h1 { font-size: 20px; font-weight: 300; color: #e8e8e8; letter-spacing: 0.01em; }
h1 strong { font-weight: 500; }
.subtitle { margin-top: 6px; font-size: 11px; color: var(--muted); line-height: 1.6; max-width: 640px; }

/* Layout */
.layout {
	display: grid;
	grid-template-columns: 380px 1fr;
	gap: 24px;
}
@media (max-width: 900px) {
	.layout { grid-template-columns: 1fr; }
}

#input, #output { display: flex; flex-direction: column; gap: 16px; }

/* Seamless-grid panel system */
.panel-grid {
	display: grid;
	gap: 2px;
	background: var(--border);
	border: 1px solid var(--border);
	border-radius: 4px;
	overflow: hidden;
}
.panel-grid.cols-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) {
	.panel-grid.cols-2 { grid-template-columns: 1fr; }
}

.panel {
	background: var(--bg2);
	border: 1px solid var(--border);
	border-radius: 4px;
	padding: 18px 20px;
}
.panel-grid .panel { border: none; border-radius: 0; }
.panel-entry { padding-top: 8px; }

.panel-title {
	font-size: 9px;
	font-weight: 600;
	letter-spacing: 0.13em;
	text-transform: uppercase;
	color: var(--muted);
	margin-bottom: 14px;
	padding-bottom: 8px;
	border-bottom: 1px solid var(--border);
}

.colors-section {
	background: var(--bg3);
	border: 2px solid var(--border2);
	border-radius: 3px;
	padding: 10px 14px;
	margin-top: 10px;
}
.colors-section-label {
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--muted);
	margin-bottom: 8px;
}

/* Form fields */
label {
	display: block;
	font-size: 11px;
	color: var(--muted);
	margin-bottom: 5px;
	letter-spacing: 0.01em;
}
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.field-row { display: flex; gap: 14px; }
.field-row .field { flex: 1; }

input[type=text], input[type=number], select {
	width: 100%;
	background: var(--bg3);
	border: 1px solid var(--border2);
	border-radius: 3px;
	color: var(--text);
	font-family: var(--sans);
	font-size: 13px;
	padding: 7px 9px;
	outline: none;
	transition: border-color 0.1s;
	-webkit-appearance: none;
}
input[type=text]:focus, input[type=number]:focus, select:focus { border-color: var(--accent); }
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }

#cube { font-family: var(--mono); }

.checkbox-row {
	display: flex;
	align-items: center;
	gap: 7px;
	font-size: 11px;
	color: var(--muted);
	margin-bottom: 4px;
	cursor: pointer;
}
input[type=checkbox] {
	accent-color: var(--accent);
	width: 14px;
	height: 14px;
	margin: 0;
}

/* Buttons */
button {
	font-family: var(--sans);
	font-size: 11px;
	background: var(--bg3);
	border: 1px solid var(--border2);
	border-radius: 3px;
	color: var(--muted);
	padding: 7px 14px;
	cursor: pointer;
	letter-spacing: 0.02em;
	transition: all 0.1s;
}
button:hover { border-color: var(--accent); color: var(--accent); }
button:disabled {
	opacity: 0.4;
	cursor: not-allowed;
	border-color: var(--border2);
	color: var(--muted);
}
button:disabled:hover { border-color: var(--border2); color: var(--muted); }

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* Loading screen (lookup table generation) */
#loadingOverlay {
	position: fixed;
	inset: 0;
	background: var(--bg);
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
}
#loadingOverlay.hidden { display: none; }
.loading-box { width: min(420px, 90vw); text-align: center; }
.loading-title {
	font-size: 20px;
	font-weight: 300;
	color: #e8e8e8;
	letter-spacing: 0.01em;
}
.loading-title strong { font-weight: 500; }
.loading-box .subtitle { margin-top: 6px; margin-bottom: 20px; max-width: none; }
.loading-box progress { margin-bottom: 12px; }
.loading-box #details { text-align: left; }

progress {
	-webkit-appearance: none;
	appearance: none;
	width: 100%;
	height: 6px;
	border: none;
	border-radius: 3px;
	margin-bottom: 10px;
}
progress::-webkit-progress-bar { background: var(--bg4); border-radius: 3px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 3px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 3px; }

#details {
	list-style: none;
	max-height: 160px;
	overflow-y: auto;
	background: #141414;
	border: 1px solid var(--border);
	border-radius: 3px;
	padding: 8px 12px;
	font-size: 10px;
	color: var(--muted);
	line-height: 1.6;
}

/* Colors panel */
.color-row {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 6px;
}
.colorLabel {
	width: 60px;
	flex-shrink: 0;
	font-size: 11px;
	color: var(--muted);
	margin-bottom: 0;
}
.colorInput {
	width: 28px;
	height: 28px;
	padding: 0;
	border: 1px solid var(--border2);
	border-radius: 3px;
	background: var(--bg3);
	cursor: pointer;
}
#resetColors { margin-top: 4px; }

/* Solution move list */
#solution {
	font-family: var(--mono);
	font-size: 12px;
	color: var(--muted);
	margin-bottom: 14px;
	line-height: 2;
}
.move {
	display: inline-block;
	background: var(--bg3);
	border: 1px solid var(--border2);
	border-radius: 3px;
	padding: 4px 9px;
	margin: 0 4px 4px 0;
	color: var(--text);
	font-family: var(--mono);
	font-size: 12px;
}
.move.current {
	border-color: var(--accent);
	background: var(--bg4);
	color: var(--accent);
}

/* Playback transport */
#controlDiv {
	display: flex;
	background: var(--border);
	gap: 2px;
	border: 1px solid var(--border);
	border-radius: 3px;
	overflow: hidden;
}
#controlDiv button {
	flex: 1;
	background: var(--bg3);
	border: none;
	border-radius: 0;
	padding: 8px 0;
	font-family: var(--mono);
}
#controlDiv button:hover { background: var(--bg4); color: var(--accent); border-color: transparent; }
#controlDiv button:disabled { background: var(--bg3); }

/* 3D preview stage */
#animationDiv {
	background: #1d1d1d;
	border: 1px solid var(--border);
	border-radius: 3px;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 420px;
}

/* Facelet entry net -- layout mechanism (float/skew/translate) is left byte-for-byte
   unchanged from the original; only colors/borders below are new. */
#entry {
	height: 300px;
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	/*
	background: #141414;
	border: 1px solid var(--border);
	border-radius: 3px;
	padding: 4px 16px 16px;
	*/
}
#cubeNet {
	display: inline-block;
}
.facelet {
	width: 30px;
	height: 30px;
	display: block;
	float: left;
	border: 1px solid var(--border);
	background: var(--bg3);
	cursor: url(../images/bucket.cur) 12 23, pointer;
}
.facelet.right { clear: left; }
.facelet.center {
	cursor: url(../images/eyedropper.cur) 7 27, pointer;
	position: relative;
}
.facelet.center::after {
	content: "";
	position: absolute;
	inset: 8px;
	border: 1px solid rgba(0, 0, 0, 0.35);
	pointer-events: none;
}
#currentColor {
	display: inline-block;
	position: absolute;
	top: 12px;
	right: 12px;
	width: 44px;
	height: 44px;
	border: 1px solid var(--border2);
	border-radius: 3px;
	cursor: url(../images/Eraser.png) 13 22, pointer;
}
.side {
	display: block;
	float: left;
}
#U {
	-webkit-transform: skewX(-45deg) translateX(50%) translateY(16.5%) scaleY(.6666);
	-moz-transform: skewX(-45deg) translateX(50%) translateY(16.5%) scaleY(.6666);
	-o-transform: skewX(-45deg) translateX(50%) translateY(16.5%) scaleY(.6666);
}
#R {
	-webkit-transform: skewY(-45deg) translateY(-50%) translateX(-16.6%) scaleX(.6666);
	-moz-transform: skewY(-45deg) translateY(-50%) translateX(-16.6%) scaleX(.6666);
	-o-transform: skewY(-45deg) translateY(-50%) translateX(-16.6%) scaleX(.6666);
}
#B {
	-webkit-transform: translateX(-33.3333%) translateY(-66.6666%);
	-moz-transform: translateX(-33.3333%) translateY(-66.6666%);
	-o-transform: translateX(-33.3333%) translateY(-66.6666%);
}
#U, #D {
	position: relative;
	left: 90px;
	clear: left;
}
#L { clear: left; }

/* Footer */
footer {
	margin-top: 28px;
	text-align: center;
	font-size: 10px;
	color: #4a4a4a;
	letter-spacing: 0.06em;
}
a {
	color: #727272;
	text-decoration: none;
}
a:hover{
	text-decoration: underline;
}