html, body {
  margin: 0; padding: 0; background: #000;
}
body {
  width: 600px; height: 600px; overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }

@keyframes balPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.6); opacity: .3; }
}
.balScroll::-webkit-scrollbar { width: 0; height: 0; }

/* ── Base ─────────────────────────────────────────────── */
#root {
  width: 600px; height: 600px; position: relative; overflow: hidden;
  background: #000; color: #fff;
  font-family: 'Cormorant Garamond', Georgia, serif;
  outline: none;
}

.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  background: #000;
}
.screen.hidden { display: none; }

/* ── Loading ──────────────────────────────────────────── */
#screen-loading {
  align-items: center; justify-content: center;
  font-family: 'Space Mono', monospace;
  font-size: 14px; letter-spacing: 3px; color: #ffc463;
}

/* ── Hero ─────────────────────────────────────────────── */
#screen-hero { background: transparent; }

.hero-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  transform-origin: center;
  transition: transform .7s cubic-bezier(.22,.61,.36,1);
}

.hero-grad {
  position: absolute; inset: 0;
  background: linear-gradient(180deg,
    rgba(0,0,0,.72) 0%,
    rgba(0,0,0,.08) 26%,
    rgba(0,0,0,.2)  52%,
    rgba(0,0,0,.9)  100%);
}

.hero-layout {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
}

.hero-top-bar {
  padding: 22px 28px;
}

.hero-stage {
  font-family: 'Space Mono', monospace;
  font-size: 13px; letter-spacing: 3px;
  text-shadow: 0 1px 6px rgba(0,0,0,.7);
}

.hero-gps-row {
  display: flex; align-items: center; gap: 9px;
  margin-top: 9px;
  font-family: 'Space Mono', monospace;
  font-size: 15px; color: #fff;
  text-shadow: 0 1px 6px rgba(0,0,0,.7);
}

.hero-gps-row.hidden { display: none; }

.gps-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; flex-shrink: 0;
  animation: balPulse 1.7s ease-in-out infinite;
}

.btn-debug {
  align-self: flex-start;
  margin: 0 28px;
  padding: 8px 14px;
  font-family: 'Space Mono', monospace;
  font-size: 12px; letter-spacing: 2px;
  color: #ffc463; background: rgba(0,0,0,.45);
  border: 1px solid #ffc463; border-radius: 4px;
  cursor: pointer;
}
.btn-debug:focus {
  outline: none;
  box-shadow: 0 0 18px rgba(255,196,99,.85);
  background: rgba(0,0,0,.7);
}
.btn-debug.hidden { display: none; }

.hero-spacer { flex: 1; }

.hero-info { padding: 0 30px 6px; }

.hero-location {
  font-family: 'Space Mono', monospace;
  font-size: 13px; letter-spacing: 2px; color: #ffc463;
  margin-bottom: 10px;
  text-shadow: 0 1px 8px rgba(0,0,0,.7);
}
.hero-location.hidden { display: none; }

.hero-name {
  font-size: 54px; font-weight: 700;
  line-height: 0.94; letter-spacing: -0.7px;
  text-shadow: 0 2px 22px rgba(0,0,0,.6);
}

.hero-artist {
  font-style: italic; font-size: 25px; color: #ece3d3;
  margin-top: 6px;
  text-shadow: 0 1px 12px rgba(0,0,0,.6);
}

.hero-btns {
  display: flex; gap: 12px;
  padding: 16px 24px 22px;
}

/* ── Buttons ──────────────────────────────────────────── */
button {
  cursor: pointer;
  font-family: 'Space Mono', monospace;
  font-size: 14px; letter-spacing: 1.5px;
  border-radius: 3px;
  transition: all .15s ease;
  text-align: center;
}

.btn-ghost {
  flex: 1; min-height: 80px;
  color: #fff; background: rgba(0,0,0,.4);
  border: 1px solid rgba(255,255,255,.35);
  backdrop-filter: blur(3px);
}
.btn-ghost:focus {
  outline: none;
  border-color: #ffd98a;
  box-shadow: 0 0 22px rgba(255,196,99,.55);
  background: rgba(255,196,99,.14);
}
.btn-listen {
  position: absolute;
  top: 22px; right: 24px;
  z-index: 10;
  min-height: 44px; min-width: 52px; padding: 0 14px;
  display: flex; align-items: center; justify-content: center;
  color: #ffc463;
  background: rgba(0,0,0,.55);
  border: 1px solid rgba(255,196,99,.5);
  backdrop-filter: blur(4px);
  font-size: 13px; letter-spacing: 1.5px;
}
.btn-listen svg { display: block; }

/* Top-right of the hero is reserved for the narration toggle */
#btn-speak-hero.hidden { display: none; }

.btn-icon {
  display: flex; align-items: center; justify-content: center;
  min-width: 56px; padding: 0 16px;
}
.btn-icon svg { display: block; }

.btn-glyph {
  font-family: 'Space Mono', monospace;
  font-size: 16px;
}
.btn-listen:focus {
  outline: none;
  border-color: #ffc463;
  box-shadow: 0 0 18px rgba(255,196,99,.6);
}
.btn-listen.speaking {
  background: rgba(255,196,99,.15);
}

.btn-gold {
  flex: 2; min-height: 80px;
  color: #000; background: #ffc463;
  border: 1px solid #ffc463;
}
.btn-gold:focus {
  outline: none;
  box-shadow: 0 0 26px rgba(255,196,99,.85);
  background: #ffd98a;
}

.btn-outline {
  min-height: 56px; padding: 0 18px;
  color: #fff; background: transparent;
  border: 1px solid rgba(255,255,255,.3);
}
.btn-outline:focus {
  outline: none;
  border-color: #ffd98a;
  box-shadow: 0 0 22px rgba(255,196,99,.55);
}

.btn-back {
  flex: 1; min-height: 80px;
  color: #fff; background: transparent;
  border: 1px solid rgba(255,255,255,.3);
}
.btn-back:focus {
  outline: none;
  border-color: #ffd98a;
  box-shadow: 0 0 22px rgba(255,196,99,.55);
  background: rgba(255,196,99,.08);
}

/* ── Index ────────────────────────────────────────────── */
.idx-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 26px 16px;
  flex-shrink: 0;
}

.idx-title { font-size: 30px; font-weight: 600; line-height: 1; }

.idx-sub {
  font-family: 'Space Mono', monospace;
  font-size: 12px; letter-spacing: 2px; color: #9a9286;
  margin-top: 4px;
}

.idx-stack {
  flex: 1; overflow-y: auto;
  position: relative;
  padding-bottom: 24px;
}

/* Nearest work leads big; header + featured + carousel fill the 600px screen */
.idx-featured {
  display: block;
  width: 100%; height: 316px;
}

/* The main tile is always labeled (two classes to outrank the base
   .idx-tile-overlay opacity:0, which is declared later) */
.idx-featured .idx-tile-overlay { opacity: 1; }

.idx-featured-kicker {
  font-family: 'Space Mono', monospace;
  font-size: 11px; letter-spacing: 2px; color: #ffc463;
  margin-bottom: 4px;
}

.idx-featured-name {
  font-size: 30px;
  -webkit-line-clamp: 1;
  line-clamp: 1;
}

.idx-carousel {
  display: flex; gap: 3px;
  margin-top: 3px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.idx-carousel::-webkit-scrollbar { display: none; }

.idx-car-item {
  flex: 0 0 176px; height: 176px;
  scroll-snap-align: start;
}

/* Carousel tiles stay labeled too, sized down for the small tile */
.idx-car-item .idx-tile-overlay { opacity: 1; }
.idx-car-item .idx-tile-name { font-size: 15px; }

.idx-item {
  position: relative;
  padding: 0; border: none; border-radius: 0;
  background: #0a0a0a;
  overflow: hidden;
  cursor: pointer;
}
.idx-item:focus { outline: none; }
/* Ring drawn on ::after so it paints above the edge-to-edge photo */
.idx-item:focus::after {
  content: '';
  position: absolute; inset: 0;
  box-shadow: inset 0 0 0 3px #ffc463;
  pointer-events: none;
}

.idx-tile-img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}

.idx-tile-overlay {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 30px 10px 9px;
  background: linear-gradient(transparent, rgba(0,0,0,.88));
  text-align: left;
  opacity: 0;
  transition: opacity .15s;
  pointer-events: none;
}
.idx-item:focus .idx-tile-overlay { opacity: 1; }

.idx-tile-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px; font-weight: 600; line-height: 1.1; color: #fff;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.idx-tile-badge {
  position: absolute; top: 6px; right: 6px;
  font-family: 'Space Mono', monospace;
  font-size: 11px; letter-spacing: .5px; color: #ffc463;
  background: rgba(0,0,0,.62);
  padding: 3px 7px; border-radius: 2px;
  backdrop-filter: blur(2px);
  pointer-events: none;
}

/* ── Detail ───────────────────────────────────────────── */
.det-header { padding: 30px 30px 0; flex-shrink: 0; }

.det-meta {
  font-family: 'Space Mono', monospace;
  font-size: 14px; letter-spacing: 2.5px; color: #ffc463;
}

.det-name {
  font-size: 46px; font-weight: 700;
  line-height: 0.98; letter-spacing: -0.4px;
  margin-top: 10px;
}

.det-artist {
  font-style: italic; font-size: 26px; color: #d9cdb8;
  margin-top: 5px;
}

.det-location {
  font-family: 'Space Mono', monospace;
  font-size: 15px; letter-spacing: 1px; color: #9a9286;
  margin-top: 13px;
}

.det-body {
  flex: 1; padding: 16px 30px 22px;
  min-height: 0; overflow-y: auto;
  font-size: 19px; line-height: 1.55; color: #cdbfa9;
  white-space: pre-line;
  scroll-behavior: smooth;
}
.det-body:focus, .art-bio:focus {
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(255,196,99,.45);
  border-radius: 3px;
}

.det-btns {
  display: flex; gap: 12px;
  padding: 14px 24px 22px; flex-shrink: 0;
}

/* ── Artist ───────────────────────────────────────────── */
.art-header {
  display: flex; align-items: center; gap: 18px;
  padding: 28px 30px 4px; flex-shrink: 0;
}

.art-portrait-wrap {
  width: 88px; height: 88px; border-radius: 50%;
  overflow: hidden; flex-shrink: 0;
  border: 1px solid rgba(255,255,255,.4);
}

.art-portrait {
  width: 100%; height: 100%; object-fit: cover; display: block;
}

.art-header-text { min-width: 0; }

.art-label {
  font-family: 'Space Mono', monospace;
  font-size: 12px; letter-spacing: 2.5px; color: #ffc463;
}

.art-name {
  font-size: 36px; font-weight: 700;
  line-height: 1.0; letter-spacing: -0.3px;
  margin-top: 5px;
}

.art-bio {
  flex: 1; overflow-y: auto;
  padding: 18px 30px 14px; min-height: 0;
  font-size: 20px; line-height: 1.6; color: #cdbfa9;
  white-space: pre-line;
  scroll-behavior: smooth;
}

.art-btns {
  display: flex; gap: 12px;
  padding: 14px 24px 22px; flex-shrink: 0;
}

/* ── Language ─────────────────────────────────────────── */
.lang-list {
  flex: 1; overflow-y: auto;
  position: relative;
  padding: 4px 26px 22px;
}

.lang-item {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; min-height: 62px; padding: 0 20px;
  margin-bottom: 10px;
  color: #fff; background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.18);
  font-family: 'Cormorant Garamond', serif;
  font-size: 24px; letter-spacing: .5px;
  text-align: left;
}
.lang-item:focus {
  outline: none;
  border-color: #ffd98a;
  box-shadow: 0 0 22px rgba(255,196,99,.55);
  background: rgba(255,196,99,.1);
}
.lang-item.active { border-color: rgba(255,196,99,.7); color: #ffc463; }

.lang-check {
  font-family: 'Space Mono', monospace;
  font-size: 18px; color: #ffc463;
}

.set-section {
  font-family: 'Space Mono', monospace;
  font-size: 12px; letter-spacing: 2px; color: #9a9286;
  text-transform: uppercase;
  margin: 14px 2px 10px;
}

.set-value {
  font-family: 'Space Mono', monospace;
  font-size: 15px; letter-spacing: 1px; color: #ffc463;
}

/* ── Welcome ──────────────────────────────────────────── */
.wel-card {
  flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column;
  padding: 24px 28px 22px;
  position: relative;
}

.wel-title { font-size: 42px; font-weight: 700; line-height: 1; }

.wel-sub {
  font-family: 'Space Mono', monospace;
  font-size: 12px; letter-spacing: 2px; color: #ffc463;
  margin-top: 7px;
}

.wel-intro { font-size: 20px; color: #cdbfa9; margin-top: 8px; }

.wel-langs {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.wel-chip {
  min-height: 48px;
  color: #fff; background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.18);
  font-family: 'Cormorant Garamond', serif;
  font-size: 19px; letter-spacing: .3px;
}
.wel-chip:focus {
  outline: none;
  border-color: #ffd98a;
  box-shadow: 0 0 18px rgba(255,196,99,.55);
  background: rgba(255,196,99,.1);
}
.wel-chip.active { border-color: rgba(255,196,99,.7); color: #ffc463; }

.wel-toggles { margin-top: 16px; }
.wel-toggles .lang-item { min-height: 54px; margin-bottom: 8px; }

#btn-welcome-start { min-height: 64px; margin-top: 6px; flex: 0 0 auto; }

/* ── Responsive (phones / desktop — html.mobile) ──────── */
/* Glasses keep the fixed 600x600 layout; other devices fill the viewport,
   capped at the design width and centered. */
html.mobile, html.mobile body {
  width: 100%; height: 100%;
}
html.mobile body {
  display: flex; justify-content: center;
}
html.mobile #root {
  width: 100%; max-width: 600px;
  height: 100dvh;
}
/* Root is capped at 600px on wide screens; scale the Loop tiles to narrow phones */
html.mobile .idx-featured { height: min(316px, 53vw); }
html.mobile .idx-car-item { flex-basis: min(176px, 29vw); height: min(176px, 29vw); }
html.mobile .hero-name { font-size: clamp(34px, 9vw, 54px); }
html.mobile .det-name  { font-size: clamp(32px, 8vw, 46px); }
html.mobile .art-name  { font-size: clamp(26px, 7vw, 36px); }
html.mobile .wel-langs { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
