/* ==========================================================================
   Dentist Adventure — styles
   Design language: dental operatory console / practice-management case board.
   Palette:
     --dentist-bg        #0E1A24  (console navy)
     --dentist-panel     #16283A  (panel slate)
     --dentist-panel-2   #1D3348  (raised panel)
     --dentist-line      #2A455E  (hairline)
     --dentist-text      #E8EDF1  (primary text)
     --dentist-muted     #8CA0B3  (secondary text)
     --dentist-teal      #3FBFAD  (nominal / best-practice)
     --dentist-amber     #E8A33D  (caution)
     --dentist-red       #D4534A  (unsafe / violation)
     --dentist-cyan      #5AA9E6  (interactive accent)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

.dentist-adventure-root {
	--dentist-bg: #0E1A24;
	--dentist-panel: #16283A;
	--dentist-panel-2: #1D3348;
	--dentist-line: #2A455E;
	--dentist-text: #E8EDF1;
	--dentist-muted: #8CA0B3;
	--dentist-teal: #3FBFAD;
	--dentist-amber: #E8A33D;
	--dentist-red: #D4534A;
	--dentist-cyan: #5AA9E6;

	--font-display: 'Space Grotesk', 'Segoe UI', sans-serif;
	--font-body: 'IBM Plex Sans', 'Segoe UI', sans-serif;
	--font-mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;

	all: initial;
	*, *::before, *::after { box-sizing: border-box; }

	display: block;
	position: relative;
	font-family: var(--font-body);
	color: var(--dentist-text);
	background: var(--dentist-bg);
	border-radius: 14px;
	overflow: hidden;
	max-width: 720px;
	margin: 2rem auto;
	box-shadow: 0 20px 60px -20px rgba(0,0,0,0.6), 0 0 0 1px var(--dentist-line);
	line-height: 1.5;
}

.dentist-adventure-root h1,
.dentist-adventure-root h2,
.dentist-adventure-root h3 {
	font-family: var(--font-display);
	margin: 0;
	color: var(--dentist-text);
	letter-spacing: 0.01em;
}

.dentist-adventure-root p { margin: 0 0 0.75em; }
.dentist-adventure-root button { font-family: inherit; }

/* ---------- Header / status console ---------- */

.dentist-header {
	background: linear-gradient(180deg, var(--dentist-panel-2), var(--dentist-panel));
	border-bottom: 1px solid var(--dentist-line);
	padding: 1.1rem 1.4rem 0.9rem;
}

.dentist-header-top {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.75rem;
	margin-bottom: 0.6rem;
}

.dentist-eyebrow {
	font-family: var(--font-mono);
	font-size: 0.68rem;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--dentist-cyan);
}

.dentist-title {
	font-size: 1.15rem;
	font-weight: 700;
}

.dentist-restart-btn {
	background: none;
	border: 1px solid var(--dentist-line);
	color: var(--dentist-muted);
	font-family: var(--font-mono);
	font-size: 0.68rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	padding: 0.35rem 0.6rem;
	border-radius: 6px;
	cursor: pointer;
	transition: border-color .15s, color .15s;
}
.dentist-restart-btn:hover { border-color: var(--dentist-cyan); color: var(--dentist-cyan); }
.dentist-restart-btn:disabled { opacity: 0.55; cursor: default; }
.dentist-restart-btn:disabled:hover { border-color: var(--dentist-line); color: var(--dentist-muted); }

.dentist-header-btn-group {
	display: flex;
	gap: 0.5rem;
	flex-wrap: wrap;
	justify-content: flex-end;
}

.dentist-save-note {
	margin-top: 0.55rem;
	font-family: var(--font-mono);
	font-size: 0.7rem;
	color: var(--dentist-teal);
}
.dentist-save-note--error { color: var(--dentist-red); }

/* ---------- Auth prompt modal (guest clicks "Save My Spot") ---------- */

.dentist-modal-overlay {
	position: absolute;
	inset: 0;
	background: rgba(14, 26, 36, 0.82);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1.5rem;
	z-index: 10;
}

.dentist-modal {
	background: var(--dentist-panel);
	border: 1px solid var(--dentist-line);
	border-radius: 12px;
	padding: 1.5rem;
	max-width: 360px;
	width: 100%;
	box-shadow: 0 20px 50px -15px rgba(0,0,0,0.6);
}

.dentist-modal h3 {
	font-size: 1.05rem;
	margin-bottom: 0.5rem;
}

.dentist-modal p {
	color: var(--dentist-muted);
	font-size: 0.88rem;
}

.dentist-modal-actions {
	display: flex;
	gap: 0.6rem;
	flex-wrap: wrap;
	margin: 0.75rem 0 0.5rem;
}

.dentist-modal-actions .dentist-restart-btn {
	text-decoration: none;
	display: inline-block;
}

.dentist-modal-cancel {
	background: none;
	border: none;
	color: var(--dentist-muted);
	font-family: var(--font-mono);
	font-size: 0.72rem;
	text-decoration: underline;
	cursor: pointer;
	padding: 0.25rem 0;
}
.dentist-modal-cancel:hover { color: var(--dentist-text); }

/* waveform strip — the signature element. amplitude/color react to score. */
.dentist-waveform {
	width: 100%;
	height: 34px;
	display: block;
	overflow: visible;
}
.dentist-waveform path {
	fill: none;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
	transition: stroke 0.4s ease;
}

.dentist-stat-row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1.4rem;
	margin-top: 0.7rem;
	font-family: var(--font-mono);
	font-size: 0.72rem;
	color: var(--dentist-muted);
}
.dentist-stat-row strong {
	color: var(--dentist-text);
	font-weight: 600;
}

/* ---------- Case card ---------- */

.dentist-body { padding: 1.5rem 1.4rem 1.7rem; }

.dentist-case {
	background: var(--dentist-panel);
	border: 1px solid var(--dentist-line);
	border-radius: 10px;
	padding: 1.25rem 1.3rem;
	position: relative;
	animation: dentist-fade-up 0.35s ease both;
}

@keyframes dentist-fade-up {
	from { opacity: 0; transform: translateY(6px); }
	to   { opacity: 1; transform: translateY(0); }
}

.dentist-case-meta {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-family: var(--font-mono);
	font-size: 0.68rem;
	color: var(--dentist-muted);
	letter-spacing: 0.05em;
	text-transform: uppercase;
	margin-bottom: 0.7rem;
	padding-bottom: 0.6rem;
	border-bottom: 1px dashed var(--dentist-line);
}

.dentist-case h2 {
	font-size: 1.15rem;
	margin-bottom: 0.55rem;
}

.dentist-case-text {
	color: var(--dentist-text);
	font-size: 0.96rem;
	margin-bottom: 1.1rem;
}

/* ---------- Choices ---------- */

.dentist-choices {
	display: flex;
	flex-direction: column;
	gap: 0.55rem;
}

.dentist-choice-btn {
	display: flex;
	align-items: flex-start;
	gap: 0.65rem;
	text-align: left;
	background: var(--dentist-panel-2);
	border: 1px solid var(--dentist-line);
	color: var(--dentist-text);
	border-radius: 8px;
	padding: 0.7rem 0.85rem;
	cursor: pointer;
	font-size: 0.9rem;
	transition: border-color .15s, background .15s, transform .1s;
}
.dentist-choice-btn:hover {
	border-color: var(--dentist-cyan);
	background: #20364c;
}
.dentist-choice-btn:active { transform: scale(0.99); }

.dentist-choice-tag {
	flex: 0 0 auto;
	font-family: var(--font-mono);
	font-size: 0.68rem;
	font-weight: 600;
	color: var(--dentist-cyan);
	border: 1px solid currentColor;
	border-radius: 4px;
	padding: 0.05rem 0.35rem;
	line-height: 1.4;
}

.dentist-choice-label {
	flex: 1 1 auto;
}

.dentist-choice-time {
	flex: 0 0 auto;
	margin-left: auto;
	font-family: var(--font-mono);
	font-size: 0.68rem;
	color: var(--dentist-muted);
	background: var(--dentist-panel);
	border: 1px solid var(--dentist-line);
	border-radius: 4px;
	padding: 0.05rem 0.4rem;
	white-space: nowrap;
	line-height: 1.4;
}

/* ---------- Outcome / stamp panel ---------- */

.dentist-outcome {
	animation: dentist-fade-up 0.3s ease both;
}

.dentist-stamp {
	display: inline-block;
	font-family: var(--font-mono);
	font-weight: 700;
	font-size: 0.78rem;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	padding: 0.3rem 0.65rem;
	border-radius: 5px;
	border: 2px solid currentColor;
	transform: rotate(-2deg);
	margin-bottom: 0.9rem;
}
.dentist-stamp.best  { color: var(--dentist-teal);  box-shadow: 0 0 0 1px rgba(63,191,173,.15) inset; }
.dentist-stamp.ok    { color: var(--dentist-cyan); }
.dentist-stamp.risky { color: var(--dentist-amber); }
.dentist-stamp.unsafe{ color: var(--dentist-red); }

.dentist-outcome-text {
	font-size: 0.93rem;
	color: var(--dentist-text);
	margin-bottom: 1.1rem;
}

.dentist-continue-btn {
	background: var(--dentist-cyan);
	color: #0E1A24;
	border: none;
	font-family: var(--font-display);
	font-weight: 600;
	font-size: 0.88rem;
	padding: 0.6rem 1.1rem;
	border-radius: 7px;
	cursor: pointer;
	transition: filter .15s;
}
.dentist-continue-btn:hover { filter: brightness(1.08); }

/* ---------- End-of-shift summary ---------- */

.dentist-summary-tier {
	font-family: var(--font-display);
	font-size: 1.3rem;
	font-weight: 700;
	margin-bottom: 0.3rem;
}
.dentist-summary-score {
	font-family: var(--font-mono);
	color: var(--dentist-muted);
	font-size: 0.85rem;
	margin-bottom: 1rem;
}
.dentist-summary-note { font-size: 0.93rem; margin-bottom: 1.1rem; }

.dentist-log-title {
	font-family: var(--font-mono);
	font-size: 0.68rem;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--dentist-muted);
	margin-bottom: 0.5rem;
}

.dentist-log-item {
	display: flex;
	gap: 0.55rem;
	align-items: flex-start;
	font-size: 0.85rem;
	padding: 0.45rem 0;
	border-bottom: 1px solid var(--dentist-line);
}
.dentist-log-item:last-child { border-bottom: none; }
.dentist-log-dot {
	flex: 0 0 auto;
	width: 8px; height: 8px;
	border-radius: 50%;
	margin-top: 0.35rem;
}
.dentist-log-dot.best   { background: var(--dentist-teal); }
.dentist-log-dot.ok     { background: var(--dentist-cyan); }
.dentist-log-dot.risky  { background: var(--dentist-amber); }
.dentist-log-dot.unsafe { background: var(--dentist-red); }

/* ---------- Share & leaderboard (end-of-shift screen) ---------- */

.dentist-share-section,
.dentist-leaderboard-section {
	margin-top: 1.2rem;
	padding-top: 1rem;
	border-top: 1px solid var(--dentist-line);
}

.dentist-leaderboard-standalone {
	margin: 1rem 0 0;
	padding: 1.1rem 1.4rem 1.4rem;
	border-top: none;
	background: var(--dentist-panel);
	border-radius: 12px;
	box-shadow: 0 20px 60px -30px rgba(0,0,0,0.5), 0 0 0 1px var(--dentist-line);
}

.dentist-share-form,
.dentist-share-link-row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	align-items: center;
}

.dentist-share-input {
	flex: 1 1 200px;
	min-width: 0;
	background: var(--dentist-panel-2);
	border: 1px solid var(--dentist-line);
	color: var(--dentist-text);
	border-radius: 6px;
	padding: 0.5rem 0.65rem;
	font-family: var(--font-mono);
	font-size: 0.83rem;
}
.dentist-share-input:focus { outline: 2px solid var(--dentist-cyan); outline-offset: 1px; }

.dentist-share-note {
	font-size: 0.8rem;
	color: var(--dentist-muted);
	margin-top: 0.5rem;
}

.dentist-share-error {
	font-size: 0.8rem;
	color: var(--dentist-red);
	margin-top: 0.5rem;
}

.dentist-leaderboard-list {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.dentist-leaderboard-row {
	display: grid;
	grid-template-columns: 1.6rem 1fr auto auto;
	gap: 0.6rem;
	align-items: center;
	background: var(--dentist-panel-2);
	border: 1px solid var(--dentist-line);
	border-radius: 6px;
	padding: 0.45rem 0.7rem;
	font-size: 0.87rem;
}

.dentist-lb-rank {
	font-family: var(--font-mono);
	color: var(--dentist-cyan);
	font-weight: 600;
}

.dentist-lb-name {
	color: var(--dentist-text);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.dentist-lb-time {
	font-family: var(--font-mono);
	color: var(--dentist-muted);
	font-size: 0.78rem;
	white-space: nowrap;
}

.dentist-lb-score {
	font-family: var(--font-mono);
	color: var(--dentist-teal);
	font-weight: 600;
}

.dentist-leaderboard-row--you {
	border-color: var(--dentist-cyan);
	background: #1c3040;
}

.dentist-lb-you-tag {
	font-family: var(--font-mono);
	font-size: 0.62rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--dentist-cyan);
	border: 1px solid currentColor;
	border-radius: 4px;
	padding: 0.02rem 0.3rem;
	margin-left: 0.4rem;
}

.dentist-leaderboard-yours {
	grid-template-columns: auto 1fr auto auto;
	margin-top: 0.45rem;
}
.dentist-leaderboard-yours .dentist-lb-you-tag { margin-left: 0; }

/* ---------- Urgency cue ---------- */

.dentist-case--urgent {
	border-color: var(--dentist-amber);
	animation: dentist-urgent-pulse 1.8s ease-in-out infinite, dentist-fade-up 0.35s ease both;
}

@keyframes dentist-urgent-pulse {
	0%, 100% { box-shadow: 0 0 0 0 rgba(232, 163, 61, 0.35); }
	50% { box-shadow: 0 0 0 9px rgba(232, 163, 61, 0); }
}

.dentist-urgent-badge {
	display: inline-block;
	color: var(--dentist-amber);
	border: 1px solid var(--dentist-amber);
	border-radius: 4px;
	padding: 0.05rem 0.4rem;
	margin-left: 0.5rem;
	font-size: 0.65rem;
	letter-spacing: 0.05em;
}

/* ---------- Epilogue ---------- */

.dentist-epilogue {
	margin: 0.9rem 0 0.5rem;
	padding: 0.8rem 0.9rem;
	background: var(--dentist-panel-2);
	border-left: 3px solid var(--dentist-cyan);
	border-radius: 6px;
}

.dentist-epilogue-label {
	font-family: var(--font-mono);
	font-size: 0.65rem;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--dentist-cyan);
	margin-bottom: 0.3rem;
}

.dentist-epilogue-text {
	font-size: 0.88rem;
	font-style: italic;
	color: var(--dentist-text);
	margin: 0;
}

/* ---------- Time management ---------- */

.dentist-time-section {
	margin-top: 1.2rem;
	padding-top: 1rem;
	border-top: 1px solid var(--dentist-line);
}

.dentist-time-tier {
	font-family: var(--font-display);
	font-weight: 600;
	font-size: 1rem;
	color: var(--dentist-amber);
	margin-bottom: 0.3rem;
}

/* ---------- Accessibility & responsiveness ---------- */

.dentist-choice-btn:focus-visible,
.dentist-continue-btn:focus-visible,
.dentist-restart-btn:focus-visible {
	outline: 2px solid var(--dentist-cyan);
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.dentist-case, .dentist-outcome, .dentist-case--urgent { animation: none; }
	.dentist-waveform path { transition: none; }
}

@media (max-width: 480px) {
	.dentist-adventure-root { margin: 1rem 0; border-radius: 10px; }
	.dentist-body { padding: 1.1rem 1rem 1.4rem; }
	.dentist-header { padding: 0.9rem 1rem 0.75rem; }
	.dentist-title { font-size: 1rem; }
}
