:root {
  --bg: #eef4f8;
  --panel-soft: rgba(255, 255, 255, 0.72);
  --text: #1c3551;
  --muted: #60758d;
  --gold: #f3c038;
  --gold-deep: #d89a0f;
  --blue: #5766a9;
  --blue-deep: #39457e;
  --blue-soft: #9ca9ea;
  --success: #87baa5;
  --shadow: 0 28px 70px rgba(32, 67, 96, 0.18);
  --radius-xl: 34px;
  --radius-lg: 26px;
  --radius-pill: 999px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Candara, Tahoma, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 241, 194, 0.72), transparent 28%),
    radial-gradient(circle at top right, rgba(144, 192, 229, 0.72), transparent 34%),
    linear-gradient(180deg, #f7fbfd 0%, #e6f2f8 100%);
}

button,
select,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.layout {
  width: min(1360px, calc(100% - 1.4rem));
  margin: 0 auto;
  padding: 1rem 0 1.8rem;
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  gap: 1.2rem;
}

.panel {
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.68);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.sidebar {
  padding: 1.4rem;
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.96), rgba(251, 247, 240, 0.92));
}

.stage {
  padding: 1.2rem;
  background: linear-gradient(180deg, rgba(204, 234, 249, 0.9), rgba(188, 225, 242, 0.88));
}

.soft-card {
  background: var(--panel-soft);
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.eyebrow,
.section-label {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

h1,
h2 {
  margin: 0;
  font-family: "Palatino Linotype", "Book Antiqua", Georgia, serif;
  line-height: 1.05;
}

h1 {
  font-size: clamp(2.25rem, 4.8vw, 4.4rem);
  max-width: 11ch;
}

.lead {
  margin: 1rem 0 1.2rem;
  max-width: 54ch;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.72;
}

.progress-card,
.prayer-card,
.controls-card,
.status-card {
  padding: 1.15rem;
}

.progress-card {
  margin-bottom: 1rem;
}

.progress-card__top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-weight: 600;
}

.progress-bar {
  position: relative;
  height: 0.8rem;
  margin-top: 0.85rem;
  border-radius: var(--radius-pill);
  background: rgba(87, 102, 169, 0.14);
  overflow: hidden;
}

.progress-bar span {
  display: block;
  width: 2%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold) 0%, var(--gold-deep) 100%);
  box-shadow: 0 6px 18px rgba(216, 154, 15, 0.34);
  transition: width 220ms ease;
}

.prayer-card {
  display: grid;
  gap: 0.85rem;
}

.prayer-card__head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
}

.step-chip,
.mystery-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius-pill);
  background: rgba(255, 247, 220, 0.92);
  color: #815103;
  border: 1px solid rgba(216, 154, 15, 0.18);
}

.step-chip {
  background: rgba(87, 102, 169, 0.1);
  color: var(--blue-deep);
  border-color: rgba(57, 69, 126, 0.08);
  font-weight: 700;
}

.instruction,
.after-note,
.status-card p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.prayer-text {
  display: grid;
  gap: 0.8rem;
  padding: 1rem 1.05rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(28, 53, 81, 0.08);
}

.prayer-text p {
  margin: 0;
  line-height: 1.72;
}

.controls-card {
  margin-top: 1rem;
}

.button-row {
  display: grid;
  gap: 0.7rem;
}

.button {
  border: none;
  border-radius: var(--radius-pill);
  padding: 0.9rem 1.15rem;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.button:hover:not(:disabled),
.button:focus-visible:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 24px rgba(32, 67, 96, 0.14);
}

.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.button--primary {
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-deep) 100%);
  color: #fffdf8;
}

.button--secondary {
  background: rgba(87, 102, 169, 0.1);
  color: var(--blue-deep);
}

.button--ghost {
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
  border: 1px solid rgba(28, 53, 81, 0.08);
}

.field-grid {
  display: grid;
  gap: 0.9rem;
  margin-top: 1rem;
}

.field {
  display: grid;
  gap: 0.45rem;
}

.field span {
  font-size: 0.92rem;
  font-weight: 700;
}

.field select {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 16px;
  border: 1px solid rgba(28, 53, 81, 0.1);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
}

.toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.78rem 0.95rem;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(28, 53, 81, 0.08);
}

.toggle input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--gold-deep);
}

.status-card {
  margin-top: 1rem;
}

.stage__head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1rem;
}

.stage__head h2 {
  font-size: clamp(1.8rem, 3vw, 2.6rem);
}

.stage__hint {
  margin: 0;
  padding: 0.65rem 0.95rem;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.62);
  color: var(--blue-deep);
  font-weight: 700;
}

.rosary-viewport {
  position: relative;
  width: min(100%, 920px);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border-radius: 30px;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 255, 255, 0.88), transparent 28%),
    radial-gradient(circle at 80% 22%, rgba(255, 247, 203, 0.54), transparent 18%),
    linear-gradient(180deg, #b6dff2 0%, #9fcee5 100%);
  border: 1px solid rgba(255, 255, 255, 0.48);
  perspective: 1400px;
  touch-action: none;
  cursor: grab;
}

.rosary-viewport.is-dragging {
  cursor: grabbing;
}

.rosary-viewport::after {
  content: "";
  position: absolute;
  inset: auto 8% 3% 8%;
  height: 16%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(67, 102, 131, 0.18), transparent 66%);
  filter: blur(16px);
}

.rosary-scene {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 140ms ease-out;
}

.rosary-strings,
.tag-layer,
.bead-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.rosary-strings {
  overflow: visible;
  transform: translateZ(-32px);
}

#stringPathGlow {
  fill: none;
  stroke: rgba(255, 255, 255, 0.2);
  stroke-width: 14;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#stringPath {
  fill: none;
  stroke: #94a3b8; /* Zilvergrijs in plaats van blauw */
  stroke-width: 6; /* Iets dunner zodat het op draad lijkt */
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 8px 12px rgba(15, 23, 42, 0.25));
}

.medal,
.bead,
.mystery-tag {
  position: absolute;
  left: calc(var(--x) / 760 * 100%);
  top: calc(var(--y) / 760 * 100%);
}

.medal {
  width: 52px;
  height: 52px;
  transform: translate(-50%, -50%) translateZ(calc(var(--z) * 1px));
  border-radius: 50%;
  /* Zilver/metalen gradiënt */
  background: radial-gradient(circle at 30% 28%, #f8fafc 0%, #cbd5e1 40%, #64748b 80%, #334155 100%);
  box-shadow:
    inset 0 3px 8px rgba(255, 255, 255, 0.7),
    inset 0 -8px 12px rgba(15, 23, 42, 0.4),
    0 18px 30px rgba(52, 84, 111, 0.25);
}

.medal::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
}

.bead-layer {
  transform-style: preserve-3d;
}

.bead {
  display: grid;
  place-items: center;
  border: none;
  cursor: pointer;
  transform: translate(-50%, -50%) translateZ(calc(var(--z) * 1px)) scale(var(--scale));
  transition: transform 170ms ease, box-shadow 170ms ease, opacity 170ms ease, filter 170ms ease;
}

.bead:hover:not(:disabled),
.bead:focus-visible:not(:disabled) {
  transform: translate(-50%, -50%) translateZ(calc((var(--z) + 10) * 1px)) scale(calc(var(--scale) + 0.05));
}

.bead--small,
.bead--large {
  border-radius: 50%;
}

.bead--small {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  /* Glimmend zwarte bol */
  background: radial-gradient(circle at 35% 25%, #64748b 0%, #1e293b 25%, #020617 60%, #000000 100%);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 
    inset -4px -4px 8px rgba(0, 0, 0, 0.9), 
    inset 3px 3px 6px rgba(148, 163, 184, 0.5), 
    0 12px 20px rgba(32, 67, 96, 0.3);
}


.bead--large {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  /* Iets lichter staal-zwart zodat ze opvallen */
  background: radial-gradient(circle at 35% 25%, #94a3b8 0%, #334155 30%, #0f172a 65%, #000000 100%);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 
    inset -5px -5px 12px rgba(0, 0, 0, 0.9), 
    inset 3px 3px 8px rgba(226, 232, 240, 0.6), 
    0 14px 24px rgba(32, 67, 96, 0.35);
}


.bead--cross {
  width: 90px;
  height: 140px;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.cross-shape {
  position: relative;
  display: block;
  width: 20px;
  height: 72px;
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #dfe5ec 28%, #9aa5b1 100%);
  box-shadow:
    inset 0 2px 8px rgba(255, 255, 255, 0.46),
    inset 0 -8px 12px rgba(61, 73, 86, 0.2),
    0 18px 30px rgba(63, 80, 98, 0.18);
}


.cross-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 15px 25px rgba(32, 67, 96, 0.4));
  transition: filter 170ms ease, transform 170ms ease;
}

.cross-shape::before {
  content: "";
  position: absolute;
  top: 16px;
  left: -18px;
  width: 56px;
  height: 18px;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #dfe5ec 28%, #9aa5b1 100%);
  box-shadow: inset 0 2px 8px rgba(255, 255, 255, 0.46), inset 0 -8px 12px rgba(61, 73, 86, 0.2);
}

.bead__text {
  font-size: 0.86rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.9); /* Witte tekst voor op de zwarte grote kralen */
}

.bead.is-done:not(.bead--cross) {
  box-shadow: 
    0 0 0 3px rgba(148, 163, 184, 0.5), 
    inset -4px -4px 8px rgba(0, 0, 0, 0.9), 
    inset 3px 3px 6px rgba(255, 255, 255, 0.5);
}


.bead.is-selected:not(.is-current) {
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.86), 0 0 0 12px rgba(60, 96, 126, 0.14), inset 0 -4px 8px rgba(25, 33, 81, 0.34), 0 12px 20px rgba(40, 62, 102, 0.16);
}

.bead.is-current:not(.bead--cross) {
  box-shadow: 
    0 0 0 4px rgba(255, 255, 255, 0.9), 
    0 0 0 9px rgba(100, 116, 139, 0.6), 
    inset -4px -4px 8px rgba(0, 0, 0, 0.9), 
    inset 3px 3px 6px rgba(255, 255, 255, 0.6), 
    0 20px 30px rgba(47, 75, 102, 0.4);
}

.bead--cross.is-current .cross-svg,
.bead--cross.is-selected .cross-svg {
  filter: 
    drop-shadow(0 0 15px rgba(255, 255, 255, 0.5)) 
    drop-shadow(0 15px 25px rgba(32, 67, 96, 0.6));
  transform: scale(1.05);
}

.bead.is-locked {
  opacity: 0.38;
  filter: saturate(0.75);
  cursor: not-allowed;
}

.tag-layer {
  pointer-events: none;
  transform-style: preserve-3d;
}

.mystery-tag {
  padding: 0.38rem 0.64rem;
  border-radius: 12px;
  background: rgba(255, 249, 234, 0.94);
  color: #9c6900;
  border: 1px solid rgba(216, 154, 15, 0.2);
  box-shadow: 0 10px 18px rgba(53, 77, 102, 0.14);
  transform: translate(-50%, -50%) translateZ(34px);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.95rem 1.2rem;
  margin-top: 1rem;
  color: var(--blue-deep);
  font-weight: 600;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
}

.legend-dot--current {
  background: var(--gold);
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.86), 0 0 0 10px rgba(243, 192, 56, 0.22);
}

.legend-dot--done {
  background: var(--success);
}

.legend-dot--locked {
  background: rgba(87, 102, 169, 0.38);
}

@media (max-width: 1080px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .layout {
    width: min(100% - 0.8rem, 920px);
    padding: 0.45rem 0 1rem;
  }

  .sidebar,
  .stage {
    padding: 1rem;
  }

  .stage__head {
    align-items: start;
    flex-direction: column;
  }

  .toggle-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .prayer-card__head {
    flex-direction: column;
  }

  .bead--small {
    width: 18px;
    height: 18px;
  }

  .bead--large {
    width: 30px;
    height: 30px;
  }

  .bead--cross {
    width: 76px;
    height: 92px;
  }

  .cross-shape {
    width: 18px;
    height: 64px;
  }

  .cross-shape::before {
    width: 52px;
    left: -17px;
  }

  .toggle-row {
    grid-template-columns: 1fr;
  }
}

/* True 3D refresh */

:root {
  --bg-top: #091018;
  --bg-bottom: #111a24;
  --panel: rgba(14, 20, 29, 0.88);
  --panel-soft: rgba(19, 28, 40, 0.8);
  --line: rgba(183, 197, 214, 0.11);
  --text: #edf3f9;
  --muted: #9caec2;
  --gold: #cda25a;
  --gold-deep: #8b6734;
  --silver: #cfd7e1;
  --silver-deep: #79889c;
  --success: #7d9f90;
  --locked: #506070;
  --shadow: 0 30px 72px rgba(0, 0, 0, 0.42);
}

body {
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(210, 166, 93, 0.15), transparent 28%),
    radial-gradient(circle at top right, rgba(104, 136, 171, 0.15), transparent 34%),
    radial-gradient(circle at 50% 100%, rgba(255, 255, 255, 0.03), transparent 32%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
}

a {
  color: var(--gold);
}

code {
  font-family: Consolas, "Courier New", monospace;
  color: #f2e4c4;
}

.layout {
  width: min(1400px, calc(100% - 1.4rem));
  padding: 1rem 0 1.6rem;
}

.panel {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(15, 22, 31, 0.96), rgba(18, 27, 39, 0.92));
}

.stage {
  background:
    linear-gradient(180deg, rgba(12, 18, 27, 0.96), rgba(16, 24, 35, 0.94));
}

.soft-card {
  background:
    linear-gradient(180deg, rgba(21, 31, 44, 0.86), rgba(16, 25, 36, 0.82));
  border: 1px solid var(--line);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 16px 36px rgba(0, 0, 0, 0.2);
}

.eyebrow,
.section-label,
.lead,
.instruction,
.after-note,
.status-card p,
.stage__hint,
.legend {
  color: var(--muted);
}

.lead {
  max-width: none;
  line-height: 1.76;
}

h1,
h2 {
  color: #f7fbff;
  letter-spacing: -0.025em;
}

h1 {
  max-width: 12ch;
}

.section-label,
.eyebrow {
  letter-spacing: 0.08em;
}

.progress-bar {
  height: 0.72rem;
  background: rgba(164, 179, 197, 0.12);
}

.progress-bar span {
  box-shadow: 0 0 24px rgba(205, 162, 90, 0.28);
}

.step-chip,
.mystery-chip {
  border: 1px solid rgba(205, 162, 90, 0.2);
  background: rgba(205, 162, 90, 0.12);
  color: #f0d5a2;
}

.step-chip {
  border-color: rgba(166, 181, 199, 0.16);
  background: rgba(114, 132, 151, 0.18);
  color: #d8e2ee;
}

.prayer-text {
  background: rgba(8, 13, 20, 0.34);
  border: 1px solid rgba(166, 181, 199, 0.09);
}

.button {
  color: var(--text);
}

.button:hover:not(:disabled),
.button:focus-visible:not(:disabled) {
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
}

.button--primary {
  background: linear-gradient(180deg, #deb56d 0%, #b98539 100%);
  color: #181109;
  font-weight: 700;
}

.button--secondary {
  background: linear-gradient(180deg, rgba(45, 58, 74, 0.96), rgba(32, 44, 58, 0.96));
  border-color: rgba(180, 195, 212, 0.12);
  color: var(--text);
}

.button--ghost {
  background: rgba(21, 31, 44, 0.72);
  color: var(--text);
  border: 1px solid rgba(180, 195, 212, 0.1);
}

.field select {
  color: var(--text);
  background: rgba(15, 22, 31, 0.92);
  border: 1px solid rgba(180, 195, 212, 0.12);
}

.toggle {
  background: rgba(15, 22, 31, 0.78);
  border: 1px solid rgba(180, 195, 212, 0.1);
}

.status-card {
  display: grid;
  gap: 0.6rem;
}

.server-note {
  padding-top: 0.45rem;
  border-top: 1px solid rgba(180, 195, 212, 0.1);
}

.stage__hint {
  background: rgba(20, 28, 40, 0.72);
  border: 1px solid rgba(180, 195, 212, 0.1);
  color: #c9d5e3;
}

.stage-shell {
  position: relative;
  width: min(100%, 980px);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border-radius: 30px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 16%, rgba(214, 171, 95, 0.14), transparent 24%),
    radial-gradient(circle at 80% 14%, rgba(122, 148, 184, 0.12), transparent 26%),
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.05), transparent 30%),
    linear-gradient(180deg, #101721 0%, #0b1119 100%);
  border: 1px solid rgba(180, 195, 212, 0.1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    inset 0 -80px 120px rgba(0, 0, 0, 0.18);
}

.stage-shell::before {
  content: "";
  position: absolute;
  inset: auto 8% 7% 8%;
  height: 14%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(134, 156, 182, 0.08), transparent 68%);
  filter: blur(18px);
  pointer-events: none;
}

.three-mount,
.tag-layer {
  position: absolute;
  inset: 0;
}

.three-mount canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.tag-layer {
  pointer-events: none;
}

.mystery-tag {
  position: absolute;
  padding: 0.42rem 0.7rem;
  border-radius: 12px;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  font-size: 0.82rem;
  font-weight: 700;
  color: #1b140b;
  background: linear-gradient(180deg, #e1bc7b 0%, #b3823b 100%);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.28);
}

.legend {
  color: #9fb1c6;
}

.legend-dot--current {
  background: var(--gold);
  box-shadow: 0 0 0 5px rgba(205, 162, 90, 0.16);
}

.legend-dot--done {
  background: var(--success);
}

.legend-dot--locked {
  background: var(--locked);
}

@media (max-width: 560px) {
  .mystery-tag {
    font-size: 0.74rem;
    padding: 0.35rem 0.58rem;
  }
}
