/* Compiled from scss/main.scss of DualShock Tools (MIT) */
@keyframes shake {
	0%,100% {
		transform: translateX(0);
	}
	10%,30%,50%,70%,90% {
		transform: translateX(-2px);
	}
	20%,40%,60%,80% {
		transform: translateX(2px);
	}
}

@keyframes pulse {
	0%,100% {
		transform: scale(1);
		opacity: 1;
	}
	50% {
		transform: scale(1.1);
		opacity: 0.8;
	}
}

@keyframes bounce {
	0%,20%,50%,80%,100% {
		transform: translateY(0);
	}
	40% {
		transform: translateY(-3px);
	}
	60% {
		transform: translateY(-2px);
	}
}

@keyframes glow {
	0%,100% {
		text-shadow: 0 0 5px rgba(var(--ds-accent-rgb), 0.5);
	}
	50% {
		text-shadow: 0 0 15px rgba(var(--ds-accent-rgb), 0.8), 0 0 25px rgba(var(--ds-accent-rgb), 0.6);
	}
}

@keyframes blink {
	0%,50% {
		opacity: 1;
	}
	51%,100% {
		opacity: 0.3;
	}
}

@keyframes pulse-text {
	0%,100% {
		opacity: 1;
	}
	50% {
		opacity: 0.5;
	}
}

/* Set text color to red for internationalized elements */
/* .ds-i18n {
  color: red;
} */

body {
	padding-bottom: 80px;
}

dl.row {
	dt {
		font-weight: normal;
	}
	dd {
		font-family: monospace;
	}
}

#left-stick-card {
	cursor: pointer;
	outline: none !important;
}

#right-stick-card {
	cursor: pointer;
	outline: none !important;
}

.stick-card-active {
	border: 1px solid var(--ds-accent-text) !important;
	box-shadow: 0 0 10px rgba(var(--ds-accent-rgb), 0.3) !important;
	.card-header {
		background-color: var(--ds-neon) !important;
		color: var(--ds-ink) !important;
	}
}

.accordion-item {
	&:has(.accordion-collapse.show) {
		i.fas.test-icon-usb {
			animation: pulse 1s ease-in-out infinite !important;
		}
		i.fas.test-icon-buttons {
			animation: bounce 0.6s ease-in-out infinite !important;
		}
		i.fas.test-icon-imu {
			animation: pulse 1s ease-in-out infinite !important;
		}
		i.fas.test-icon-trackpad {
			animation: pulse 1s ease-in-out infinite !important;
		}
		i.fas.test-icon-haptic {
			animation: shake 0.5s ease-in-out infinite !important;
		}
		i.fas.test-icon-adaptive {
			animation: pulse 1s ease-in-out infinite !important;
		}
		i.fas.test-icon-speaker {
			animation: bounce 0.6s ease-in-out infinite !important;
		}
		i.fas.test-icon-microphone {
			animation: glow 1.5s ease-in-out infinite !important;
		}
		i.fas.test-icon-lights {
			animation: glow 1.2s ease-in-out infinite !important;
		}
		i.fas.test-icon-headphone {
			animation: pulse 1s ease-in-out infinite !important;
		}
	}
}

#quickTestAccordion {
	.accordion-button {
		padding: 0.5rem 1rem;
	}
	.accordion-collapse {
		.accordion-body {
			background-color: rgba(var(--ds-accent-rgb), .05);
		}
	}
}

.skip-btn {
	opacity: 0;
	transition: opacity 0.2s ease-in-out;
}

.accordion-header {
	&:hover {
		.skip-btn {
			opacity: 1;
		}
	}
}

.blink-text {
	animation: blink 1s infinite;
}

.pulsing-text {
	animation: pulse-text 0.75s ease-in-out infinite;
}

/* Quick test check badges (IMU, trackpad): bold glyphs, stable pill width */
.test-check {
	font-weight: 900;
	font-size: 0.85em;
	min-width: 1.8em;
}

/* IMU test center-zero bar meters (Bootstrap vars follow data-bs-theme) */
.imu-bar {
	position: relative;
	height: 4px;
	margin-bottom: 4px;
	background: var(--bs-border-color);
	border-radius: 3px;

	&::before {
		/* center (zero) marker */
		content: '';
		position: absolute;
		left: 50%;
		top: -2px;
		bottom: -2px;
		width: 1px;
		background: var(--bs-secondary-color);
	}
}

.imu-bar-fill {
	/* spans the right half; JS sets transform: scaleX(-1..1) around the center */
	position: absolute;
	top: 0;
	bottom: 0;
	left: 50%;
	width: 50%;
	border-radius: 3px;
	transform: scaleX(0);
	transform-origin: left center;
}

/* VR2 button panel: pills light up light blue on capacitive touch and
   dark blue while clicked */
.vr2-btn {
	/* Bootstrap theme variables follow data-bs-theme */
	background-color: var(--bs-secondary-bg);
	color: var(--bs-secondary-color);
	font-size: 0.9rem;
	transition: background-color 0.1s, color 0.1s;

	&.touched {
		background-color: #7ecbff; /* same light blue as the controller SVG body */
		color: #0b3050;
	}

	&.pressed {
		background-color: #1a237e; /* same dark blue as the SVG pressed infill */
		color: #ffffff;
	}
}

/* VR2 raw input report: one cell per byte, recently changed bytes highlighted */
.vr2-raw-cell {
	display: inline-block;
	min-width: 2.6em;
	text-align: center;
	border-radius: 3px;
}

.vr2-raw-hot {
	background-color: var(--bs-warning-bg-subtle);
	color: var(--bs-warning-text-emphasis);
}

/* ---- Xbox panel ---- */
.xbx-trig { display:grid; grid-template-columns: 28px 1fr 44px; gap:8px; align-items:center; font-size:.8rem; margin:3px 0; }
.xbx-trig .progress { height:10px; } .xbx-trig .progress-bar { background: var(--ds-neon); transition:none; }
.xbx-log { max-height:180px; overflow:auto; background: var(--bs-tertiary-bg); border-radius:6px; padding:6px; font-size:.72rem; }
.xbx-log .err { color: var(--bs-danger); } .xbx-log .write { color: var(--bs-warning); font-weight:600; } .xbx-log .info { color: var(--ds-accent-text, var(--bs-success)); }
.xbx-steps li { margin-bottom: .45rem; }
.xbx-cal-plots { display:grid; grid-template-columns: 1fr 1fr; gap:10px; text-align:center; }
.xbx-cal-plots canvas { width:100%; max-width:440px; aspect-ratio:1; display:block; margin:6px auto; }
.xbx-legend { display:flex; gap:12px; justify-content:center; flex-wrap:wrap; color: var(--bs-secondary-color); }
.xbx-legend i { display:inline-block; width:12px; height:3px; vertical-align:middle; margin-right:4px; }
.xbx-ring { display:flex; gap:2px; justify-content:center; margin:2px 0; }
.xbx-ring span { width:10px; height:7px; border-radius:2px; background: var(--bs-secondary-bg); }
.xbx-ring span.on { background: var(--ds-neon); }
#xbox-svg-placeholder svg { max-width: 100%; }
.xbx-pulse { animation: xbxPulse 1.4s ease-in-out infinite; color: var(--ds-ink) !important; }
@keyframes xbxPulse { 50% { box-shadow: 0 0 0 6px rgba(var(--ds-neon-rgb), .35); } }

/* trigger calibration window */
.xbt-step { flex: 1; text-align: center; padding: .35rem .5rem; border-radius: .5rem; border: 1px solid rgba(128,128,128,.35); font-size: .85rem; opacity: .6; }
.xbt-step span { display: inline-block; width: 1.4em; height: 1.4em; line-height: 1.4em; border-radius: 50%; background: rgba(128,128,128,.35); margin-right: .25em; font-weight: 700; }
.xbt-step.active { opacity: 1; border-color: var(--ds-neon, #39FF14); box-shadow: 0 0 0 1px var(--ds-neon, #39FF14) inset; }
.xbt-step.active span, .xbt-step.done span { background: var(--ds-neon, #39FF14); color: #111; }
.xbt-step.done { opacity: .85; }
.xbt-stage { min-height: 100px; padding: .75rem 1rem; border-radius: .75rem; background: rgba(128,128,128,.12); }
.xbt-body { fill: rgba(128,128,128,.35); }
.xbt-trig { fill: none; stroke: var(--ds-neon, #39FF14); stroke-width: 3; }
.xbt-arrow { fill: none; stroke: var(--ds-neon, #39FF14); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; animation: xbtArrow 1.2s ease-in-out infinite; }
.xbt-pullanim { transform-origin: 60px 56px; animation: xbtPull 1.2s ease-in-out infinite; }
.xbt-pullanim .xbt-trig { animation: xbtFill 1.2s ease-in-out infinite; }
@keyframes xbtPull { 0%, 100% { transform: translateY(0) } 45%, 60% { transform: translateY(14px) } }
@keyframes xbtFill { 0%, 100% { fill: transparent } 45%, 60% { fill: rgba(57,255,20,.35) } }
@keyframes xbtArrow { 0%, 100% { transform: translateY(0); opacity: .4 } 50% { transform: translateY(6px); opacity: 1 } }
.xbt-hands { width: 72px; height: 72px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 2rem; flex: none;
  border: 3px solid #ff9d2e; color: #ff9d2e; position: relative; animation: xbtHand 1.4s ease-in-out infinite; }
.xbt-hands::after { content: ''; position: absolute; width: 80%; height: 3px; background: #ff9d2e; transform: rotate(-45deg); border-radius: 2px; }
.xbt-hands.ok { border-color: var(--ds-neon, #39FF14); color: var(--ds-neon, #39FF14); animation: none; }
.xbt-hands.ok::after { display: none; }
@keyframes xbtHand { 0%, 100% { transform: scale(1) } 50% { transform: scale(1.08) } }
.xbt-restbar { background: #ff9d2e !important; transition: width .1s linear; }
.xbt-dot { display: inline-block; width: .8em; height: .8em; border-radius: 50%; margin: 0 .15em; vertical-align: -.05em; background: rgba(128,128,128,.4); transition: background .2s, transform .2s; }
.xbt-dot.on { background: var(--ds-neon, #39FF14); transform: scale(1.15); }
/* trigger calibration bars */
.xbt-row { display: flex; align-items: center; gap: .6rem; margin-bottom: .55rem; font-size: .85rem; }
.xbt-row > b { width: 2.2em; }
.xbt-num { width: 16em; font-size: .8rem; }
.xbt-track { --glow: .25; position: relative; flex: 1; height: 22px; border-radius: 11px; overflow: hidden;
  background: linear-gradient(180deg, rgba(0,0,0,.35), rgba(128,128,128,.18)); box-shadow: inset 0 1px 3px rgba(0,0,0,.5); }
.xbt-seen { position: absolute; top: 0; bottom: 0; background: rgba(57,255,20,.12); border-left: 1px dashed rgba(57,255,20,.45); border-right: 1px dashed rgba(57,255,20,.45); }
.xbt-fill { position: absolute; left: 0; top: 3px; bottom: 3px; border-radius: 8px; width: 0;
  background: linear-gradient(90deg, rgba(57,255,20,.15), var(--ds-neon, #39FF14)),
              repeating-linear-gradient(115deg, rgba(255,255,255,.0) 0 10px, rgba(255,255,255,.22) 10px 16px);
  background-blend-mode: screen; background-size: 100% 100%, 200px 100%;
  animation: xbtShimmer 1.1s linear infinite;
  box-shadow: 0 0 calc(18px * var(--glow)) rgba(57,255,20, var(--glow)); opacity: calc(.55 + var(--glow) * .45); }
@keyframes xbtShimmer { from { background-position: 0 0, 0 0 } to { background-position: 0 0, 200px 0 } }
.xbt-knob { position: absolute; top: 1px; bottom: 1px; width: 6px; margin-left: -3px; border-radius: 3px; background: #fff;
  box-shadow: 0 0 6px #fff, 0 0 14px var(--ds-neon, #39FF14), 0 0 24px var(--ds-neon, #39FF14); }
.xbt-peak { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #ff9d2e; box-shadow: 0 0 8px #ff9d2e; transition: opacity .3s; }
.xbt-row.max .xbt-track { animation: xbtFlash .6s ease-out infinite; }
.xbt-row.max .xbt-knob { background: #ff9d2e; box-shadow: 0 0 8px #ff9d2e, 0 0 20px #ff9d2e; }
@keyframes xbtFlash { 0% { box-shadow: inset 0 1px 3px rgba(0,0,0,.5), 0 0 0 0 rgba(57,255,20,.7) } 100% { box-shadow: inset 0 1px 3px rgba(0,0,0,.5), 0 0 0 8px rgba(57,255,20,0) } }
.xbt-dz { position: absolute; top: 0; bottom: 0; opacity: 0; transition: opacity .3s;
  background: repeating-linear-gradient(45deg, rgba(255,157,46,.35) 0 4px, rgba(255,157,46,.12) 4px 8px); }
.xbt-dzbox { border: 1px solid rgba(128,128,128,.3); border-radius: .6rem; padding: .5rem .75rem; }
.xbt-dzrow + .xbt-dzrow { margin-top: .25rem; }
.xbt-range::-webkit-slider-thumb { background: #ff9d2e; }
.xbt-range::-moz-range-thumb { background: #ff9d2e; }
.xbt-out { color: var(--ds-neon, #39FF14); font-size: 1rem; }

/* ---- Xbox windows: movable + resizable ---- */
.ds-movable .modal-header { cursor: move; user-select: none; }
.ds-movable .modal-content { position: relative; }
.ds-movable.ds-resized .modal-body, #xboxModal .modal-body { overflow: auto; }
.xbx-resize-handle { position: absolute; right: 2px; bottom: 2px; width: 18px; height: 18px; cursor: nwse-resize; z-index: 5; opacity: .6;
  background: linear-gradient(135deg, transparent 50%, var(--ds-neon, #39FF14) 50% 58%, transparent 58% 70%, var(--ds-neon, #39FF14) 70% 78%, transparent 78%); }
.xbx-resize-handle:hover { opacity: 1; }
.ds-movable.xbx-moving .modal-dialog, .ds-movable.xbx-sizing .modal-dialog { transition: none !important; }
.ds-movable.xbx-moving .modal-content { box-shadow: 0 12px 40px rgba(0,0,0,.55), 0 0 0 1px var(--ds-neon, #39FF14); }

/* ---- stick dials ---- */
.xbx-cal-plots > div > b { display: block; font-size: 1rem; letter-spacing: .02em; }
.xbx-dial { filter: drop-shadow(0 4px 14px rgba(0,0,0,.35)); }

/* ---- pills, checklist, notices ---- */
.xbx-pill { display: inline-flex; align-items: center; gap: .3em; padding: .2em .65em; border-radius: 999px; font-size: .78rem; font-weight: 600; line-height: 1.4; margin: 0 .3em .3em 0; border: 1px solid transparent; }
.xbx-pill.good { color: #3ddc84; background: rgba(61,220,132,.12); border-color: rgba(61,220,132,.45); }
.xbx-pill.warn { color: #ffb020; background: rgba(255,176,32,.12); border-color: rgba(255,176,32,.5); }
.xbx-pill.bad  { color: #ff5a5f; background: rgba(255,90,95,.12); border-color: rgba(255,90,95,.5); }
.xbx-chk-sum { margin: .25rem 0 .4rem; }
.xbx-chk { display: grid; gap: 3px; margin-bottom: .6rem; }
.xbx-chk-row { display: flex; gap: .55rem; align-items: flex-start; padding: .32rem .6rem; border-radius: .45rem; font-size: .86rem; line-height: 1.35;
  background: rgba(128,128,128,.08); border-left: 3px solid transparent; color: var(--bs-body-color); }
.xbx-chk-ico { flex: none; width: 1.25em; height: 1.25em; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 800; margin-top: .05em; }
.xbx-chk-row.good { border-left-color: #3ddc84; }
.xbx-chk-row.good .xbx-chk-ico { background: rgba(61,220,132,.18); color: #3ddc84; }
.xbx-chk-row.warn { border-left-color: #ffb020; background: rgba(255,176,32,.08); }
.xbx-chk-row.warn .xbx-chk-ico { background: rgba(255,176,32,.2); color: #ffb020; }
.xbx-chk-row.bad  { border-left-color: #ff5a5f; background: rgba(255,90,95,.09); }
.xbx-chk-row.bad .xbx-chk-ico { background: rgba(255,90,95,.22); color: #ff5a5f; }
.xbx-notice { display: flex; gap: .8rem; align-items: flex-start; padding: .8rem 1rem; border-radius: .65rem; margin-bottom: .6rem; border: 1px solid; border-left-width: 5px; font-size: .9rem; line-height: 1.45; }
.xbx-notice-ico { flex: none; font-size: 1.35rem; line-height: 1; margin-top: .1rem; }
.xbx-notice-title { font-weight: 700; font-size: .98rem; margin-bottom: .15rem; letter-spacing: .01em; }
.xbx-notice.good { border-color: rgba(61,220,132,.5); background: rgba(61,220,132,.08); }
.xbx-notice.good .xbx-notice-ico, .xbx-notice.good .xbx-notice-title { color: #3ddc84; }
.xbx-notice.warn { border-color: rgba(255,176,32,.55); background: rgba(255,176,32,.07); }
.xbx-notice.warn .xbx-notice-ico, .xbx-notice.warn .xbx-notice-title { color: #ffb020; }
.xbx-notice.bad { border-color: rgba(255,90,95,.55); background: rgba(255,90,95,.08); }
.xbx-notice.bad .xbx-notice-ico, .xbx-notice.bad .xbx-notice-title { color: #ff5a5f; }
.xbx-notice-body { color: var(--bs-body-color); }
.xbx-decision label { cursor: pointer; padding: .15rem 0; }
.xbx-dials { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.xbx-dials canvas { width: 100%; max-width: 230px; aspect-ratio: 1; display: block; margin: 4px auto 0; }

/* ---- connect screen ---- */
.cx-title { font-size: 1.15rem; font-weight: 700; margin-bottom: .6rem; }
.cx-title span { font-weight: 400; font-size: .9rem; color: var(--bs-secondary-color); margin-left: .35rem; }
.cx-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .8rem; }
.cx-card { display: flex; flex-direction: column; gap: .45rem; padding: 1rem 1.1rem; border-radius: .8rem;
  border: 1px solid rgba(128,128,128,.3); background: rgba(128,128,128,.06); transition: border-color .2s, box-shadow .2s; }
.cx-card:hover { border-color: var(--ds-neon, #39FF14); box-shadow: 0 0 0 1px var(--ds-neon, #39FF14) inset; }
.cx-head { font-weight: 700; font-size: 1.05rem; display: flex; align-items: center; gap: .5rem; }
.cx-head i { color: var(--ds-neon, #39FF14); }
.cx-sub { font-size: .82rem; color: var(--bs-secondary-color); margin-top: -.25rem; }
.cx-card .btn { margin-top: auto; }
.cx-hint { font-size: .78rem; color: var(--bs-secondary-color); }
.cx-wait { margin-top: auto; display: flex; align-items: center; gap: .6rem; padding: .45rem .75rem; border-radius: .4rem;
  border: 1px dashed var(--ds-neon, #39FF14); color: var(--ds-neon, #39FF14); font-weight: 600; font-size: .92rem; }
.cx-pulse { width: .7rem; height: .7rem; border-radius: 50%; background: var(--ds-neon, #39FF14); flex: none; animation: cxPulse 1.3s ease-out infinite; }
@keyframes cxPulse { 0% { box-shadow: 0 0 0 0 rgba(57,255,20,.7) } 100% { box-shadow: 0 0 0 10px rgba(57,255,20,0) } }
.cx-foot { margin-top: .7rem; font-size: .82rem; color: var(--bs-secondary-color); }
.cx-foot b { color: var(--bs-body-color); }
/* raw strip under the trigger bars (Series / One / SCUF window) */
.xbt-raw { position: relative; height: 8px; margin-top: 4px; border-radius: 4px; background: rgba(128,128,128,.22); overflow: hidden; }
.xbt-raw .xbt-seen { border: 0; background: rgba(57,255,20,.35); }
.xbt-raw .xbt-dz { opacity: 0; }
.xbt-rawknob { position: absolute; top: 0; bottom: 0; width: 3px; margin-left: -1.5px; background: #fff; box-shadow: 0 0 4px #fff; }
