:root {
  --paper: #f8f7f2;
  --ink: #050505;
  --muted: rgba(5,5,5,.58);
  --line: rgba(5,5,5,.09);
  --glass: rgba(255,255,255,.62);
  --shadow: rgba(0,0,0,.12);
  --r: 30;
  --g: 90;
  --b: 180;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  min-height: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app {
  position: fixed;
  inset: 0;
  min-height: 100svh;
  min-height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 46%, rgba(var(--r),var(--g),var(--b),.13), transparent 34%),
    linear-gradient(135deg, #fff 0%, #f4f2eb 100%);
}

#webgl {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}

.glass {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--glass);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: 0 20px 70px var(--shadow);
}

.topbar {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  left: 22px;
  right: 22px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
}

.eyebrow {
  font-size: 11px;
  font-weight: 950;
  letter-spacing: .32em;
  opacity: .58;
}

h1 {
  margin: 5px 0 0;
  font-size: clamp(28px, 4vw, 54px);
  line-height: .9;
  letter-spacing: -.07em;
}

.pill {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.66);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: .12em;
}

.caption {
  position: absolute;
  left: 50%;
  bottom: 98px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 13px;
  width: min(560px, calc(100vw - 36px));
  padding: 14px 16px;
}

.mood-dot {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgb(var(--r), var(--g), var(--b));
  box-shadow: 0 0 24px rgba(var(--r),var(--g),var(--b),.55);
}

.caption strong {
  font-size: 14px;
}

.caption p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.panel {
  position: absolute;
  top: 136px;
  width: 260px;
  padding: 16px;
}

.panel.left { left: 22px; }
.panel.right { right: 22px; }

.panel h2,
.api h2 {
  margin: 0 0 12px;
  font-size: 14px;
  letter-spacing: -.02em;
}

button {
  appearance: none;
  width: 100%;
  border: 1px solid rgba(0,0,0,.055);
  cursor: pointer;
  padding: 11px 13px;
  margin: 0 0 8px;
  border-radius: 16px;
  background: rgba(255,255,255,.48);
  color: rgba(5,5,5,.68);
  font: inherit;
  font-size: 13px;
  font-weight: 850;
  text-align: left;
}

button:hover {
  color: var(--ink);
  background: rgba(255,255,255,.78);
}

.feed {
  display: grid;
  gap: 9px;
  max-height: calc(100vh - 250px);
  overflow: auto;
}

.feed-item {
  border: 1px solid rgba(0,0,0,.05);
  border-radius: 17px;
  padding: 11px;
  background: rgba(255,255,255,.42);
}

.feed-item strong {
  display: block;
  font-size: 12px;
  margin-bottom: 4px;
}

.feed-item p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.42;
}

.api {
  position: absolute;
  left: 22px;
  bottom: 22px;
  max-width: 390px;
  padding: 14px 16px;
}

.api code {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: rgba(5,5,5,.62);
  font-size: 12px;
}

@media (max-width: 980px) {
  .panel,
  .api {
    display: none;
  }

  .topbar {
    left: 16px;
    right: 16px;
  }

  .caption {
    bottom: 24px;
  }
}


#webgl:active { cursor: grabbing; }

.topbar,
.caption,
.panel,
.api {
  z-index: 3;
}

@media (max-width: 1180px) {
  .panel { width: 224px; }
  .panel.left { left: 16px; }
  .panel.right { right: 16px; }
  .api { left: 16px; max-width: 340px; }
}

@media (max-width: 980px) {
  .topbar {
    top: max(62px, env(safe-area-inset-top));
    left: 16px;
    right: 16px;
    align-items: flex-start;
    gap: 12px;
  }

  h1 {
    max-width: 64vw;
    font-size: clamp(25px, 8vw, 42px);
  }

  .pill {
    padding: 8px 10px;
    max-width: 34vw;
    white-space: normal;
    text-align: right;
    line-height: 1.25;
    font-size: 10px;
  }

  .panel.left {
    display: grid;
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: calc(94px + env(safe-area-inset-bottom));
    top: auto;
    width: auto;
    max-height: 31svh;
    padding: 12px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .panel.left h2 {
    grid-column: 1 / -1;
    margin-bottom: 2px;
  }

  .panel.left button {
    margin: 0;
    min-height: 42px;
    padding: 9px 10px;
    text-align: center;
    font-size: 12px;
  }

  .panel.right,
  .api {
    display: none;
  }

  .caption {
    bottom: calc(16px + env(safe-area-inset-bottom));
    width: min(620px, calc(100vw - 28px));
    padding: 12px 14px;
  }
}

@media (max-width: 560px) {
  .topbar {
    top: max(58px, env(safe-area-inset-top));
    left: 12px;
    right: 12px;
  }

  .eyebrow { font-size: 9px; letter-spacing: .22em; }
  h1 { max-width: 58vw; letter-spacing: -.06em; }
  .pill { max-width: 38vw; font-size: 9px; }

  .panel.left {
    left: 10px;
    right: 10px;
    bottom: calc(104px + env(safe-area-inset-bottom));
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 35svh;
  }

  .caption {
    left: 10px;
    right: 10px;
    transform: none;
    width: auto;
    gap: 10px;
  }

  .caption p {
    font-size: 12px;
  }
}

@media (max-height: 680px) and (max-width: 980px) {
  .topbar { top: max(54px, env(safe-area-inset-top)); }
  .panel.left {
    grid-template-columns: repeat(4, minmax(96px, 1fr));
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    max-height: none;
    bottom: calc(86px + env(safe-area-inset-bottom));
  }
  .panel.left h2 { display: none; }
  .panel.left button { flex: 0 0 auto; min-width: 118px; }
  .caption { bottom: calc(12px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  #webgl { cursor: default; }
}
