/* Brand tokens: Bootstrap variables recoloured to the purple scheme */
:root {
  --bs-primary: #6d28d9;
  --bs-primary-rgb: 109, 40, 217;
  --bs-link-color: #6d28d9;
  --bs-link-hover-color: #5b21b6;
  --bs-focus-ring-color: rgba(109, 40, 217, 0.35);
  --bs-body-font-family: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-border-radius: 1.25rem;
  --bs-border-radius-sm: 1.25rem;
  --bs-border-radius-lg: 1.25rem;
  --bs-border-radius-xl: 1.25rem;
  --bs-border-radius-xxl: 1.25rem;
}
.btn-primary {
  --bs-btn-bg: #6d28d9; --bs-btn-border-color: #6d28d9;
  --bs-btn-hover-bg: #5b21b6; --bs-btn-hover-border-color: #5b21b6;
  --bs-btn-active-bg: #4c1d95; --bs-btn-active-border-color: #4c1d95;
  --bs-btn-disabled-bg: #6d28d9; --bs-btn-disabled-border-color: #6d28d9;
  --bs-btn-focus-shadow-rgb: 109, 40, 217;
}
.btn-outline-primary {
  --bs-btn-color: #6d28d9; --bs-btn-border-color: #6d28d9;
  --bs-btn-hover-bg: #6d28d9; --bs-btn-hover-border-color: #6d28d9;
  --bs-btn-active-bg: #5b21b6; --bs-btn-active-border-color: #5b21b6;
  --bs-btn-disabled-color: #6d28d9; --bs-btn-disabled-border-color: #6d28d9;
  --bs-btn-focus-shadow-rgb: 109, 40, 217;
}
.list-group { --bs-list-group-active-bg: #6d28d9; --bs-list-group-active-border-color: #6d28d9; }
.progress { --bs-progress-bar-bg: #6d28d9; --bs-progress-height: 1rem; }

/* Tiles: neutral at rest, purple border only on hover */
.tile { color: var(--bs-body-color); font: inherit; background: var(--bs-tertiary-bg); border: 3px solid transparent; border-radius: var(--bs-border-radius); transition: border-color 150ms ease, background-color 150ms ease; }
@media (hover: hover) { .tile:hover { border-color: var(--bs-primary); background: rgba(var(--bs-primary-rgb), 0.08); } }
.tile:active { border-color: var(--bs-primary); background: rgba(var(--bs-primary-rgb), 0.08); }
.tile:focus-visible { outline: 3px solid var(--bs-primary); outline-offset: 2px; }
.tile img { border-radius: calc(var(--bs-border-radius) - 3px); }

/* Tablet scale: larger touch targets from the base size up */
@media (min-width: 768px) { html { font-size: 112.5%; } }

/* App shell and touch behaviour (no Bootstrap utility for these) */
body { user-select: none; -webkit-user-select: none; overscroll-behavior: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; }
.app { height: 100vh; height: 100dvh; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.stage, .stage canvas { touch-action: none; }

/* Restart highlight on the end screen */
.lit { animation: ring 1.4s ease-out infinite; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgb(255 193 7 / 0.7); } 100% { box-shadow: 0 0 0 14px rgb(255 193 7 / 0); } }

/* Lost overlay fades in slowly */
#lost.fade { transition: opacity 500ms ease; }

/* Headings use the bold weight of the single font family */
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { font-weight: 700; }

/* Compile screen: syntax colours (no Bootstrap utility for token colours) */
.hack { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; color: #e6edf3; }
.tk-k { color: #d2a8ff; }
.tk-s { color: #a5d6a7; }
.tk-n { color: #ffb86c; }
.tk-c { color: #8b98b3; }
.tk-f { color: #79c0ff; }
.tk-p { color: #8be9fd; }

/* Darker terminal background for the compile screen */
[data-bs-theme="dark"] { --bs-body-bg: #0d1117; --bs-body-bg-rgb: 13, 17, 23; }

/* Header buttons fade in and out when they appear or hide */
.bar-btn { transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, opacity 350ms ease, visibility 350ms; }
.bar-btn.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }

/* Nav bar fades away on the build screen so the code fills the display */
#bar { max-height: 6rem; overflow: hidden; transition: opacity 400ms ease, max-height 400ms ease, padding 400ms ease; }
#bar.nav-away { opacity: 0; max-height: 0; padding-top: 0 !important; padding-bottom: 0 !important; pointer-events: none; }

/* Equal icon column on the end-screen cards */
.icon-slot { width: 3.25rem; }

/* Score and time: semi-transparent glass cards in the top corners */
.glass { min-width: 9rem; background: rgba(30, 12, 60, 0.4); border: 1px solid rgba(255, 255, 255, 0.4); -webkit-backdrop-filter: blur(12px) saturate(1.2); backdrop-filter: blur(12px) saturate(1.2); }
.lite .glass { background: rgba(30, 12, 60, 0.55); -webkit-backdrop-filter: none; backdrop-filter: none; }

/* Thicker build progress bar */
.progress-thick { --bs-progress-height: 2.25rem; }

/* The build bar updates every frame, so it must not animate its width */
.progress-bar.no-transition { transition: none; }
