:root {
      --bg-start: #3a3a3a;
      --bg-end:   #1f1f1f;
      --card-bg:  rgba(255, 255, 255, 0.04);
      --text:     #f3f3f3;
      --muted:    #bdbdbd;
      --accent:   #e0e0e0;
      --border:   rgba(255,255,255,0.12);
      --ok:       #8fdaa1;
      --warn:     #ffd580;
      --err:      #ff9a9a;
    }

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  font-family: system-ui, sans-serif;
  background: linear-gradient(180deg, var(--bg-start), var(--bg-end));
  background: no-repeat url("images/bunpaper_1440p.png");
  background-size: cover;
  color: var(--text);
  position: relative;
  padding-bottom: 75px; /* avoid overlap with footer */
  scroll: hidden;
}

/* Dim toggle */
.dim-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  z-index: 0;
  transition: opacity 3s ease;
}
body.dimmed .dim-overlay { opacity: 0.9; }

.page { min-height: 100%; display: flex; flex-direction: column; position: relative; z-index: 1; }

header { padding: 24px 16px 8px; }
.title-row {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(10px);
  border: 1px solid #333;
  padding: 8px 20px;
  border-radius: 100vh;
}
h1 { margin: 0; font-size: clamp(1.25rem, 1rem + 1.5vw, 2rem); color: var(--text); text-shadow: 0 0 20px gray; }

.controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn {
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--accent);
  padding: 10px 14px;
  border-radius: 100vh;
  cursor: pointer;
  transition: transform 120ms ease, background 160ms ease, border-color 160ms ease;
  font-weight: 600;
}
.btn:hover { transform: translateY(-1px); }

.status {
  font-size: 13px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.35);
  padding: 6px 10px;
  border-radius: 999px;
  line-height: 1;
  opacity: .9;
}
.status.ok { color: var(--ok); }
.status.warn { color: var(--warn); }
.status.err { color: var(--err); }

main {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 16px;
  transition: padding 200ms ease;
  scroll: hidden;
}
main.expanded { padding: 0 4%;  scroll: hidden;}

.player-card {
  width: min(92vw, 1100px);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  backdrop-filter: blur(6px);
  overflow: hidden;
  transition: width 2s ease, border-radius 2s ease, border-color 2s ease;
}
.player-card.expanded { width: 85%; border-radius: 6px; border-color: #222; }

.player-aspect { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; }
.player-aspect video {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
  object-fit: contain; background: #000;
}

.msg { position: fixed; top: 95px; left: 50%; transform: translateX(-50%); opacity: .8; font-size: 12px; text-align: center; }

.fidget-box {
position: absolute;
width: 200px;
height: 200px;
background-size: contain;
background-position: center;
background-repeat: no-repeat;
pointer-events: auto;             /* clickable */
will-change: transform;
touch-action: none;               /* smoother touch dragging */
}

/* VERIFICATION SECTION */

#crankAttachment {
	position: fixed;
	top: calc(50% + 50px);
	left: 50%;
	transform: translateX(-50%);
	width: 20px;
	height: 180px;
	background: #555;
	z-index: 1;
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

#crankContainer {
	position: fixed;
	top: calc(50% + 180px);
	left: 50%;
	transform: translateX(-50%);
	width: 150px;
	height: 150px;
	z-index: 2;
}

#crank {
	width: 150px;
	height: 150px;
	border: 5px solid #555;
	border-radius: 50%;
	position: relative;
	background: #ddd;
	display: flex;
	justify-content: center;
	align-items: center;
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

#handle {
	width: 20px;
	height: 100px;
	background: #ab7d11;
	position: absolute;
	top: calc(50% - 100px);
	left: calc(50% - 10px);
	transform-origin: bottom center;
	cursor: grab;
	border-radius: 10px;
}

#handleEnd {
	width: 30px;
	height: 30px;
	background: #000;
	border-radius: 50%;
	position: absolute;
	top: -15px;
	left: calc(50% - 15px);
}

#knob {
	width: 20px;
	height: 20px;
	background: #ab7d11;
	border-radius: 50%;
	position: absolute;
	top: -10px;
	left: calc(50% - 10px);
}

#progressContainer {
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 60%;
	background: #ccc;
	padding: 20px;
	border-radius: 10px;
	text-align: center;
	z-index: 3;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

#progressBar {
	width: 100%;
	height: 30px;
	background: #333;
	border-radius: 15px;
	overflow: hidden;
	margin-bottom: 10px;
	box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

#progressFill {
	width: 0;
	height: 100%;
	background: #ab7d11;
}

#tooltip {
	font-size: 1.2em;
	color: #111;
}

#captchaComplete {
	display: none;
	margin-top: 20px;
	font-size: 1.5em;
	color: green;
}

#continueButton {
	display: none;
	margin-top: 20px;
	padding: 10px 20px;
	font-size: 1em;
	background: #4caf50;
	color: #fff;
	border: none;
	border-radius: 5px;
	cursor: pointer;
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

#continueButton:hover {
	background: #45a049;
}