/* osu! website palette (dark, hue 333) */
:root {
  --bg: #1c1719;
  --panel: #2a2226;
  --line: #382e33;
  --ink: #ffffff;
  --soft: #ad9ea5;
  --pink: #ff66ab;
  --yellow: #ffdd55;
  --blue: #66ccff;
  --hero-alpha: 0.14;
  --viz-h: clamp(250px, 38vh, 360px);
  --side: 344px;
  --stats-h: 292px;
  color-scheme: dark;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
html { height: 100%; scroll-padding-top: env(safe-area-inset-top, 0px); }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; height: 100%;
  background: var(--bg); color: var(--ink);
  font-family: "Exo 2", "Torus", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
  overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none;
}
.app { position: relative; height: 100%; overflow: hidden; }

/* stats, top left */
.stats { position: absolute; top: 24px; left: 28px; width: min(292px, calc(100% - 56px)); z-index: 3; }
.name { font-size: 1.15rem; font-weight: 600; line-height: 1.3; margin: 0 0 14px; overflow-wrap: anywhere; }
.score-row { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.score { font-size: 2.6rem; font-weight: 600; line-height: 1; color: var(--pink); }
.score-label { color: var(--soft); font-size: .9rem; }
dl { margin: 0; display: grid; grid-template-columns: 1fr auto; row-gap: 6px; column-gap: 20px; font-size: .88rem; }
dt { color: var(--soft); }
dd { margin: 0; text-align: right; font-weight: 500; }
.formula { margin: 14px 0 0; color: var(--soft); font-size: .75rem; line-height: 1.4; }

.pill {
  font: 500 .85rem/1 "Exo 2", system-ui, sans-serif;
  color: var(--pink); background: transparent;
  border: 1px solid var(--pink); border-radius: 999px;
  padding: 9px 16px; cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s;
}
.pill:hover { background: var(--pink); color: var(--bg); }
.pill.solid { background: var(--pink); color: var(--bg); }
.pill.solid:hover { background: var(--ink); border-color: var(--ink); }
.pill.small { padding: 7px 13px; font-size: .8rem; }
.pill:focus-visible, .tab:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Button group and disconnect button */
.btn-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
  width: 100%;
}

.btn-group .pill {
  width: 100%;
  text-align: center;
}

.pill.outline {
  background: transparent;
  color: var(--soft);
  border: 1px solid var(--line);
}

.pill.outline:hover {
  color: var(--ink);
  border-color: var(--soft);
  background: rgba(255, 255, 255, 0.05);
}

.connect-btn {
  font-size: 1rem;
  padding: 12px 20px;
  font-weight: 600;
  box-shadow: 0 0 16px rgba(255, 102, 171, 0.35);
  animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
  0% { box-shadow: 0 0 0 0 rgba(255, 102, 171, 0.6); }
  70% { box-shadow: 0 0 0 10px rgba(255, 102, 171, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 102, 171, 0); }
}

/* hero, centered above the viz (or inside it in fullscreen views) */
.hero {
  position: absolute; left: 0; right: 0; top: 0; bottom: var(--viz-h); z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  pointer-events: none; text-align: center; padding: 0 16px;
}
.app[data-full] .hero { left: var(--side); bottom: 0; }
.big {
  font-size: clamp(5rem, 22vw, 20rem);
  font-weight: 200; letter-spacing: -0.03em; line-height: 1;
  opacity: var(--hero-alpha); white-space: nowrap;
}
.lows { margin-top: 8px; font-size: clamp(.95rem, 2vw, 1.3rem); color: var(--soft); }
.hint { margin-top: 14px; min-height: 1.2em; max-width: 46ch; font-size: .85rem; line-height: 1.4; color: var(--soft); }

/* viz panel */
.viz {
  position: absolute; left: 0; right: 0; bottom: 0; height: var(--viz-h); z-index: 2;
  display: flex; flex-direction: column; border-top: 1px solid var(--line);
}
.app[data-full] .viz { top: 0; height: auto; left: var(--side); border-top: 0; }

.bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 20px; padding: 0 16px; min-height: 48px; flex: none; }
.tabs { display: flex; gap: 2px; }
.tab {
  font: 500 .88rem/1 "Exo 2", system-ui, sans-serif; color: var(--soft);
  background: transparent; border: 0; border-bottom: 2px solid transparent;
  padding: 15px 12px 13px; cursor: pointer; transition: color .15s;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--pink); }
.controls { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.win { display: flex; align-items: center; gap: 10px; font-size: .82rem; color: var(--soft); }
.win input[type=range] { width: 150px; accent-color: var(--pink); margin: 0; cursor: pointer; }
.win output { color: var(--ink); min-width: 3.2em; font-weight: 500; }

.export { position: relative; }
.pop {
  position: absolute; right: 0; top: calc(100% + 8px); width: 272px; z-index: 20;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px;
  display: flex; flex-direction: column; gap: 12px; user-select: text; -webkit-user-select: text;
}
.pop-title { margin: 0; font-weight: 600; font-size: .95rem; }
.pop .row { display: flex; align-items: center; gap: 10px; font-size: .85rem; color: var(--soft); }
.pop input[type=number] {
  width: 74px; background: var(--bg); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 9px; font: 500 .85rem "Exo 2", system-ui, sans-serif;
}
.pop input[type=number]:focus-visible { outline: 2px solid var(--pink); outline-offset: 1px; }
.track { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.fill { height: 100%; width: 0; background: var(--pink); }
.note { margin: 0; font-size: .78rem; line-height: 1.45; color: var(--soft); }

.panes { flex: 1; min-height: 0; display: flex; }
.pane { position: relative; min-width: 0; display: none; }
.pane canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.app[data-view="split"] #paneGraph { display: block; flex: 3; }
.app[data-view="split"] #paneHist { display: block; flex: 2; }
.app[data-view="graph"] #paneGraph { display: block; flex: 1; }
.app[data-view="hist"] #paneHist { display: block; flex: 1; }

/* crosshair overlay: full-app layer, above hero/viz, below stats (z-index 3) */
.crosshair-layer {
  position: absolute; inset: 0; z-index: 2;
  width: 100%; height: 100%;
  display: block;
  pointer-events: none;
}

@media (max-width: 760px) {
  :root { --side: 0px; --viz-h: clamp(300px, 46vh, 420px); }
  .stats { top: 14px; left: 16px; width: calc(100% - 32px); }
  .score { font-size: 2.1rem; }
  .formula { display: none; }
  .hero { top: var(--stats-h); }
  .app[data-full] .hero { top: var(--stats-h); left: 0; }
  .app[data-full] .viz { top: var(--stats-h); left: 0; }
  .app[data-view="split"] .panes { flex-direction: column; }
  .win input[type=range] { width: 110px; }
  .pop { right: auto; left: 0; }
}
