:root {
  --champagne: #f8e7b4;
  --gold: #e2b34a;
  --antique: #c48a22;
  --bronze: #7a4e12;
  --ink: #3a250c;
  --spark: #fff9ec;
  --well: #2c1a08;
  --heart: #9e2438;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100dvh;
  color: var(--ink);
  font-family: "Atkinson Hyperlegible", "Avenir Next", sans-serif;
  font-size: 1.05rem;
  line-height: 1.45;
  background: #e0a010;
}

.sky {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.gold,
.dust,
.glints,
.fade {
  position: absolute;
  inset: 0;
}

.gold {
  background: linear-gradient(
    180deg,
    #ffe566 0%,
    #f6c21a 35%,
    #f0b000 70%,
    #e8a40c 92%,
    #c98408 100%
  );
}

.dust canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.fade {
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0) 90%,
    rgba(0, 0, 0, 0.1) 96%,
    rgba(0, 0, 0, 0.22) 100%
  );
}

.glint {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  background: #fff8dc;
  opacity: 0;
  box-shadow: 0 0 4px rgba(255, 236, 170, 0.85);
}

.glint.warm {
  background: #ffd15a;
}

.glint.star {
  border-radius: 0;
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
}

.sheet {
  position: relative;
  width: min(28rem, calc(100% - 2rem));
  margin: 0 auto;
  padding: calc(1.25rem + env(safe-area-inset-top)) 0 calc(1.5rem + env(safe-area-inset-bottom));
}

.mast {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.6rem 1rem;
}

.who {
  display: inline-flex;
  align-items: baseline;
  gap: 0.9rem;
}

.mark {
  margin: 0;
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font-family: Syne, "Avenir Next", sans-serif;
  font-weight: 800;
  font-size: 1.65rem;
  letter-spacing: -0.04em;
  cursor: pointer;
  padding: 0;
}

.for {
  margin: 0;
  color: var(--ink);
  font-size: 0.92rem;
}

#invite,
#logout,
#notices,
#play-open,
#radio-open,
#messages,
#me,
#feed,
#feed-back {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
}

.stage {
  position: relative;
  margin-top: 1rem;
  height: min(70dvh, calc(100svh - 16rem));
  min-height: 14rem;
  border-radius: 1.6rem;
  overflow: hidden;
  color: var(--spark);
  background:
    radial-gradient(circle at 50% 18%, rgba(248, 231, 180, 0.16), transparent 36%),
    linear-gradient(180deg, #4a2e0c 0%, var(--well) 70%);
  box-shadow:
    0 28px 50px rgba(58, 32, 8, 0.28),
    inset 0 0 0 1px rgba(255, 236, 190, 0.28);
}

.gate-form,
.empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.5rem;
}

.gate-form {
  gap: 0.45rem;
}

h1,
.dialog-title {
  margin: 0;
  font-family: Syne, "Avenir Next", sans-serif;
  font-weight: 700;
  letter-spacing: -0.04em;
}

h1 {
  max-width: 11ch;
  font-size: clamp(2.2rem, 8vw, 3.2rem);
  line-height: 0.95;
}

.empty p,
#gate-copy,
.hint,
.gate-error {
  margin: 0;
}

#gate-copy,
.empty p {
  max-width: 32ch;
  color: var(--champagne);
}

.hint,
.gate-error {
  color: var(--champagne);
  font-size: 0.88rem;
}

.gate-error:empty {
  display: none;
}

.gate-form label,
#invite-form label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.92rem;
}

.gate-form label {
  color: var(--champagne);
}

.gate-form input,
#invite-form input,
#comment-text {
  width: 100%;
  border: 1px solid rgba(122, 78, 18, 0.35);
  border-radius: 999px;
  font: inherit;
  padding: 0.7rem 0.9rem;
}

.gate-form input {
  border: 1px solid rgba(248, 231, 180, 0.45);
  background: rgba(255, 249, 236, 0.12);
  color: var(--spark);
}

.feed {
  height: 100%;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
}

.post {
  position: relative;
  height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.post img,
.post video,
.filter-preview img,
.filter-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #1a1006;
}

.fx {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.fx-grain {
  opacity: 0.45;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.55) 0.5px, transparent 0.7px);
  background-size: 3px 4px;
  mix-blend-mode: overlay;
}

.fx-sparkle {
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 249, 236, 0.95) 0 1px, transparent 2px),
    radial-gradient(circle at 70% 22%, rgba(255, 249, 236, 0.9) 0 1.5px, transparent 3px),
    radial-gradient(circle at 40% 68%, rgba(255, 249, 236, 0.85) 0 1px, transparent 2px),
    radial-gradient(circle at 82% 74%, rgba(255, 249, 236, 0.9) 0 1.5px, transparent 3px);
}

.actions {
  position: absolute;
  right: 0.8rem;
  bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.actions button {
  width: 3.1rem;
  min-height: 3.1rem;
  padding: 0.35rem 0.2rem;
  border-radius: 999px;
  background: rgba(44, 26, 8, 0.45);
  color: var(--spark);
  font-size: 0.78rem;
  line-height: 1.1;
}

.actions button[aria-pressed="true"] {
  background: var(--heart);
}

.remove {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: rgba(44, 26, 8, 0.45);
  color: var(--spark);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
}

.sound {
  position: absolute;
  left: 1rem;
  bottom: 2.7rem;
  margin: 0;
  color: var(--spark);
  font-size: 0.85rem;
  font-weight: 700;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
}

.byline {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  margin: 0;
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-align: left;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  padding: 0;
}

.profile {
  margin-top: 1rem;
}

.profile-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.profile h1 {
  max-width: none;
  font-size: clamp(2rem, 8vw, 2.8rem);
}

.profile-count,
.profile-empty p {
  margin: 0.15rem 0 0.8rem;
  color: var(--ink);
  font-weight: 700;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.2rem;
}

.tile {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: #2c1a08;
  cursor: pointer;
}

.tile img,
.tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

.tile-kind {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  color: var(--spark);
  font-size: 0.72rem;
  font-weight: 700;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}

.share,
.gate-form button,
dialog button,
.camera-bar button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--spark);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.gate-form button {
  margin-top: 0.35rem;
  padding: 0.8rem 1rem;
  background: var(--spark);
  color: var(--ink);
}

.share,
dialog button,
.camera-bar button {
  display: block;
  width: 100%;
  margin-top: 0.6rem;
  padding: 0.75rem 1rem;
}

.share {
  margin-top: 1rem;
  padding: 0.85rem 1.15rem;
}

dialog button.quiet,
.camera-bar button.quiet {
  background: transparent;
  color: var(--bronze);
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--antique);
  outline-offset: 3px;
}

.fine {
  margin: 0.6rem 0 0;
  color: var(--bronze);
  font-size: 0.92rem;
}

.install {
  margin-top: 1rem;
  padding: 1rem 1rem 0.85rem;
  border-radius: 1.2rem;
  background: var(--spark);
  color: var(--ink);
  box-shadow: 0 16px 36px rgba(58, 32, 8, 0.16);
}

.install p {
  margin: 0;
}

.install button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--spark);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

#install-now {
  display: block;
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
}

.install button.quiet {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  background: transparent;
  color: var(--bronze);
}

dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(22rem, calc(100% - 2rem));
  max-height: calc(100svh - 2rem);
  margin: 0;
  overflow: auto;
  padding: 1.1rem;
  border: 0;
  border-radius: 1.2rem;
  background: var(--spark);
  color: var(--ink);
}

.capture-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  margin-top: 0.8rem;
}

.capture-bar button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  margin: 0;
  padding: 0.75rem 0.6rem;
  background: var(--ink);
  color: var(--spark);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

dialog::backdrop {
  background: rgba(44, 26, 8, 0.5);
}

.dialog-title {
  font-size: 1.4rem;
}

#invite-form {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.8rem;
}

#invite-form button {
  margin-top: 0.2rem;
}

#invite-result {
  margin: 0.7rem 0 0;
}

#people,
#notice-list {
  margin: 0.8rem 0 0;
  padding-left: 1.1rem;
}

#people {
  list-style: none;
  padding-left: 0;
}

#people .person {
  width: auto;
  margin: 0 0 0.45rem;
  padding: 0;
  background: transparent;
  color: var(--ink);
}

#notice-list {
  list-style: none;
  padding-left: 0;
  max-height: 40dvh;
  overflow: auto;
}

#notice-list li {
  margin: 0 0 0.6rem;
}

#filters {
  width: min(42rem, calc(100vw - 1rem));
}

.filter-preview {
  position: relative;
  height: min(34dvh, 22rem);
  margin-top: 0.8rem;
  border-radius: 1rem;
  overflow: hidden;
  background: var(--well);
  touch-action: none;
}

.filter-preview img,
.filter-preview video,
.filter-preview canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.edit-tabs {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.65rem;
}

#filters .edit-tabs button {
  flex: 1;
  width: auto;
  margin: 0;
  padding: 0.45rem 0.2rem;
  background: transparent;
  color: var(--ink);
  border: 1px solid rgba(122, 78, 18, 0.4);
  font-size: 0.95rem;
}

#filters .edit-tabs button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--spark);
}

.edit-hint {
  margin: 0.45rem 0 0;
  color: var(--bronze);
  font-size: 0.92rem;
}

.color-row {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.55rem;
}

#filters .color-row button {
  width: 1.8rem;
  height: 1.8rem;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(58, 37, 12, 0.25);
}

#filters .color-row button[aria-pressed="true"] {
  border-color: var(--ink);
}

.edit-slider {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.55rem;
  font-weight: 700;
}

.edit-slider span {
  min-width: 3.2rem;
}

.edit-slider input {
  flex: 1;
  accent-color: var(--ink);
}

.edit-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

#filters .edit-actions button {
  margin-top: 0.45rem;
}

.edit-foot {
  position: sticky;
  bottom: -1.1rem;
  margin: 0.35rem -1.1rem -1.1rem;
  padding: 0.35rem 1.1rem 1rem;
  background: var(--spark);
}

.filter-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.4rem;
  margin-top: 0.7rem;
  overflow-x: auto;
  padding-bottom: 0.2rem;
}

dialog .filter-row button {
  flex: 0 0 auto;
  width: auto;
  margin: 0;
  padding: 0.4rem 0.7rem;
  background: transparent;
  color: var(--ink);
  border: 1px solid rgba(122, 78, 18, 0.4);
}

dialog .filter-row button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--spark);
}

#comment-list {
  list-style: none;
  margin: 0.8rem 0 0;
  padding: 0;
  max-height: 36dvh;
  overflow: auto;
}

#comment-list li {
  margin: 0 0 0.55rem;
}

#comment-form {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.8rem;
}

#comment-text {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(122, 78, 18, 0.35);
  background: #fff;
  color: var(--ink);
}

#comment-form button {
  width: auto;
  margin-top: 0;
}

.camera {
  position: fixed;
  inset: 0;
  z-index: 5;
  background: #1a1006;
  display: flex;
  flex-direction: column;
}

.camera[hidden] {
  display: none;
}

#preview {
  flex: 1;
  width: 100%;
  object-fit: cover;
  background: #1a1006;
}

.camera-bar {
  display: flex;
  gap: 0.6rem;
  padding: 0.8rem 1rem calc(0.8rem + env(safe-area-inset-bottom));
  background: var(--well);
}

.camera-bar button {
  margin-top: 0;
}

.f-smooth { filter: blur(0.6px) brightness(1.12) contrast(0.88) saturate(1.08); }
.f-cool { filter: saturate(1.2) hue-rotate(16deg) contrast(1.06) brightness(1.04); }
.f-fade { filter: contrast(0.82) brightness(1.14) saturate(0.75) sepia(0.18); }
.f-comic { filter: contrast(1.45) saturate(1.65); }
.f-rainbow { filter: saturate(1.4) contrast(1.04); }
.f-bubblegum { filter: saturate(1.25) hue-rotate(-16deg) brightness(1.06); }
.f-sunny { filter: sepia(0.22) saturate(1.35) brightness(1.08); }
.f-stars { filter: brightness(1.06) saturate(1.2); }
.f-hearts { filter: saturate(1.15) hue-rotate(-6deg) brightness(1.04); }
.f-warm { filter: sepia(0.5) saturate(1.45) hue-rotate(-8deg) contrast(1.04); }
.f-soft { filter: brightness(1.14) contrast(0.86) saturate(0.9); }
.f-bw { filter: grayscale(1) contrast(1.08); }
.f-sparkle { filter: brightness(1.08) saturate(1.3) contrast(1.06); }
.f-grain { filter: saturate(0.72) contrast(1.08) sepia(0.12); }
.f-pop { filter: saturate(1.8) contrast(1.2); }

.fx-rainbow {
  background: linear-gradient(
    120deg,
    rgba(255, 70, 90, 0.32),
    rgba(255, 180, 40, 0.26),
    rgba(255, 230, 70, 0.22),
    rgba(70, 210, 90, 0.24),
    rgba(50, 140, 255, 0.28),
    rgba(180, 70, 255, 0.32)
  );
}

.fx-bubblegum {
  background: rgba(255, 79, 163, 0.28);
}

.fx-sunny {
  background: rgba(255, 196, 40, 0.22);
}

.fx-stars {
  background-image:
    radial-gradient(circle, rgba(255, 248, 210, 0.95) 1.2px, transparent 1.6px),
    radial-gradient(circle, rgba(255, 214, 70, 0.9) 1px, transparent 1.5px);
  background-size: 46px 52px, 70px 64px;
  background-position: 8px 12px, 28px 36px;
}

.fx-hearts {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cpath fill='%23ff477e' fill-opacity='0.8' d='M32 54C14 40 8 30 8 22a12 12 0 0 1 22-6 12 12 0 0 1 22 6c0 8-6 18-20 32z'/%3E%3C/svg%3E");
  background-size: 54px 54px;
  background-repeat: repeat;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .glint {
    animation: glint var(--dur) ease-in-out infinite;
    animation-delay: var(--d);
  }
}

@media (prefers-reduced-motion: reduce) {
  .glint {
    opacity: 0.35;
  }
}

@media (prefers-reduced-motion: reduce) {
  .feed {
    scroll-behavior: auto;
  }
}

#talk {
  display: flex;
  flex-direction: column;
  margin-top: 1rem;
  height: min(70dvh, calc(100svh - 16rem));
  min-height: 18rem;
  border-radius: 1.6rem;
  overflow: hidden;
  color: var(--spark);
  background:
    radial-gradient(circle at 50% 12%, rgba(248, 231, 180, 0.16), transparent 34%),
    linear-gradient(180deg, #4a2e0c 0%, var(--well) 72%);
  box-shadow:
    0 28px 50px rgba(58, 32, 8, 0.28),
    inset 0 0 0 1px rgba(255, 236, 190, 0.28);
}

#talk-list,
#thread {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

#talk-close,
#thread-back {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--champagne);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0.85rem 1rem 0;
  text-align: left;
}

#talk h1,
#thread-title {
  margin: 0.2rem 1rem 0.4rem;
  color: var(--spark);
}

#threads {
  list-style: none;
  margin: 0;
  padding: 0.2rem 0.45rem 0.8rem;
  overflow: auto;
}

#threads button {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.75rem 0.7rem;
  border: 0;
  border-radius: 1rem;
  background: transparent;
  color: var(--spark);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

#threads button strong {
  font-family: Syne, "Avenir Next", sans-serif;
  font-weight: 700;
}

#threads .preview {
  display: block;
  margin-top: 0.15rem;
  color: var(--champagne);
  font-size: 0.92rem;
}

#threads button[data-unread="true"] strong::after {
  content: "";
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  margin-left: 0.4rem;
  border-radius: 50%;
  background: var(--gold);
  vertical-align: 0.1rem;
}

.thread-bar {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  padding-right: 0.9rem;
}

.thread-bar h2 {
  flex: 1;
  min-width: 0;
  font-size: 1.35rem;
}

#thread-calls {
  display: inline-flex;
  gap: 0.75rem;
}

#thread-calls button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--champagne);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

#thread-empty {
  margin: 0.4rem 1rem 0;
  color: var(--champagne);
}

#thread-log {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0.85rem 0.8rem;
  overflow: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.bubble {
  max-width: 82%;
  margin: 0;
  padding: 0.45rem 0.75rem 0.5rem;
  border-radius: 1rem 1rem 1rem 0.35rem;
  background: rgba(248, 231, 180, 0.14);
}

.bubble.mine {
  margin-left: auto;
  border-radius: 1rem 1rem 0.35rem 1rem;
  background: var(--spark);
  color: var(--ink);
}

.bubble b {
  display: block;
  font-family: Syne, "Avenir Next", sans-serif;
  font-size: 0.82rem;
}

.bubble.mine b {
  color: var(--bronze);
}

.bubble time {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.75rem;
  opacity: 0.7;
}

#thread-form {
  padding: 0.35rem 0.7rem 0.7rem;
}

#attach-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  margin: 0 0.15rem 0.35rem;
  color: var(--champagne);
  font-size: 0.92rem;
}

#attach-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#attach-clear {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--champagne);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.composer {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

#thread-text {
  flex: 1;
  min-width: 0;
  border: 0;
  border-radius: 999px;
  padding: 0.7rem 0.85rem;
  background: var(--spark);
  color: var(--ink);
  font: inherit;
}

.composer .attach,
#thread-form button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  width: auto;
  margin: 0;
  padding: 0.7rem 0.85rem;
  background: var(--spark);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.bubble img {
  display: block;
  width: min(100%, 14rem);
  margin-top: 0.35rem;
  border-radius: 0.75rem;
}

.bubble a {
  display: inline-block;
  margin-top: 0.3rem;
  color: inherit;
  font-weight: 700;
}

.bubble-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.35rem;
}

.bubble-actions button {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

#thread-error,
#call-error {
  min-height: 1.2rem;
  margin: 0 0.9rem 0.6rem;
  color: #ffd0d6;
  font-size: 0.92rem;
}

dialog#ring,
dialog#call {
  top: 0;
  left: 0;
  transform: none;
  width: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border-radius: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 18%, rgba(248, 231, 180, 0.18), transparent 36%),
    linear-gradient(180deg, #4a2e0c 0%, var(--well) 70%);
  color: var(--spark);
}

.ring-card,
.call-card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
  padding: calc(1.5rem + env(safe-area-inset-top)) 1.25rem calc(1.4rem + env(safe-area-inset-bottom));
}

#ring-copy,
#call-copy {
  margin: 0 0 1rem;
  max-width: 12ch;
  font-family: Syne, "Avenir Next", sans-serif;
  font-weight: 700;
  font-size: clamp(2.2rem, 8vw, 3.2rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
}

#remote-video,
#local-video {
  position: absolute;
  background: #1a0e04;
}

#remote-video {
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#local-video {
  top: calc(0.8rem + env(safe-area-inset-top));
  right: 0.8rem;
  width: 7.2rem;
  aspect-ratio: 3 / 4;
  height: auto;
  object-fit: cover;
  border-radius: 1rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

dialog#call.audio #remote-video,
dialog#call.audio #local-video {
  display: none;
}

.call-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

dialog#call .call-actions button {
  margin-top: 0;
}

#play {
  position: fixed;
  inset: 0;
  z-index: 24;
  background: #0d1a26;
}

#gold-ball {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.play-hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: calc(0.8rem + env(safe-area-inset-top)) 0.9rem 0;
  pointer-events: none;
  color: #fff;
}

.play-hud button {
  pointer-events: auto;
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: rgba(10, 16, 24, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0.5rem 0.95rem;
}

.play-level {
  display: flex;
  align-items: center;
  justify-self: center;
  width: min(15rem, 100%);
}

.play-badge {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 3.1rem;
  height: 3.3rem;
  margin-right: -0.6rem;
  clip-path: polygon(50% 0, 100% 16%, 100% 70%, 50% 100%, 0 70%, 0 16%);
  background: linear-gradient(180deg, #fff1b8 0%, #f5c33b 45%, #b97810 100%);
  color: #3a250c;
  text-align: center;
  line-height: 1;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.35));
}

.play-badge small {
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.play-badge b {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: 1.15rem;
  font-weight: 800;
}

.play-bar {
  flex: 1;
  height: 0.8rem;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35), 0 2px 8px rgba(0, 0, 0, 0.25);
}

#play-progress {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #ffe48a, #f5b51e);
  transform-origin: left center;
  transform: scaleX(0);
}

.play-gold {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0.35rem 0.75rem 0.35rem 0.4rem;
  border-radius: 999px;
  background: rgba(10, 16, 24, 0.5);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.play-coin {
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6c9, #f5c33b 45%, #a86a0c);
  box-shadow: inset 0 0 0 2px rgba(122, 74, 0, 0.35);
}

#play-score {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.play-card {
  position: absolute;
  left: 50%;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(25rem, calc(100% - 1.6rem));
  padding: 1.15rem 1.1rem 1.05rem;
  border-radius: 1.5rem;
  background: rgba(14, 20, 30, 0.62);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16), 0 24px 50px rgba(0, 0, 0, 0.35);
  color: #fff;
}

.play-card h1 {
  max-width: none;
  font-size: clamp(2rem, 8vw, 2.8rem);
  background: linear-gradient(180deg, #fff6d0, #f5c33b 60%, #d1901b);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.play-card p {
  margin: 0.4rem 0 0;
  color: rgba(255, 255, 255, 0.86);
}

#play-best {
  color: #ffd76a;
  font-weight: 700;
}

#play-best:empty {
  display: none;
}

.play-courses {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  margin-top: 0.8rem;
}

.play-card .play-courses button {
  display: grid;
  grid-template-columns: 2.2rem 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.55rem;
  align-items: center;
  width: 100%;
  margin: 0;
  padding: 0.45rem 0.5rem;
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  color: #fff;
  text-align: left;
}

.play-card .play-courses button[aria-pressed="true"] {
  background: rgba(245, 195, 59, 0.2);
  box-shadow: inset 0 0 0 2px #f5c33b;
}

.play-swatch {
  grid-row: span 2;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 0.6rem;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
}

.play-course-name {
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.1;
}

.play-course-level {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.78rem;
}

.play-card > button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  display: block;
  width: 100%;
  margin-top: 0.9rem;
  padding: 0.85rem 1rem;
  background: linear-gradient(180deg, #ffe48a, #f5b51e 60%, #d9930f);
  color: #3a250c;
  font: inherit;
  font-weight: 800;
  font-size: 1.05rem;
  cursor: pointer;
  box-shadow: 0 4px 0 #9c6408, 0 10px 20px rgba(0, 0, 0, 0.3);
}

.play-card > button:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #9c6408, 0 6px 14px rgba(0, 0, 0, 0.3);
}

.play-card button:focus-visible,
.play-hud button:focus-visible {
  outline: 2px solid #ffe48a;
  outline-offset: 3px;
}

@keyframes glint {
  0%,
  100% {
    opacity: 0;
    transform: scale(0.3);
  }
  45% {
    opacity: var(--peak);
    transform: scale(1);
  }
}
