:root {
  --bg: #0d0b1a;
  --panel: #1a1633;
  --text: #eceaf7;
  --muted: #9a96b8;
  --violet: #7c4dff;
  --ice: #9ef0ff;
  --heart: #ff4d7d;
  --line: rgba(236, 234, 247, 0.14);
  --glass: rgba(22, 18, 42, 0.58);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  box-sizing: border-box;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 24px;
  background: linear-gradient(to bottom, rgba(13, 11, 26, 0.85), transparent);
  pointer-events: none;
}

.topbar > * { pointer-events: auto; }

.logo {
  font-family: "Unbounded", system-ui, sans-serif;
  font-weight: 900;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.logo span {
  font-weight: 700;
  color: var(--ice);
  margin-left: 2px;
}

.top-actions { display: flex; gap: 8px; }

.btn {
  border: 1px solid rgba(236, 234, 247, 0.35);
  background: rgba(13, 11, 26, 0.55);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 999px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(6px);
}

.btn:hover { border-color: var(--ice); }
.btn:focus-visible, .icon-btn:focus-visible, input:focus-visible { outline: 2px solid var(--ice); outline-offset: 2px; }

.btn-solid {
  background: var(--violet);
  border-color: var(--violet);
}

.btn-solid:hover { background: #6a3df0; }

.feed {
  height: 100dvh;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
}

.feed::-webkit-scrollbar { display: none; }

.card {
  position: relative;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  background: #000;
  overflow: hidden;
}

.card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-broken {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 5.5rem 2rem 2rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.8);
  background: #000;
  pointer-events: none;
}

.paused-flag {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  color: rgba(255, 255, 255, 0.85);
  pointer-events: none;
}

.card.is-paused .paused-flag { display: flex; }

.overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 48px 16px calc(env(safe-area-inset-bottom, 0px) + 24px);
  background: linear-gradient(to top, rgba(13, 11, 26, 0.9), transparent);
  pointer-events: none;
}

.meta { min-width: 0; }

.author {
  display: block;
  font-size: 1rem;
  margin-bottom: 4px;
}

.caption {
  font-size: 0.92rem;
  line-height: 1.4;
  color: var(--text);
  overflow-wrap: anywhere;
}

.actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  pointer-events: auto;
}

.icon-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.icon-btn .glyph {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(26, 22, 51, 0.8);
  font-size: 1.4rem;
  transition: transform 0.15s ease, color 0.15s ease;
}

.icon-btn:active .glyph { transform: scale(0.88); }
.icon-btn.liked .glyph { color: var(--heart); transform: scale(1.08); }

.empty {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--muted);
  text-align: center;
  pointer-events: none;
}

.empty.show { display: flex; }

.dialog {
  margin: auto;
  width: min(92vw, 420px);
  padding: 22px;
  border: 1px solid rgba(124, 77, 255, 0.5);
  border-radius: 20px;
  background: var(--panel);
  color: var(--text);
}

.dialog::backdrop { background: rgba(5, 4, 12, 0.7); }

.dialog h2 {
  font-family: "Unbounded", system-ui, sans-serif;
  font-size: 1.1rem;
  margin-bottom: 16px;
}

.dialog label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 14px;
}

.dialog input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(236, 234, 247, 0.2);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

.form-error { color: var(--heart); font-size: 0.85rem; margin-bottom: 10px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
  transform: translate(-50%, 20px);
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--violet);
  font-size: 0.85rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 30;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

html:has(.auth-page), .auth-page {
  overflow-y: auto;
}

.auth-wrap {
  width: min(92vw, 400px);
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 40px) 0 40px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.auth-logo {
  font-size: 1.6rem;
  color: var(--text);
  text-decoration: none;
  text-align: center;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--panel);
  border-radius: 999px;
  padding: 4px;
}

.tab {
  border: none;
  background: none;
  color: var(--muted);
  padding: 10px;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.tab.active {
  background: var(--violet);
  color: var(--text);
}

.tab:focus-visible, .link-btn:focus-visible, .back-link:focus-visible { outline: 2px solid var(--ice); outline-offset: 2px; }

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-form label {
  font-size: 0.85rem;
  color: var(--muted);
}

.auth-form input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(236, 234, 247, 0.2);
  background: var(--panel);
  color: var(--text);
  font: inherit;
}

.auth-form .form-error { margin: 0; }

.btn-wide {
  width: 100%;
  padding: 12px 14px;
  text-align: center;
}

.btn:disabled { opacity: 0.6; cursor: wait; }

.link-btn {
  background: none;
  border: none;
  color: var(--ice);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  align-self: center;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.85rem;
}

.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(236, 234, 247, 0.15);
}

.back-link {
  color: var(--muted);
  text-align: center;
  font-size: 0.85rem;
}

.auth-view {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: var(--bg);
  overflow-y: auto;
}

button.back-link {
  background: none;
  border: none;
  font: inherit;
  cursor: pointer;
}

.settings-name {
  text-align: center;
  color: var(--muted);
}

.form-error.ok {
  color: var(--ice);
}

.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100vw, 480px);
  height: 65dvh;
  z-index: 15;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-top: 1px solid rgba(124, 77, 255, 0.5);
  border-radius: 20px 20px 0 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.sheet[hidden] { display: none; }

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
}

.sheet-head h2 {
  font-family: "Unbounded", system-ui, sans-serif;
  font-size: 1rem;
}

.comments-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.comment {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.9rem;
  line-height: 1.4;
}

.comment strong {
  display: block;
  font-size: 0.8rem;
  color: var(--ice);
}

.comment p { overflow-wrap: anywhere; }

.comment-delete {
  align-self: flex-start;
  background: none;
  border: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.comment-delete:focus-visible, .comment-form input:focus-visible { outline: 2px solid var(--ice); outline-offset: 2px; }

.comment-form {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
}

.comment-form input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(236, 234, 247, 0.2);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.empty-note {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 24px 0;
}

.topbar {
  flex-wrap: wrap;
  row-gap: 10px;
}

.topbar .logo { cursor: pointer; }

.searchbar {
  order: 3;
  flex: 1 0 100%;
}

.searchbar input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(236, 234, 247, 0.25);
  background: rgba(13, 11, 26, 0.65);
  color: var(--text);
  font: inherit;
  backdrop-filter: blur(6px);
}

.searchbar input:focus-visible { outline: 2px solid var(--ice); outline-offset: 2px; }

.context {
  order: 4;
  flex: 1 0 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
}

.context[hidden] { display: none; }

.author-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  pointer-events: auto;
}

.author-link:hover { color: var(--ice); }
.author-link:focus-visible { outline: 2px solid var(--ice); outline-offset: 2px; }

.status-badge {
  display: inline-block;
  margin-bottom: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--violet);
}

.status-badge.rejected { background: var(--heart); }

.mod-wrap { width: min(92vw, 560px); }

.mod-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.mod-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  background: var(--panel);
}

.mod-item video {
  width: 100%;
  max-height: 50dvh;
  border-radius: 10px;
  background: #000;
}

.mod-info strong { color: var(--ice); }

.mod-info p {
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.mod-actions { display: flex; gap: 8px; }
.mod-actions .btn { flex: 1; }

.comment { display: block; }

.comment.reply {
  margin-left: 22px;
  padding-left: 12px;
  border-left: 2px solid rgba(124, 77, 255, 0.5);
}

.comment-actions {
  display: flex;
  gap: 14px;
  margin-top: 4px;
}

.comment-reply {
  background: none;
  border: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.comment-reply:hover, .comment-delete:hover { color: var(--text); }
.comment-reply:focus-visible { outline: 2px solid var(--ice); outline-offset: 2px; }

.comment-gif {
  display: block;
  margin-top: 6px;
  max-width: 100%;
  max-height: 160px;
  border-radius: 10px;
}

.comment-draft {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 8px;
}

.draft-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px 4px 10px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid rgba(124, 77, 255, 0.5);
  font-size: 0.8rem;
}

.draft-chip img {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: cover;
}

.draft-remove {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: var(--panel);
  color: var(--text);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.draft-remove:focus-visible { outline: 2px solid var(--ice); outline-offset: 2px; }

.gif-picker {
  max-height: 45%;
  overflow-y: auto;
  padding: 0 16px 8px;
  border-top: 1px solid rgba(236, 234, 247, 0.12);
}

.gif-search { padding: 10px 0; }

.gif-search input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(236, 234, 247, 0.2);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.gif-search input:focus-visible { outline: 2px solid var(--ice); outline-offset: 2px; }

.gif-results {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.gif-results .empty-note { grid-column: 1 / -1; }

.gif-item {
  padding: 0;
  border: none;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
  cursor: pointer;
}

.gif-item img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.gif-item:focus-visible { outline: 2px solid var(--ice); outline-offset: 2px; }

.gif-credit {
  margin-top: 8px;
  text-align: center;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.comment-toggle {
  background: none;
  border: none;
  color: var(--ice);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.comment-toggle:hover { text-decoration: underline; }
.comment-toggle:focus-visible { outline: 2px solid var(--ice); outline-offset: 2px; }

.topbar {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  width: min(100vw, 480px);
}

.searchbar input { padding: 8px 14px; }

.page {
  position: fixed;
  inset: 0;
  z-index: 12;
  background: var(--bg);
  overflow-y: auto;
}

.page[hidden] { display: none; }

.page-inner {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 16px) 16px 40px;
}

.page-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.page-top h2 {
  font-family: "Unbounded", system-ui, sans-serif;
  font-size: 1.05rem;
  overflow-wrap: anywhere;
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--violet), var(--ice));
  color: var(--bg);
  font-family: "Unbounded", system-ui, sans-serif;
  font-size: 1.8rem;
}

.profile-head h3 {
  font-size: 1.2rem;
  overflow-wrap: anywhere;
}

.profile-head p { color: var(--muted); }

.profile-note {
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 0.85rem;
}

.section-title {
  margin: 20px 0 10px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 8px 14px;
  border: 1px solid rgba(124, 77, 255, 0.6);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.chip:hover { border-color: var(--ice); }

.page-search input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid rgba(236, 234, 247, 0.25);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 6px;
}

.grid-item {
  position: relative;
  aspect-ratio: 9 / 16;
  padding: 0;
  border: none;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  color: var(--text);
  cursor: pointer;
}

.grid-item video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.grid-likes {
  position: absolute;
  left: 6px;
  bottom: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

.grid-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  margin: 0;
  padding: 2px 8px;
  font-size: 0.65rem;
}

.grid-item:focus-visible, .chip:focus-visible, .page-search input:focus-visible { outline: 2px solid var(--ice); outline-offset: 2px; }

@media (max-width: 420px) {
  .topbar { padding-left: 12px; padding-right: 12px; }
  .topbar .logo { font-size: 1rem; }
  .btn { padding: 6px 11px; font-size: 0.78rem; }
  .top-actions { gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
}

.video-grid {
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 14px 8px;
}

.grid-card { min-width: 0; }

.grid-item {
  display: block;
  width: 100%;
}

.grid-meta { padding-top: 6px; }

.grid-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.85rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.grid-title.muted { color: var(--muted); }

.grid-author {
  margin-top: 2px;
  padding: 0;
  border: none;
  background: none;
  color: var(--ice);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

.grid-author:hover { text-decoration: underline; }

.hashtag {
  padding: 0;
  border: none;
  background: none;
  color: var(--ice);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  pointer-events: auto;
}

.hashtag:hover { text-decoration: underline; }
.hashtag:focus-visible, .grid-author:focus-visible { outline: 2px solid var(--ice); outline-offset: 2px; }

.avatar { overflow: hidden; }

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

.avatar.sm {
  width: 28px;
  height: 28px;
  font-size: 0.8rem;
}

.author-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.author-row .author { margin-bottom: 0; }

.author-row .avatar {
  cursor: pointer;
  pointer-events: auto;
}

.avatar-edit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.avatar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar-actions .link-btn[hidden] { display: none; }

.chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 8px;
}

.legal-note {
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

.legal-note a, .legal-link { color: var(--ice); }

.legal-link {
  font-size: 0.85rem;
  text-align: center;
}

.danger-zone {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 77, 125, 0.4);
}

.danger-zone h3 {
  color: var(--heart);
  font-size: 1rem;
}

.danger-zone p {
  color: var(--muted);
  font-size: 0.85rem;
}

.danger-zone .form-error { color: var(--heart); }

.btn-danger {
  border-color: var(--heart);
  color: var(--heart);
}

.btn-danger:hover {
  background: var(--heart);
  border-color: var(--heart);
  color: var(--text);
}

.doc {
  width: min(92vw, 720px);
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 32px) 0 60px;
  line-height: 1.65;
}

.doc .auth-logo { display: block; margin-bottom: 24px; }

.doc h1 {
  font-family: "Unbounded", system-ui, sans-serif;
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.doc h2 {
  margin: 28px 0 8px;
  font-size: 1.05rem;
  color: var(--ice);
}

.doc p, .doc li { color: var(--text); }
.doc p { margin-bottom: 10px; }
.doc ul { margin: 0 0 10px 20px; }
.doc li { margin-bottom: 6px; }
.doc .updated { color: var(--muted); font-size: 0.85rem; }
.doc a { color: var(--ice); }
.doc .back-link { display: block; margin-top: 32px; }

.legal-links {
  display: flex;
  justify-content: center;
  gap: 18px;
  font-size: 0.85rem;
}

.legal-links a { color: var(--ice); }

.dialog input[type="file"] {
  padding: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.dialog input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 8px 14px;
  border: 1px solid var(--violet);
  border-radius: 999px;
  background: var(--violet);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.dialog input[type="file"]::file-selector-button:hover { background: #6a3df0; }

.post-hint {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.8rem;
}

.post-time {
  color: var(--muted);
  font-size: 0.75rem;
  white-space: nowrap;
}

.comment-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.author-row .post-time { text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8); }

.grid-meta .post-time {
  display: block;
  margin-top: 2px;
}

.dialog.confirm { width: min(92vw, 360px); }

.confirm-message {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.btn-danger-solid {
  background: var(--heart);
  border-color: var(--heart);
}

.btn-danger-solid:hover {
  background: #e63e6d;
  border-color: #e63e6d;
}

.auth-form textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(236, 234, 247, 0.2);
  background: var(--panel);
  color: var(--text);
  font: inherit;
  resize: vertical;
}

.auth-form textarea:focus-visible { outline: 2px solid var(--ice); outline-offset: 2px; }

.authorize-title {
  font-size: 1.25rem;
  line-height: 1.3;
  text-align: center;
  overflow-wrap: anywhere;
}

.authorize-text {
  margin: 8px 0;
  color: var(--muted);
  text-align: center;
  overflow-wrap: anywhere;
}

.authorize-list { margin: 0 0 8px 22px; }
.authorize-list li { margin-bottom: 4px; }

.authorize-actions {
  display: flex;
  gap: 10px;
  margin: 14px 0 10px;
}

.authorize-actions .btn {
  flex: 1;
  padding: 12px 14px;
}

.dev-app, .secret-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
  padding: 14px;
  border-radius: 16px;
  background: var(--panel);
}

.secret-box { border: 1px solid var(--violet); }

.dev-name { font-size: 1.05rem; overflow-wrap: anywhere; }

.dev-desc {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.code-row { display: flex; flex-direction: column; gap: 4px; }

.code-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.code-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.code-value {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.dev-uris { margin: 0 0 0 20px; font-size: 0.85rem; overflow-wrap: anywhere; }
.dev-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.dev-editor[hidden] { display: none; }

.dev-steps {
  margin: 0 0 14px 22px;
  line-height: 1.55;
}

.dev-steps li { margin-bottom: 8px; }

.dev-pre {
  margin: 4px 0 14px;
  padding: 12px;
  border-radius: 10px;
  background: var(--panel);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre;
}

.dev-docs { margin-top: 28px; }

.docs-link {
  display: inline-block;
  margin-top: 14px;
  color: var(--ice);
  font-weight: 600;
}

.doc code {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--panel);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.85em;
  overflow-wrap: anywhere;
}

.doc .dev-pre { margin: 6px 0 16px; }

.table-wrap {
  margin: 8px 0 16px;
  overflow-x: auto;
}

.doc table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.doc th, .doc td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(236, 234, 247, 0.12);
  text-align: left;
  vertical-align: top;
}

.doc th {
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.context-menu {
  position: fixed;
  z-index: 40;
  min-width: 180px;
  padding: 6px;
  border: 1px solid rgba(124, 77, 255, 0.5);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.context-menu[hidden] { display: none; }

.context-menu button {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.context-menu button:hover, .context-menu button:focus-visible {
  background: rgba(124, 77, 255, 0.3);
  outline: none;
}

.share-dialog { width: min(92vw, 380px); }

.share-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.share-btn {
  padding: 10px 12px;
  text-align: center;
}

.share-link-row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.share-link-row input {
  flex: 1;
  min-width: 0;
  margin-top: 0;
}

.icon-btn.share .glyph svg { display: block; }

.share-btn:last-child:nth-child(odd) { grid-column: 1 / -1; }

.ai-badge {
  display: inline-block;
  margin: 0 6px 6px 0;
  padding: 3px 10px;
  border: 1px solid var(--ice);
  border-radius: 999px;
  background: rgba(13, 11, 26, 0.6);
  color: var(--ice);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.ai-badge[hidden] { display: none; }

.grid-ai {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 2px 7px;
  border: 1px solid var(--ice);
  border-radius: 6px;
  background: rgba(13, 11, 26, 0.75);
  color: var(--ice);
  font-size: 0.65rem;
  font-weight: 700;
}

.icon-btn.ai-toggle .glyph {
  font-size: 0.95rem;
  font-weight: 700;
}

.icon-btn.ai-toggle.on .glyph {
  color: var(--ice);
  box-shadow: inset 0 0 0 2px var(--ice);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  color: var(--text);
  cursor: pointer;
}

.check-row input {
  display: inline-block;
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  accent-color: var(--violet);
}

.mod-info .ai-badge { margin: 4px 0; }

@media (max-height: 700px) {
  .actions { gap: 10px; }
}

.tt-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.tt-item {
  display: flex;
  gap: 12px;
  padding: 10px;
  border-radius: 14px;
  background: var(--panel);
}

.tt-cover {
  flex: none;
  width: 72px;
  aspect-ratio: 9 / 16;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
}

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

.tt-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}

.tt-title {
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.tt-connect {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: 16px;
  background: var(--panel);
}

#postImport { align-self: flex-start; margin-bottom: 12px; }

.platform-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 20px 0 8px;
}

.platform-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.platform-chip {
  flex: none;
  padding: 3px 10px;
  border: 1px solid rgba(236, 234, 247, 0.3);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.platform-chip.on {
  border-color: var(--ice);
  color: var(--ice);
}

.platform-chip.warn {
  border-color: var(--heart);
  color: var(--heart);
}

.platform-chip.off { opacity: 0.8; }

.platform-card a.btn {
  display: block;
  text-decoration: none;
}

.doc a.logo {
  color: var(--text);
  text-decoration: none;
}

html, body {
  font-family: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

body {
  background:
    radial-gradient(60rem 38rem at 50% -12%, rgba(124, 77, 255, 0.24), transparent 62%),
    radial-gradient(44rem 30rem at 92% 112%, rgba(158, 240, 255, 0.1), transparent 62%),
    var(--bg);
}

.topbar {
  max-width: 480px;
  margin: 0 auto;
  background: linear-gradient(to bottom, rgba(8, 6, 18, 0.9), rgba(8, 6, 18, 0.45) 60%, transparent);
}

.btn {
  border: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), transform 0.2s var(--ease);
}

.btn:hover { border-color: rgba(158, 240, 255, 0.7); }
.btn:active { transform: scale(0.96); }

.btn-solid {
  background: linear-gradient(135deg, #8d60ff, #6a3df0);
  border-color: transparent;
  box-shadow: 0 6px 22px rgba(124, 77, 255, 0.42);
}

.btn-solid:hover {
  background: linear-gradient(135deg, #9a70ff, #7447ff);
  border-color: transparent;
}

.searchbar input {
  padding: 10px 16px 10px 40px;
  border: 1px solid var(--line);
  background-color: var(--glass);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%239a96b8' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 14px 50%;
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}

.searchbar input::placeholder { color: var(--muted); }
.searchbar input:focus { border-color: rgba(158, 240, 255, 0.7); background-color: rgba(22, 18, 42, 0.85); }

@media (min-width: 640px) {
  .card {
    box-shadow: 0 0 0 1px var(--line), 0 30px 140px rgba(124, 77, 255, 0.3);
  }
}

.overlay {
  background: linear-gradient(to top, rgba(8, 6, 18, 0.94) 0%, rgba(8, 6, 18, 0.6) 48%, transparent 100%);
}

.author {
  font-weight: 700;
  font-size: 1.02rem;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}

.caption {
  line-height: 1.45;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}

.icon-btn {
  font-weight: 700;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}

.icon-btn .glyph {
  width: 50px;
  height: 50px;
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  transition: transform 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.icon-btn:hover .glyph { border-color: rgba(236, 234, 247, 0.35); }

.icon-btn.liked .glyph {
  border-color: rgba(255, 77, 125, 0.55);
  box-shadow: 0 0 24px rgba(255, 77, 125, 0.4);
  animation: like-pop 0.32s var(--ease);
}

@keyframes like-pop {
  0% { transform: scale(0.78); }
  60% { transform: scale(1.28); }
  100% { transform: scale(1.08); }
}

.ai-badge {
  background: rgba(158, 240, 255, 0.1);
  border-color: rgba(158, 240, 255, 0.55);
}

.icon-btn.ai-toggle.on .glyph {
  box-shadow: inset 0 0 0 2px var(--ice), 0 0 20px rgba(158, 240, 255, 0.28);
}

.dialog {
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 26px;
  background: rgba(24, 20, 46, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(124, 77, 255, 0.18);
}

.dialog::backdrop {
  background: rgba(5, 4, 12, 0.72);
  backdrop-filter: blur(4px);
}

.dialog input:focus, .auth-form input:focus {
  outline: none;
  border-color: rgba(158, 240, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(158, 240, 255, 0.14);
}

.sheet {
  border-top: 1px solid var(--line);
  border-radius: 24px 24px 0 0;
  background: rgba(24, 20, 46, 0.97);
  box-shadow: 0 -24px 70px rgba(0, 0, 0, 0.55);
}

.sheet::before {
  content: "";
  align-self: center;
  flex: none;
  width: 38px;
  height: 4px;
  margin: 10px 0 2px;
  border-radius: 999px;
  background: rgba(236, 234, 247, 0.22);
}

.tabs {
  border: 1px solid var(--line);
  background: rgba(22, 18, 42, 0.8);
}

.tab { transition: background 0.2s var(--ease), color 0.2s var(--ease); }

.tab.active {
  background: linear-gradient(135deg, #8d60ff, #6a3df0);
  box-shadow: 0 4px 16px rgba(124, 77, 255, 0.4);
}

.auth-view {
  background:
    radial-gradient(48rem 30rem at 50% -10%, rgba(124, 77, 255, 0.28), transparent 62%),
    var(--bg);
}

.toast {
  border: 1px solid var(--line);
  background: rgba(24, 20, 46, 0.95);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  font-weight: 600;
}

.empty p:first-child {
  color: var(--text);
  font-family: "Unbounded", system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
}

@media (prefers-reduced-motion: reduce) {
  .icon-btn.liked .glyph { animation: none; }
}
