/* =====================================================================
   dusktype — reset, base elements, shared animations
   ===================================================================== */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

/* Uniform scaling: every size is in rem, and 1rem tracks the screen
   (16px at 1920×1080, proportionally bigger or smaller elsewhere),
   times the user's scale setting. Phones keep a plain 16px base. */
html {
  font-size: calc(var(--ui-scale) * clamp(12.8px, min(100vw / 120, 100vh / 67.5), 48px));
  height: 100%;
  background: var(--bg);
  scrollbar-color: var(--sub-alt) var(--bg);
  scrollbar-width: thin;
}
body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(130% 55% at 50% 115%, var(--glow), transparent 70%) fixed, var(--bg);
  color: var(--sub);
  font-family: var(--font);
  font-size: 0.9375rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.no-scroll { overflow: hidden; }

::selection { background: var(--sub-alt); color: var(--text); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--sub-alt); border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--sub); }
::-webkit-scrollbar-corner { background: transparent; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--main); outline-offset: 0.1875rem; border-radius: 0.25rem; }

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
kbd {
  font-family: var(--font);
  font-size: .82em;
  background: var(--sub-alt);
  color: var(--text);
  padding: .08em .45em;
  border-radius: 0.25rem;
}

.icon-btn {
  width: 2.25rem; height: 2.25rem;
  display: grid; place-items: center;
  border-radius: 0.5rem;
  color: var(--sub);
  transition: color var(--t), background-color var(--t);
}
.icon-btn:hover { color: var(--text); }
.icon-btn.on { color: var(--main); }
.icon-btn svg { width: 1.125rem; height: 1.125rem; }

.hint { font-size: .74rem; color: var(--sub); white-space: pre-wrap; text-align: center; }

.view { animation: viewIn 160ms ease-out both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(0.5rem); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 760px) {
  html { font-size: calc(var(--ui-scale) * 16px); }
}

@keyframes dropIn { from { opacity: 0; transform: translateY(-0.5rem); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.7); opacity: 0; } 70% { transform: scale(1.06); } 100% { transform: scale(1); opacity: 1; } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
