:root {
  --bg: #050608;
  --fg: #f2ede6;
  --muted: rgba(255, 255, 255, 0.72);
  --grid-opacity: 0.92;
  --vertical-line-alpha: 0.18;
  --progress: 0;
  --hero-alpha: 1;
  --projects-alpha: 0;
  --mobile-projects-alpha: 0;
  --projects-scroll: 0;
  --paper-alpha: 0.34;
  --projects-shift-vh: 0vh;
  /* Project label vertical offsets. Positive values move labels downward. */
  --project-label-top-row-offset: 96px;
  --project-label-bottom-row-offset: 124px;
  --hero-note-alpha: 1;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: Arial, Helvetica, sans-serif;
  overflow-x: hidden;
}

body {
  background: linear-gradient(180deg, #050608 0%, #07090c 100%);
}

html { -webkit-text-size-adjust: 100%; }

body.is-loading {
  overflow: hidden;
}

.preloader {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  background: #000;
  opacity: 1;
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

.preloader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.preloader__track {
  width: min(122px, 24vw);
  height: 2px;
  background: rgba(255,255,255,0.12);
  overflow: hidden;
  border-radius: 999px;
}

.preloader__fill {
  width: 100%;
  height: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  background: rgba(255,255,255,0.92);
  transition: transform 0.18s linear;
}


.paper-bg {
  position: fixed;
  inset: -2%;
  z-index: 0;
  pointer-events: none;
  opacity: var(--paper-alpha);
  background: url('./assets/paper/paper-texture.jpeg') center center / cover no-repeat;
  filter: grayscale(1) contrast(1.18) brightness(0.34) saturate(0.0);
  mix-blend-mode: screen;
}

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: var(--grid-opacity);
  background:
    linear-gradient(to right, rgba(255, 255, 255, var(--vertical-line-alpha)) 1px, transparent 1px) 0 0 / 20vw 100%,
    linear-gradient(to right, rgba(255, 255, 255, 0.03) 1px, transparent 1px) 0 0 / 10vw 100%,
    radial-gradient(circle at center, rgba(255,255,255,0.022), rgba(255,255,255,0) 58%);
}

#webgl {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  display: block;
}

.scroll-shell {
  position: relative;
  z-index: 3;
}

.panel {
  position: relative;
  min-height: 100vh;
}

.hero-panel {
  height: 100vh;
}

.projects-panel {
  height: 198vh;
}

.ui-shell {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.logo {
  position: fixed;
  top: 22px;
  left: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(248, 244, 238, 0.98);
  color: #050608;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 25px;
  letter-spacing: -0.04em;
  pointer-events: auto;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08);
}
.logo span { transform: translateY(-1px); }

.top-links {
  position: fixed;
  top: 20px;
  right: 26px;
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 12px;
  letter-spacing: 0.34em;
  pointer-events: auto;
}
.top-links a,
.top-links span {
  color: rgba(255,255,255,0.94);
  text-decoration: none;
}

.menu-mark {
  position: fixed;
  right: 28px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  display: grid;
  gap: 5px;
  align-content: center;
}
.menu-mark span {
  display: block;
  width: 18px;
  height: 2px;
  background: rgba(255,255,255,0.88);
  border-radius: 999px;
}

.mobile-scroll-hint {
  display: none;
  position: fixed;
  z-index: 5;
  width: 18px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(0);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.mobile-scroll-hint__label {
  display: block;
  font-size: 8px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  text-orientation: upright;
  color: rgba(255,255,255,0.78);
}

.mobile-scroll-hint__arrow {
  display: block;
  width: 11px;
  height: 8px;
  margin-top: 7px;
  color: rgba(255,255,255,0.92);
  animation: scrollHintBounce 1.35s ease-in-out infinite;
}

.mobile-scroll-hint__arrow path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.45;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@keyframes scrollHintBounce {
  0%, 100% {
    transform: translateY(0);
    opacity: 0.64;
  }
  50% {
    transform: translateY(5px);
    opacity: 1;
  }
}

body.has-scrolled .mobile-scroll-hint {
  opacity: 0;
  transform: translateY(8px);
}

.side-copy {
  position: fixed;
  font-size: 12px;
  letter-spacing: 0.28em;
  color: rgba(255,255,255,0.75);
  writing-mode: vertical-rl;
  text-orientation: mixed;
}
.side-left { left: 6px; bottom: 20px; transform: rotate(180deg); }
.side-right { right: 6px; bottom: 20px; }

.hero-copy {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, calc(-50% - var(--projects-alpha) * 2vh));
  text-align: center;
  opacity: var(--hero-alpha);
  transition: opacity 0.32s linear, transform 0.38s ease;
}
.hero-copy h1 {
  margin: 0;
  font-size: clamp(60px, 10.2vw, 132px);
  line-height: 0.92;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: rgba(246, 240, 232, 0.95);
}
.hero-copy h1 .line { display:block; }
.hero-copy h1 .sacred { font-size: 0.9em; }
.hero-copy h1 .mirage { font-size: 1em; }
.hero-copy .jp {
  margin-top: 18px;
  font-size: clamp(14px, 1.5vw, 26px);
  letter-spacing: 0.34em;
  color: rgba(246, 240, 232, 0.92);
}

.hero-note {
  position: fixed;
  right: 110px;
  bottom: 92px;
  max-width: 240px;
  font-size: 15px;
  line-height: 1.7;
  color: rgba(255,255,255,0.84);
  text-align: left;
  opacity: var(--hero-note-alpha);
  transform: translateY(calc((1 - var(--hero-note-alpha)) * 10px));
  transition: opacity 0.32s linear, transform 0.38s ease;
}

.projects-ui {
  position: fixed;
  inset: 0;
  opacity: var(--projects-alpha);
  transition: opacity 0.28s linear;
}

.projects-title {
  position: absolute;
  top: 28vh;
  left: 50%;
  transform: translateX(-50%) translateY(calc((1 - var(--projects-alpha)) * 14px + var(--projects-shift-vh)));
  font-size: clamp(18px, 2.2vw, 34px);
  letter-spacing: 0.15em;
  color: rgba(255,255,255,0.96);
  opacity: var(--projects-alpha);
  transition: opacity 0.28s linear, transform 0.38s ease;
}
.projects-title::after {
  content: "";
  display: block;
  margin: 10px auto 0;
  width: 112px;
  height: 1px;
  background: rgba(255,255,255,0.68);
}

.project-label {
  /* Labels anchor to the top-left corner of each thumbnail in app.js.
     This transform only moves them upward above the thumbnail and nudges rows in pixels. */
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: rgba(255,255,255,0.96);
  text-transform: uppercase;
  pointer-events: none;
  opacity: var(--projects-alpha);
  --row-label-offset: var(--project-label-top-row-offset);
  transform: translateY(calc(-100% - 14px + (1 - var(--projects-alpha)) * 4px + var(--row-label-offset)));
  transition: opacity 0.28s linear, transform 0.38s ease;
}
.project-label.second-row {
  --row-label-offset: var(--project-label-bottom-row-offset);
}
.project-label .num {
  display: none;
}
.project-label strong {
  font-size: clamp(12px, 1.06vw, 16px);
  line-height: 1.15;
  letter-spacing: 0.16em;
  font-weight: 700;
}
.project-label em {
  font-style: normal;
  font-size: clamp(12px, 1vw, 15px);
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.78);
}


.mobile-projects-list {
  display: none;
}

.site-footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 22px;
  z-index: 6;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.60);
}

.video-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(12px);
}
.video-modal.is-open { display: flex; }
.video-modal__inner {
  width: min(1060px, 88vw);
  background: rgba(10, 11, 14, 0.95);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 22px;
  box-shadow: 0 18px 80px rgba(0,0,0,0.38);
}
.video-modal__meta {
  margin-bottom: 14px;
  font-size: 14px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.86);
}
.video-modal video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}
.close-modal {
  position: fixed;
  top: 22px;
  right: 22px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.92);
  color: #000;
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}

.tuning-panel {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  width: min(760px, calc(100vw - 100px));
  padding: 12px 14px 14px;
  overflow: hidden;
  background: rgba(6, 8, 12, 0.78);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 50px rgba(0,0,0,0.35);
  pointer-events: auto;
  transition: width 0.28s ease, min-width 0.28s ease, max-width 0.28s ease, padding 0.28s ease, border-radius 0.28s ease, background 0.28s ease, box-shadow 0.28s ease, height 0.28s ease;
}

.tuning-panel.is-collapsed {
  width: 24px;
  min-width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 999px;
  background: rgba(6, 8, 12, 0.42);
  border-color: rgba(255,255,255,0.10);
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 18px rgba(0,0,0,0.24);
}

.tuning-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.tuning-panel__title {
  font-size: 11px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.72);
  text-align: center;
  flex: 1;
  padding-left: 60px;
}

.tuning-panel__toggle,
.tuning-actions button,
.tuning-presets button {
  appearance: none;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.92);
  padding: 7px 12px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}

.tuning-panel__toggle {
  min-width: 24px;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  letter-spacing: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tuning-panel button[hidden] {
  display: none !important;
}

.tuning-panel.is-collapsed .tuning-panel__header {
  margin: 0;
  justify-content: center;
}

.tuning-panel.is-collapsed .tuning-panel__title {
  display: none;
}

.tuning-panel.is-collapsed .tuning-panel__toggle {
  border: 0;
  background: transparent;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tuning-grid,
.tuning-presets,
.tuning-actions,
.tuning-auth {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.tuning-panel.is-collapsed .tuning-grid,
.tuning-panel.is-collapsed .tuning-actions,
.tuning-panel.is-collapsed .tuning-presets,
.tuning-panel.is-collapsed .tuning-auth {
  display: none;
}

.tuning-panel.is-auth {
  width: min(228px, calc(100vw - 40px));
  min-width: 228px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(6, 8, 12, 0.82);
}

.tuning-panel.is-auth .tuning-grid,
.tuning-panel.is-auth .tuning-actions,
.tuning-panel.is-auth .tuning-presets {
  display: none;
}

.tuning-panel.is-auth .tuning-panel__header {
  display: none;
}

.tuning-panel.is-unlocked {
  width: min(760px, calc(100vw - 100px));
}

.tuning-auth,
.tuning-grid,
.tuning-presets,
.tuning-actions {
  display: none;
}

.tuning-auth[hidden],
.tuning-grid[hidden],
.tuning-presets[hidden],
.tuning-actions[hidden] {
  display: none !important;
}

.tuning-panel.is-auth .tuning-auth {
  display: block;
  animation: tuningReveal 0.22s ease both;
}

.tuning-panel.is-unlocked .tuning-grid,
.tuning-panel.is-unlocked .tuning-presets,
.tuning-panel.is-unlocked .tuning-actions,
.tuning-panel.is-unlocked .tuning-panel__header {
  animation: tuningReveal 0.22s ease both;
}

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

.tuning-auth__row {
  display: grid;
  grid-template-columns: 1fr 24px;
  gap: 8px;
  align-items: center;
}

.tuning-auth__input {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.96);
  outline: none;
  border-radius: 10px;
  font-size: 14px;
}

.tuning-auth__input::placeholder {
  color: rgba(255,255,255,0.34);
}

.tuning-auth__submit {
  appearance: none;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.92);
  padding: 0;
  font-size: 12px;
  line-height: 1;
  letter-spacing: 0;
  cursor: pointer;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tuning-auth__error {
  display: none !important;
}

.tuning-row {
  display: grid;
  grid-template-columns: 112px minmax(0,1fr) 72px;
  align-items: center;
  gap: 10px;
}
.tuning-row label {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.78);
}
.tuning-row input[type="range"] { width: 100%; accent-color: #f1ebe3; }
.tuning-value {
  font-size: 12px;
  color: rgba(255,255,255,0.9);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.tuning-value-input {
  appearance: textfield;
  width: 100%;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.96);
  border-radius: 10px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.tuning-value-input::-webkit-outer-spin-button,
.tuning-value-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.tuning-panel.is-unlocked .tuning-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
  align-items: start;
}

.tuning-panel.is-unlocked .tuning-row.is-wide {
  grid-column: 1 / -1;
}
.tuning-presets,
.tuning-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.tuning-presets .preset-group {
  display: inline-flex;
  gap: 6px;
}
.tuning-presets button.is-save {
  opacity: 0.85;
}

@media (max-width: 980px) {
  .hero-note { right: 28px; bottom: 72px; font-size: 14px; }
  .projects-title { top: 24vh; }
  .project-label {
  /* Project label placement note: the actual row height is driven from app.js
     in updateProjectLabelPositions(). This CSS transform only controls the
     small reveal animation as projects fade in. */
    transform: scale(0.82) translateY(calc(-100% - 14px + (1 - var(--projects-alpha)) * 4px + var(--row-label-offset)));
    transform-origin: top left;
  }
              .tuning-panel {
    width: min(94vw, 700px);
    top: 10px;
  }
  .tuning-panel__title { padding-left: 0; }
  .tuning-grid { grid-template-columns: 1fr; }
  .tuning-row { grid-template-columns: 104px minmax(0,1fr) 48px; }
}

@media (max-width: 768px) {
  .hero-panel { height: 100svh; }
  .projects-panel {
    height: auto;
    min-height: auto;
    padding-top: 20svh;
    padding-bottom: 28px;
  }

  .top-links,
  .projects-ui,
  .hero-note,
  .side-copy {
    display: none;
  }

  .menu-mark {
    top: 28px;
    transform: none;
  }

  .mobile-scroll-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    top: auto;
    right: 28px;
    bottom: calc(26px + env(safe-area-inset-bottom, 0px));
    width: 18px;
    opacity: 0.9;
  }

  .logo {
    top: 24px;
    left: 18px;
    width: 46px;
    height: 46px;
    font-size: 28px;
  }

  .hero-copy {
    top: 47%;
    transform: translate(-50%, calc(-50% - var(--projects-alpha) * 16px));
  }

  .hero-copy h1 {
    font-size: 16.5vw;
    letter-spacing: 0.18em;
  }

  .hero-copy .jp {
    margin-top: 16px;
    font-size: 5vw;
    letter-spacing: 0.42em;
  }

  .mobile-projects-list {
    display: block;
    position: relative;
    z-index: 6;
    width: 100%;
    opacity: var(--mobile-projects-alpha);
    transform: translateY(calc((1 - var(--mobile-projects-alpha)) * 18px));
    transition: opacity 0.28s linear, transform 0.38s ease;
    padding-bottom: 24px;
  }

  .mobile-projects-title {
    text-align: center;
    font-size: 16px;
    letter-spacing: 0.18em;
    color: rgba(255,255,255,0.95);
    margin: 0 auto 52px;
    width: max-content;
  }

  .mobile-projects-title::after {
    content: "";
    display: block;
    width: 112px;
    height: 1px;
    background: rgba(255,255,255,0.7);
    margin: 10px auto 0;
  }

  .mobile-projects-track {
    width: 100%;
  }

  .mobile-project-card {
    position: relative;
    width: min(76vw, 620px);
    margin: 0 auto 88px;
  }

  .mobile-project-image {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 0;
    box-shadow: 0 18px 50px rgba(0,0,0,0.24);
  }

  .mobile-project-num {
    position: absolute;
    top: -38px;
    right: -10px;
    font-size: 46px;
    line-height: 1;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: rgba(255,255,255,0.9);
  }

  .mobile-project-meta {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-transform: uppercase;
  }

  .mobile-project-title {
    font-size: 13px;
    letter-spacing: 0.18em;
    color: rgba(255,255,255,0.95);
  }

  .mobile-project-subtitle {
    font-size: 12px;
    letter-spacing: 0.12em;
    color: rgba(255,255,255,0.72);
  }

  .site-footer {
    position: static;
    margin-top: 10px;
    padding: 26px 16px 8px;
    text-align: center;
    font-size: 11px;
    letter-spacing: 0.18em;
    color: rgba(255,255,255,0.62);
  }

  .video-modal__inner {
    width: calc(100vw - 20px);
    padding: 16px;
  }

  .tuning-panel {
    width: calc(100vw - 16px);
    top: 8px;
    padding: 10px;
  }

  .tuning-row {
    grid-template-columns: 84px minmax(0,1fr) 48px;
    gap: 8px;
  }

  .tuning-row label,
  .tuning-value,
  .tuning-actions button,
  .tuning-presets button,
  .tuning-panel__toggle {
    font-size: 10px;
  }

  .tuning-panel__title {
    font-size: 10px;
  }
}

@media (max-width: 768px) {
  .tuning-panel.is-auth { width: calc(100vw - 24px); min-width: 0; }
  .tuning-auth__row { grid-template-columns: 1fr 24px; }
}



/* Mobile tuning panel usability hotfix
   Drop this AFTER the main styles.css rules, or paste it at the very bottom
   of styles.css. It only targets the tuning UI and does not affect the hero/projects layout.
*/

.tuning-row input[type="range"]{
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 28px;
  background: transparent;
  accent-color: #f1ebe3;
  touch-action: pan-x;
}

.tuning-row input[type="range"]::-webkit-slider-runnable-track{
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.18);
}

.tuning-row input[type="range"]::-webkit-slider-thumb{
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f1ebe3;
  border: 1px solid rgba(0,0,0,0.18);
  box-shadow: 0 2px 8px rgba(0,0,0,0.28);
  margin-top: -8px;
}

.tuning-row input[type="range"]::-moz-range-track{
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.18);
}

.tuning-row input[type="range"]::-moz-range-thumb{
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f1ebe3;
  border: 1px solid rgba(0,0,0,0.18);
  box-shadow: 0 2px 8px rgba(0,0,0,0.28);
}

@media (max-width: 768px) {
  .tuning-panel{
    width: calc(100vw - 16px);
    max-height: calc(100svh - 18px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 14px 14px 18px;
    border-radius: 18px;
    top: 8px;
  }

  .tuning-panel.is-collapsed{
    width: 34px;
    min-width: 34px;
    height: 34px;
    padding: 0;
  }

  .tuning-panel.is-auth{
    width: calc(100vw - 16px);
    min-width: 0;
    padding: 14px;
  }

  .tuning-panel__toggle{
    min-width: 34px;
    width: 34px;
    height: 34px;
    font-size: 14px;
  }

  .tuning-panel.is-unlocked .tuning-grid{
    grid-template-columns: 1fr;
    gap: 14px 0;
  }

  .tuning-panel.is-unlocked .tuning-row.is-wide{
    grid-column: auto;
  }

  .tuning-row{
    grid-template-columns: 96px minmax(0, 1fr) 56px;
    gap: 12px;
    align-items: center;
  }

  .tuning-row label{
    font-size: 11px;
    line-height: 1.15;
    letter-spacing: 0.14em;
  }

  .tuning-value{
    font-size: 12px;
  }

  .tuning-row input[type="range"]{
    height: 36px;
  }

  .tuning-row input[type="range"]::-webkit-slider-runnable-track{
    height: 8px;
  }

  .tuning-row input[type="range"]::-webkit-slider-thumb{
    width: 30px;
    height: 30px;
    margin-top: -11px;
  }

  .tuning-row input[type="range"]::-moz-range-track{
    height: 8px;
  }

  .tuning-row input[type="range"]::-moz-range-thumb{
    width: 30px;
    height: 30px;
  }

  .tuning-presets,
  .tuning-actions{
    gap: 8px;
  }

  .tuning-presets button,
  .tuning-actions button{
    min-height: 42px;
    padding: 10px 12px;
    font-size: 10px;
  }

  .tuning-auth__row{
    grid-template-columns: 1fr 34px;
    gap: 10px;
  }

  .tuning-auth__submit{
    width: 34px;
    height: 34px;
    font-size: 14px;
  }
}


/* === Final mobile tuning panel overrides ===
   These must stay at the very bottom so they override older tuning rules. */
@media (max-width: 768px) {
  .tuning-panel {
    width: calc(100vw - 12px) !important;
    max-height: calc(100svh - 14px) !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    padding: 14px 14px 20px !important;
    top: 7px !important;
    border-radius: 18px !important;
  }

  .tuning-panel.is-collapsed {
    width: 34px !important;
    min-width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
  }

  .tuning-panel.is-auth {
    width: calc(100vw - 12px) !important;
    min-width: 0 !important;
    padding: 14px !important;
  }

  .tuning-panel.is-unlocked .tuning-grid {
    grid-template-columns: 1fr !important;
    gap: 14px 0 !important;
  }

  .tuning-panel.is-unlocked .tuning-row.is-wide {
    grid-column: auto !important;
  }

  .tuning-row {
    grid-template-columns: minmax(0, 1fr) 88px !important;
    grid-template-areas:
      "label label"
      "range value" !important;
    gap: 10px 12px !important;
    align-items: center !important;
  }

  .tuning-row label {
    grid-area: label;
    font-size: 11px !important;
    line-height: 1.15 !important;
    letter-spacing: 0.14em !important;
  }

  .tuning-row input[type="range"] {
    grid-area: range;
    height: 46px !important;
  }

  .tuning-value,
  .tuning-value-input {
    grid-area: value;
    font-size: 16px !important;
  }

  .tuning-value-input,
  .tuning-auth__input {
    min-height: 42px !important;
    padding: 8px 10px !important;
    font-size: 16px !important; /* prevents iPhone zoom-on-focus */
    line-height: 1.2;
  }

  .tuning-value-input {
    width: 88px !important;
    text-align: center !important;
  }

  .tuning-row input[type="range"]::-webkit-slider-runnable-track {
    height: 10px !important;
  }

  .tuning-row input[type="range"]::-webkit-slider-thumb {
    width: 34px !important;
    height: 34px !important;
    margin-top: -12px !important;
  }

  .tuning-row input[type="range"]::-moz-range-track {
    height: 10px !important;
  }

  .tuning-row input[type="range"]::-moz-range-thumb {
    width: 34px !important;
    height: 34px !important;
  }

  .tuning-panel__toggle {
    min-width: 34px !important;
    width: 34px !important;
    height: 34px !important;
    font-size: 14px !important;
  }

  .tuning-auth__row {
    grid-template-columns: 1fr 34px !important;
    gap: 10px !important;
  }

  .tuning-auth__submit {
    width: 34px !important;
    height: 34px !important;
    font-size: 14px !important;
  }

  .tuning-presets,
  .tuning-actions {
    gap: 8px !important;
  }

  .tuning-presets button,
  .tuning-actions button {
    min-height: 42px !important;
    padding: 10px 12px !important;
    font-size: 10px !important;
  }
}


/* === Final v12 mobile tuning / dual-arrow overrides === */
.tuning-panel.is-minimized {
  width: 74px;
  min-width: 74px;
  height: 34px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(6, 8, 12, 0.42);
  border-color: rgba(255,255,255,0.10);
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 18px rgba(0,0,0,0.24);
}

.tuning-panel.is-minimized .tuning-panel__header {
  margin: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 0 2px;
}

.tuning-panel.is-minimized .tuning-panel__title {
  display: none;
}

.tuning-panel.is-minimized .tuning-grid,
.tuning-panel.is-minimized .tuning-presets,
.tuning-panel.is-minimized .tuning-actions,
.tuning-panel.is-minimized .tuning-auth {
  display: none;
}

.tuning-panel.is-minimized .tuning-panel__toggle {
  width: 24px;
  min-width: 24px;
  height: 24px;
  padding: 0;
}

.tuning-panel.is-unlocked .tuning-panel__header {
  display: flex;
}

.tuning-panel.is-unlocked .tuning-panel__title {
  padding-left: 0;
}

.tuning-panel.is-unlocked .tuning-panel__toggle--soft,
.tuning-panel.is-unlocked .tuning-panel__toggle--hard {
  display: inline-flex;
}

@media (max-width: 768px) {
  .tuning-panel {
    width: calc(100vw - 12px) !important;
    max-height: calc(100svh - 14px) !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    padding: 10px 12px 14px !important;
    top: 7px !important;
    border-radius: 18px !important;
  }

  .tuning-panel.is-collapsed {
    width: 34px !important;
    min-width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
  }

  .tuning-panel.is-minimized {
    width: 76px !important;
    min-width: 76px !important;
    height: 34px !important;
    padding: 0 5px !important;
  }

  .tuning-panel.is-auth {
    width: calc(100vw - 12px) !important;
    min-width: 0 !important;
    padding: 12px !important;
  }

  .tuning-panel.is-unlocked .tuning-grid {
    grid-template-columns: 1fr !important;
    gap: 8px 0 !important;
  }

  .tuning-row {
    grid-template-columns: 88px minmax(0, 1fr) 70px !important;
    gap: 6px 10px !important;
    align-items: center !important;
  }

  .tuning-row label {
    grid-area: auto !important;
    font-size: 10px !important;
    line-height: 1.05 !important;
    letter-spacing: 0.12em !important;
  }

  .tuning-row input[type="range"] {
    grid-area: auto !important;
    height: 30px !important;
  }

  .tuning-value,
  .tuning-value-input {
    grid-area: auto !important;
    font-size: 16px !important;
    width: 70px !important;
    min-width: 70px !important;
  }

  .tuning-value-input,
  .tuning-auth__input {
    min-height: 36px !important;
    padding: 6px 8px !important;
    font-size: 16px !important;
    line-height: 1.2;
  }

  .tuning-row input[type="range"]::-webkit-slider-runnable-track {
    height: 8px !important;
  }

  .tuning-row input[type="range"]::-webkit-slider-thumb {
    width: 28px !important;
    height: 28px !important;
    margin-top: -10px !important;
  }

  .tuning-row input[type="range"]::-moz-range-track {
    height: 8px !important;
  }

  .tuning-row input[type="range"]::-moz-range-thumb {
    width: 28px !important;
    height: 28px !important;
  }

  .tuning-panel__toggle,
  .tuning-auth__submit {
    width: 34px !important;
    min-width: 34px !important;
    height: 34px !important;
    font-size: 14px !important;
  }

  .tuning-auth__row {
    grid-template-columns: 1fr 34px !important;
    gap: 10px !important;
  }

  .tuning-presets,
  .tuning-actions {
    gap: 6px !important;
    margin-top: 10px !important;
  }

  .tuning-presets button,
  .tuning-actions button {
    min-height: 34px !important;
    padding: 7px 10px !important;
    font-size: 9px !important;
    letter-spacing: 0.1em !important;
  }
}


/* === v13 tuning panel visibility + mobile compactness === */
.tuning-panel__header {
  gap: 8px;
  margin-bottom: 6px;
}

.tuning-panel__title {
  padding-left: 0;
}

.tuning-panel__toggle,
.tuning-auth__submit {
  position: relative;
  color: transparent !important;
  font-family: Arial, Helvetica, sans-serif;
}

.tuning-panel__toggle::before,
.tuning-auth__submit::before {
  content: '';
  width: 8px;
  height: 8px;
  border-right: 2px solid rgba(255,255,255,0.95);
  border-bottom: 2px solid rgba(255,255,255,0.95);
  transform: rotate(45deg);
  display: block;
  transition: transform 0.2s ease;
}

.tuning-panel__toggle[data-icon='up']::before,
.tuning-auth__submit[data-icon='up']::before {
  transform: rotate(-135deg);
}

.tuning-panel__toggle[data-icon='down']::before,
.tuning-auth__submit[data-icon='down']::before {
  transform: rotate(45deg);
}

.tuning-panel.is-collapsed {
  width: 28px;
  min-width: 28px;
  height: 28px;
}

.tuning-panel.is-collapsed .tuning-panel__toggle {
  width: 30px;
  min-width: 30px;
  height: 30px;
}

.tuning-panel.is-minimized {
  width: 66px;
  min-width: 66px;
  height: 28px;
  padding: 0 4px;
}


.tuning-panel.is-minimized .tuning-panel__header {
  height: 100%;
  padding: 0;
  gap: 4px;
  grid-template-columns: 28px 1fr 28px;
  justify-content: space-between;
}

.tuning-panel.is-unlocked .tuning-panel__header {
  display: grid;
  grid-template-columns: 30px 1fr 30px;
  align-items: center;
  gap: 8px;
}

.tuning-panel.is-unlocked .tuning-panel__toggle--soft,
.tuning-panel.is-unlocked .tuning-panel__toggle--hard,
.tuning-panel.is-unlocked .tuning-panel__title {
  display: inline-flex;
}

.tuning-panel.is-unlocked .tuning-panel__title {
  justify-content: center;
}

@media (max-width: 768px) {
  .tuning-panel {
    width: calc(100vw - 16px) !important;
    max-height: calc(100svh - 16px) !important;
    padding: 8px 10px 10px !important;
    top: 6px !important;
    border-radius: 16px !important;
  }

  .tuning-panel.is-auth {
    width: calc(100vw - 14px) !important;
    padding: 10px !important;
  }

  .tuning-panel.is-collapsed {
    width: 28px !important;
    min-width: 28px !important;
    height: 28px !important;
    padding: 0 !important;
  }

  .tuning-panel.is-minimized {
    width: 66px !important;
    min-width: 66px !important;
    height: 28px !important;
    padding: 0 4px !important;
  }

  .tuning-panel.is-unlocked .tuning-grid {
    grid-template-columns: 1fr !important;
    gap: 4px 0 !important;
  }

  .tuning-row {
    grid-template-columns: 78px minmax(0, 1fr) 56px !important;
    gap: 2px 6px !important;
    min-height: 20px;
  }

  .tuning-row label {
    font-size: 8px !important;
    line-height: 0.98 !important;
    letter-spacing: 0.08em !important;
  }

  .tuning-row input[type='range'] {
    height: 18px !important;
  }

  .tuning-row input[type='range']::-webkit-slider-runnable-track {
    height: 5px !important;
  }

  .tuning-row input[type='range']::-webkit-slider-thumb {
    width: 18px !important;
    height: 18px !important;
    margin-top: -7px !important;
  }

  .tuning-row input[type='range']::-moz-range-track {
    height: 5px !important;
  }

  .tuning-row input[type='range']::-moz-range-thumb {
    width: 18px !important;
    height: 18px !important;
  }

  .tuning-value,
  .tuning-value-input {
    width: 56px !important;
    min-width: 56px !important;
  }

  .tuning-value-input,
  .tuning-auth__input {
    min-height: 28px !important;
    padding: 3px 6px !important;
    font-size: 16px !important;
    line-height: 1.1 !important;
  }

  .tuning-panel__toggle,
  .tuning-auth__submit {
    width: 28px !important;
    min-width: 28px !important;
    height: 28px !important;
  }

  .tuning-panel__toggle::before,
  .tuning-auth__submit::before {
    width: 6px;
    height: 6px;
  }

  .tuning-panel.is-unlocked .tuning-panel__header {
    grid-template-columns: 28px 1fr 28px;
    gap: 6px;
    margin-bottom: 2px;
  }

  .tuning-panel__title {
    font-size: 9px !important;
    letter-spacing: 0.18em !important;
  }

  .tuning-presets,
  .tuning-actions {
    gap: 4px !important;
    margin-top: 6px !important;
  }

  .tuning-presets button,
  .tuning-actions button {
    min-height: 28px !important;
    padding: 6px 8px !important;
    font-size: 8px !important;
    letter-spacing: 0.08em !important;
  }
}
