/* =========================================================================
   Workout Tracker
   Design language: a gym is loud, bright-screen-glare, and used one-handed
   mid-set. Dark surface to cut glare, one hot "effort" accent (molten
   orange-red) for primary actions and stepper emphasis, and mandated
   green strictly reserved for a *completed* set -- so green always means
   "done" and never means anything else in this UI.
   ========================================================================= */

#wt-app {
	--wt-bg:        #0D1013;
	--wt-surface:   #1A1E25;
	--wt-surface-2: #262C35;
	--wt-border:    #3C4552;
	--wt-text:      #FFFFFF;
	--wt-text-muted:#B8C2CE; /* raised from a low-contrast blue-gray for legibility on dark surfaces */
	--wt-accent:    #FF7A50; /* effort / primary action -- lightened from the original for better on-dark contrast */
	--wt-accent-dim:#4A2415;
	--wt-complete:  #3EE686; /* reserved exclusively for "set logged" state */
	--wt-complete-dim: #123822;
	--wt-danger:    #FF6B5E;
	--wt-radius:    14px;
	--wt-radius-lg: 20px;
	--wt-tap-min:   52px;

	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	background: var(--wt-bg);
	color: var(--wt-text);
	border-radius: var(--wt-radius-lg);
	overflow: hidden;
	max-width: 480px;
	margin: 0 auto;
	-webkit-tap-highlight-color: transparent;
	user-select: none;
	box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

#wt-app * {
	box-sizing: border-box;
}

#wt-app button {
	font-family: inherit;
	touch-action: manipulation;
	cursor: pointer;
	border: none;
	color: inherit;
	-webkit-tap-highlight-color: transparent;
}

#wt-app input {
	/* Belt-and-suspenders: even though the app never renders a visible
	   text/number input, force off any accidental keyboard trigger. */
	pointer-events: none;
}

#wt-app .wt-loading,
#wt-app .wt-logged-out {
	padding: 48px 20px;
	text-align: center;
	color: var(--wt-text-muted);
}

/* ---------- Screen shell ---------- */

.wt-screen {
	min-height: 480px;
	display: flex;
	flex-direction: column;
}

.wt-topbar {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 16px 16px 12px;
	background: var(--wt-surface);
	border-bottom: 1px solid var(--wt-border);
	position: sticky;
	top: 0;
	z-index: 5;
}

.wt-topbar .wt-back {
	width: var(--wt-tap-min);
	height: var(--wt-tap-min);
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--wt-surface-2);
	border-radius: 12px;
	font-size: 20px;
	flex-shrink: 0;
}

.wt-topbar .wt-title-block {
	flex: 1;
	min-width: 0;
}

.wt-topbar h1 {
	margin: 0;
	font-size: 18px;
	font-weight: 800;
	letter-spacing: 0.2px;
}

.wt-topbar .wt-subtitle {
	margin: 2px 0 0;
	font-size: 12.5px;
	color: var(--wt-text-muted);
}

.wt-topbar .wt-history-btn {
	width: var(--wt-tap-min);
	height: var(--wt-tap-min);
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--wt-surface-2);
	border-radius: 12px;
	font-size: 18px;
	flex-shrink: 0;
}

.wt-body {
	flex: 1;
	padding: 16px;
	padding-bottom: 100px; /* room for sticky footer button */
	overflow-y: auto;
}

/* ---------- Screen 1: Home / routine cards ---------- */

.wt-home-cards {
	display: flex;
	flex-direction: column;
	gap: 14px;
	margin-top: 4px;
}

.wt-routine-card {
	background: var(--wt-surface);
	border: 1px solid var(--wt-border);
	border-radius: var(--wt-radius-lg);
	padding: 22px 20px;
	text-align: left;
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: 88px;
	position: relative;
	overflow: hidden;
}

.wt-routine-card::before {
	content: "";
	position: absolute;
	left: 0; top: 0; bottom: 0;
	width: 6px;
	background: var(--wt-accent);
}

.wt-routine-card:active {
	background: var(--wt-surface-2);
}

.wt-routine-card .wt-routine-name {
	display: block;
	font-size: 21px;
	font-weight: 800;
	letter-spacing: 0.3px;
	text-transform: uppercase;
}

.wt-routine-card .wt-routine-sub {
	display: block;
	margin-top: 5px;
	font-size: 13px;
	color: var(--wt-text-muted);
}

.wt-routine-card .wt-chevron {
	font-size: 22px;
	color: var(--wt-text-muted);
	margin-left: 10px;
	flex-shrink: 0;
}

/* ---------- Screen 2: Routine overview list ---------- */

.wt-exercise-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	text-align: left;
	background: var(--wt-surface);
	border: 1px solid var(--wt-border);
	border-radius: var(--wt-radius);
	padding: 16px 16px;
	margin-bottom: 10px;
	min-height: var(--wt-tap-min);
}

.wt-exercise-row:active {
	background: var(--wt-surface-2);
}

.wt-exercise-row .wt-exercise-name {
	display: block;
	font-size: 15.5px;
	font-weight: 700;
}

.wt-exercise-row .wt-exercise-meta {
	display: block;
	margin-top: 3px;
	font-size: 12.5px;
	color: var(--wt-text-muted);
}

.wt-status-pill {
	font-size: 12px;
	font-weight: 700;
	padding: 6px 10px;
	border-radius: 999px;
	background: var(--wt-surface-2);
	color: var(--wt-text-muted);
	white-space: nowrap;
	margin-left: 10px;
}

.wt-status-pill.wt-status-complete {
	background: var(--wt-complete-dim);
	color: var(--wt-complete);
}

.wt-footer-cta {
	position: fixed;
	left: 0; right: 0; bottom: 0;
	max-width: 480px;
	margin: 0 auto;
	padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
	background: linear-gradient(180deg, rgba(12,14,17,0) 0%, var(--wt-bg) 30%);
}

.wt-btn-primary {
	width: 100%;
	min-height: 56px;
	background: var(--wt-accent);
	color: #1A0A05;
	font-size: 16px;
	font-weight: 800;
	letter-spacing: 0.4px;
	text-transform: uppercase;
	border-radius: var(--wt-radius);
	box-shadow: 0 6px 18px rgba(255,90,54,0.28);
}

.wt-btn-primary:active {
	filter: brightness(0.92);
}

.wt-btn-primary:disabled {
	background: var(--wt-surface-2);
	color: var(--wt-text-muted);
	box-shadow: none;
}

/* ---------- Screen 3: Touch logger ---------- */

.wt-history-badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: var(--wt-surface-2);
	border: 1px solid var(--wt-border);
	border-radius: 999px;
	padding: 7px 12px;
	font-size: 12.5px;
	color: var(--wt-text-muted);
	margin-bottom: 16px;
}

.wt-history-badge .wt-badge-dot {
	width: 6px; height: 6px;
	border-radius: 50%;
	background: var(--wt-accent);
	flex-shrink: 0;
}

.wt-set-manage-row {
	display: flex;
	gap: 10px;
	margin-bottom: 16px;
}

.wt-btn-outline {
	flex: 1;
	min-height: 48px;
	background: var(--wt-surface);
	border: 1px solid var(--wt-border);
	border-radius: var(--wt-radius);
	font-size: 14px;
	font-weight: 700;
	color: var(--wt-text);
}

.wt-btn-outline:active {
	background: var(--wt-surface-2);
}

.wt-btn-outline.wt-btn-remove {
	color: var(--wt-danger);
	flex: 0 0 auto;
	width: 52px;
}

.wt-set-card {
	background: var(--wt-surface);
	border: 1px solid var(--wt-border);
	border-radius: var(--wt-radius-lg);
	padding: 16px;
	margin-bottom: 14px;
	transition: border-color 0.15s ease, background 0.15s ease;
}

.wt-set-card.wt-set-complete {
	border-color: var(--wt-complete);
	background: linear-gradient(180deg, var(--wt-complete-dim) 0%, var(--wt-surface) 70%);
}

.wt-set-card-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 12px;
}

.wt-set-label {
	font-size: 13px;
	font-weight: 800;
	color: var(--wt-text-muted);
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

/* Weight stepper: [-10] [-2.5] [ 185 lbs ] [+2.5] [+10] */
.wt-stepper-row {
	display: flex;
	align-items: stretch;
	gap: 6px;
	margin-bottom: 10px;
}

.wt-step-btn {
	flex: 0 0 auto;
	min-width: 46px;
	min-height: 46px;
	background: var(--wt-surface-2);
	border-radius: 10px;
	font-size: 13px;
	font-weight: 700;
	color: var(--wt-text);
}

.wt-step-btn:active {
	background: var(--wt-border);
}

.wt-value-display {
	flex: 1;
	min-height: 46px;
	background: var(--wt-bg);
	border: 1px solid var(--wt-border);
	border-radius: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 19px;
	font-weight: 800;
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.3px;
}

.wt-value-display.wt-value-tappable:active {
	background: var(--wt-surface-2);
}

/* Reps quick-select pills */
.wt-pill-row {
	display: flex;
	gap: 6px;
	margin-bottom: 4px;
}

.wt-pill {
	flex: 1;
	min-height: 40px;
	background: var(--wt-surface-2);
	border-radius: 999px;
	font-size: 13.5px;
	font-weight: 700;
	color: var(--wt-text-muted);
}

.wt-pill.wt-pill-active {
	background: var(--wt-accent-dim);
	color: var(--wt-accent);
}

.wt-pill:active {
	background: var(--wt-border);
}

.wt-log-set-btn {
	width: 100%;
	min-height: 50px;
	margin-top: 12px;
	background: var(--wt-surface-2);
	border: 1px solid var(--wt-border);
	border-radius: var(--wt-radius);
	font-size: 14.5px;
	font-weight: 800;
	letter-spacing: 0.4px;
	text-transform: uppercase;
	color: var(--wt-text);
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
}

.wt-log-set-btn .wt-check {
	width: 18px; height: 18px;
	border-radius: 50%;
	border: 2px solid var(--wt-text-muted);
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 11px;
}

.wt-log-set-btn.wt-logged {
	background: var(--wt-complete-dim);
	border-color: var(--wt-complete);
	color: var(--wt-complete);
}

.wt-log-set-btn.wt-logged .wt-check {
	border-color: var(--wt-complete);
	background: var(--wt-complete);
	color: #06210F;
}

/* ---------- Keypad modal ---------- */

.wt-modal-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(4,5,7,0.72);
	display: flex;
	align-items: flex-end;
	z-index: 50;
	max-width: 480px;
	margin: 0 auto;
}

.wt-keypad-sheet {
	width: 100%;
	background: var(--wt-surface);
	border-radius: 22px 22px 0 0;
	padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
	border-top: 1px solid var(--wt-border);
}

.wt-keypad-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 14px;
}

.wt-keypad-header .wt-keypad-title {
	font-size: 13px;
	font-weight: 700;
	color: var(--wt-text-muted);
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.wt-keypad-header .wt-keypad-close {
	width: 36px; height: 36px;
	background: var(--wt-surface-2);
	border-radius: 10px;
	font-size: 16px;
}

.wt-keypad-display {
	text-align: center;
	font-size: 36px;
	font-weight: 800;
	font-variant-numeric: tabular-nums;
	padding: 10px 0 18px;
}

.wt-keypad-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 8px;
}

.wt-keypad-key {
	min-height: 58px;
	background: var(--wt-surface-2);
	border-radius: 12px;
	font-size: 20px;
	font-weight: 700;
}

.wt-keypad-key:active {
	background: var(--wt-border);
}

.wt-keypad-key.wt-keypad-func {
	color: var(--wt-accent);
	font-size: 15px;
}

.wt-keypad-actions {
	margin-top: 12px;
}

/* ---------- History tab / modal ---------- */

.wt-history-panel {
	position: fixed;
	inset: 0;
	background: var(--wt-bg);
	z-index: 40;
	max-width: 480px;
	margin: 0 auto;
	display: flex;
	flex-direction: column;
}

.wt-history-list {
	padding: 16px;
	overflow-y: auto;
	flex: 1;
}

.wt-history-empty {
	text-align: center;
	color: var(--wt-text-muted);
	padding: 60px 20px;
	font-size: 14px;
}

.wt-history-session {
	background: var(--wt-surface);
	border: 1px solid var(--wt-border);
	border-radius: var(--wt-radius-lg);
	padding: 16px;
	margin-bottom: 12px;
}

.wt-history-session-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	margin-bottom: 10px;
}

.wt-history-session-head .wt-history-routine {
	font-size: 15.5px;
	font-weight: 800;
	text-transform: uppercase;
	letter-spacing: 0.3px;
}

.wt-history-session-head .wt-history-date {
	font-size: 12.5px;
	color: var(--wt-text-muted);
}

.wt-history-volume {
	font-size: 12.5px;
	color: var(--wt-accent);
	font-weight: 700;
	margin-bottom: 10px;
}

.wt-history-set-line {
	display: flex;
	justify-content: space-between;
	font-size: 13px;
	color: var(--wt-text-muted);
	padding: 4px 0;
	border-top: 1px solid var(--wt-border);
}

.wt-history-set-line .wt-history-exercise {
	color: var(--wt-text);
	font-weight: 600;
}

/* ---------- Custom login screen (replaces wp-login.php) ---------- */

.wt-login-screen {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 100vh;
	min-height: 100dvh;
	padding: 24px;
}

.wt-login-inner {
	width: 100%;
	max-width: 360px;
}

.wt-login-title {
	text-align: center;
	font-size: 24px;
	font-weight: 800;
	letter-spacing: 0.3px;
	margin: 0 0 28px;
}

.wt-login-error {
	background: var(--wt-complete-dim);
	background: rgba(228, 72, 58, 0.12);
	border: 1px solid var(--wt-danger);
	color: var(--wt-danger);
	border-radius: 10px;
	padding: 10px 14px;
	font-size: 13.5px;
	margin: 0 0 16px;
}

.wt-login-divider {
	display: flex;
	align-items: center;
	text-align: center;
	color: var(--wt-text-muted);
	font-size: 12.5px;
	margin: 4px 0 16px;
}

.wt-login-divider::before,
.wt-login-divider::after {
	content: "";
	flex: 1;
	height: 1px;
	background: var(--wt-border);
}

.wt-login-divider span {
	padding: 0 12px;
}

.wt-login-form {
	display: flex;
	flex-direction: column;
}

.wt-login-label {
	font-size: 12.5px;
	font-weight: 700;
	color: var(--wt-text-muted);
	text-transform: uppercase;
	letter-spacing: 0.4px;
	margin: 12px 0 6px;
}

.wt-login-input {
	min-height: var(--wt-tap-min);
	background: var(--wt-surface);
	border: 1px solid var(--wt-border);
	border-radius: var(--wt-radius);
	padding: 0 14px;
	font-size: 16px; /* 16px avoids iOS Safari auto-zooming on focus */
	color: var(--wt-text);
}

.wt-login-input:focus {
	outline: none;
	border-color: var(--wt-accent);
}

.wt-login-lostpass {
	text-align: center;
	margin-top: 18px;
	font-size: 13px;
}

.wt-login-lostpass a {
	color: var(--wt-text-muted);
	text-decoration: none;
}

/* ---------- Home screen: "enable biometric login" banner ---------- */

.wt-biometric-banner {
	display: flex;
	align-items: center;
	gap: 12px;
	background: var(--wt-surface);
	border: 1px solid var(--wt-accent);
	border-radius: var(--wt-radius);
	padding: 14px;
	margin-bottom: 16px;
}

.wt-biometric-banner .wt-biometric-text {
	flex: 1;
	font-size: 13px;
	color: var(--wt-text-muted);
}

.wt-biometric-banner .wt-biometric-text strong {
	display: block;
	color: var(--wt-text);
	font-size: 14px;
	margin-bottom: 2px;
}

.wt-biometric-banner .wt-biometric-enable {
	flex-shrink: 0;
	background: var(--wt-accent);
	color: #1A0A05;
	font-weight: 800;
	font-size: 12.5px;
	padding: 10px 14px;
	border-radius: 10px;
	white-space: nowrap;
}

.wt-biometric-banner .wt-biometric-dismiss {
	flex-shrink: 0;
	width: 32px;
	height: 32px;
	background: transparent;
	color: var(--wt-text-muted);
	font-size: 18px;
}

/* ---------- Utility ---------- */

.wt-hidden {
	display: none !important;
}

@media (min-width: 481px) {
	#wt-app {
		margin: 20px auto;
	}
}
