:root {
  color-scheme: dark;
  font-family: "SF Pro Rounded", "SF Pro Display", "Avenir Next", "Inter", "Helvetica Neue", Arial, sans-serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100svh;
  background: #000;
  color: #f7f8fb;
  overflow: hidden;
}
.app {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
.brand {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
  width: 100%;
}
.brand-title {
  font-size: 22px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #e7e9ee;
  white-space: nowrap;
  width: 100%;
  overflow: hidden;
  text-align: center;
}
.brand-subtitle {
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8a93a6;
  overflow: hidden;
  white-space: nowrap;
}
.brand-subtitle .marquee {
  display: inline-flex;
  align-items: center;
  gap: 36px;
  white-space: nowrap;
  animation: titleScroll 18s linear infinite;
  will-change: transform;
}
.brand-divider {
  width: 100%;
  height: 1px;
  background: rgba(255, 255, 255, 0.16);
  margin-top: 6px;
}
.menu {
  position: relative;
  display: flex;
  justify-content: flex-end;
}
.menu-button {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #f7f8fb;
  font-size: 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.menu-open #menuButton {
  opacity: 0;
  pointer-events: none;
}
.status {
  font-size: 12px;
  color: #9aa4c7;
  display: flex;
  align-items: center;
  gap: 8px;
}
.status .icon {
  font-size: 14px;
}
.auth-panel {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}
.auth-panel.hidden {
  display: none;
}
.auth-status {
  font-size: 12px;
  color: #b5bfe3;
}
.auth-button {
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  background: #1d9bf0;
  color: #fff;
  cursor: pointer;
}
.auth-button.secondary {
  background: rgba(255, 255, 255, 0.12);
  color: #f2f4ff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.login-prompt {
  display: none;
  flex: 1;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  gap: 12px;
  flex-direction: column;
}
.login-prompt p {
  margin: 0;
  font-size: 14px;
  color: #c5cee8;
}
.email-modal {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 6, 12, 0.92);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 18;
  border-radius: 28px;
  padding: 24px;
}
.email-modal.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.email-card {
  width: min(420px, 100%);
  background: rgba(20, 22, 30, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.55);
}
.email-card h2 {
  margin: 0;
  font-size: 20px;
}
.email-card p {
  margin: 0;
  font-size: 13px;
  color: #b8c1de;
}
.email-card form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.email-card input {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.05);
  color: #f7f8fb;
  font-size: 14px;
}
.email-card input:focus {
  outline: none;
  border-color: rgba(29, 155, 240, 0.8);
  box-shadow: 0 0 0 3px rgba(29, 155, 240, 0.2);
}
.email-error {
  min-height: 18px;
  color: #ff9aa2;
  font-size: 12px;
}
.paywall-modal,
.limit-modal {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 6, 12, 0.92);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 19;
  border-radius: 28px;
  padding: 24px;
}
.paywall-modal.open,
.limit-modal.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.paywall-card,
.limit-card {
  width: min(420px, 100%);
  background: rgba(20, 22, 30, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
  position: relative;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.55);
}
.paywall-card h2,
.limit-card h2 {
  margin: 0;
  font-size: 20px;
}
.paywall-card p,
.limit-card p {
  margin: 0;
  font-size: 13px;
  color: #b8c1de;
}
.paywall-close {
  position: absolute;
  top: 12px;
  right: 12px;
}
.unauthenticated .status,
.unauthenticated .brand,
.unauthenticated .story-header,
.unauthenticated .story-author,
.unauthenticated .story-content,
.unauthenticated .story-controls {
  display: none;
}
.unauthenticated .menu {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 20;
}
.unauthenticated .login-prompt {
  display: flex;
}
@keyframes titleScroll {
  0% {
    transform: translate3d(0, 0, 0);
  }
  100% {
    transform: translate3d(-50%, 0, 0);
  }
}
.story-area {
  flex: 1;
  padding: 6px 12px 16px;
  display: flex;
  align-items: stretch;
  justify-content: center;
}
.story-card {
  width: 100%;
  max-width: 760px;
  height: min(100svh - 170px, 900px);
  padding: 26px 24px 20px;
  border-radius: 28px;
  background: linear-gradient(160deg, rgba(13, 13, 16, 0.98), rgba(8, 8, 10, 0.92));
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  gap: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
}
.player-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.menu-panel {
  position: absolute;
  inset: 0;
  background: rgba(6, 8, 16, 0.98);
  border-radius: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 28px 24px;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 15;
}
.menu-panel a,
.menu-panel button {
  font-size: 16px;
  font-weight: 600;
}
.menu-panel .menu-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}
.menu-panel .menu-close {
  align-self: flex-end;
}
.menu-panel .menu-link {
  color: #e7ecff;
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
}
.menu-panel .menu-action-button {
  padding: 10px 14px;
  border-radius: 12px;
  text-align: left;
}
.menu-panel .menu-link:hover {
  background: rgba(29, 155, 240, 0.18);
}
.menu-panel .menu-button-secondary {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  color: #f5f7ff;
}
.menu-panel .menu-button-primary {
  border: none;
  background: #1d9bf0;
  color: #fff;
}
.menu-open .menu-panel {
  transform: translateX(0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.menu-panel .logout {
  margin-top: auto;
}
.player-header-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.story-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.badge {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(29, 155, 240, 0.16);
  color: #cfe8ff;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.badge::before {
  content: "🧭";
  font-size: 12px;
}
.timestamp {
  font-size: 12px;
  color: #97a3cc;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.timestamp::before {
  content: "⏱️";
  font-size: 12px;
}
.story-author {
  font-size: 24px;
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.story-author::before {
  content: "👤";
  font-size: 20px;
}
.story-author-handle {
  font-size: 16px;
  color: #9fb0ff;
  font-weight: 500;
}
.story-text {
  font-size: 18px;
  line-height: 1.75;
  color: #e8ecf2;
}

.upload-page .story-text {
  white-space: pre-wrap;
}

.story-text .word {
  opacity: 0.45;
  transition: opacity 0.2s ease, color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  display: inline-block;
  padding: 2px 5px;
  border-radius: 8px;
}
.story-text .word.active {
  opacity: 1;
  color: #ffffff;
  background: rgba(29, 155, 240, 0.24);
  box-shadow: 0 0 16px rgba(29, 155, 240, 0.35);
}
.story-text .word.spoken {
  opacity: 0.72;
}
.story-content {
  flex: 1;
  overflow-y: auto;
  padding-right: 6px;
  scroll-behavior: smooth;
}
.story-content::-webkit-scrollbar {
  width: 6px;
}
.story-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
}
.story-link {
  font-size: 13px;
  color: #1d9bf0;
  word-break: break-all;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.story-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}
.story-links a {
  font-size: 13px;
  color: #93c5ff;
  text-decoration: none;
  word-break: break-all;
}
.story-links a::before {
  content: "🔗";
  margin-right: 6px;
}
.story-link::before {
  content: "↗";
  font-size: 12px;
}
.story-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: center;
}
.pill {
  border: none;
  border-radius: 999px;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.08);
  color: #f5f7ff;
}
.pill.primary {
  background: #1d9bf0;
  color: #fff;
}
.player-controls {
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.player-button {
  min-width: 54px;
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.1);
  color: #f5f7ff;
}
.player-button.primary {
  background: #1d9bf0;
  color: #fff;
}
.player-button.secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.player-controls .player-button span {
  font-size: 18px;
  line-height: 1;
}
.upload-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.text-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.text-modal.is-visible {
  display: flex;
}
.text-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 6, 12, 0.82);
  backdrop-filter: blur(6px);
}
.text-modal-card {
  position: relative;
  width: min(720px, 92vw);
  background: rgba(12, 14, 20, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.55);
}
.text-modal-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.text-modal-header h2 {
  margin: 0 0 6px;
  font-size: 20px;
}
.text-modal-header p {
  margin: 0;
  font-size: 13px;
  color: #aab6d9;
}
.text-modal-card textarea {
  min-height: 180px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #f6f7ff;
  padding: 14px;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
}
.text-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}
@media (min-width: 768px) {
  .story-card {
    height: min(100svh - 190px, 820px);
  }
}
@media (max-width: 600px) {
  .story-card {
    height: min(100svh - 160px, 760px);
    padding: 22px 18px 18px;
  }
  .menu-panel {
    border-radius: 24px;
    padding: 22px 18px;
  }
  .story-author {
    font-size: 20px;
  }
  .story-controls {
    position: sticky;
    bottom: 12px;
    padding-bottom: env(safe-area-inset-bottom);
    background: linear-gradient(180deg, rgba(10, 10, 12, 0), rgba(10, 10, 12, 0.85) 60%);
  }
}
