@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap");

:root {
  color-scheme: dark;
  font-family: "DM Sans", sans-serif;
  background: #09090b;
  color: #f7f7f4;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --accent: #d5ff62;
  --muted: #a2a29d;
  --panel: #151517;
  --line: #ffffff1a;
  --page-width: 1240px;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 50% 0, #22271b 0, transparent 32rem),
    #09090b;
}

button, input, textarea { font: inherit; }
button { color: inherit; }

.topbar {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  width: min(100%, var(--page-width));
  height: 76px;
  align-items: center;
  justify-content: space-between;
  margin: 0 auto;
  padding: 0 28px;
  border-bottom: 1px solid #ffffff12;
  background: #09090be8;
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #fff;
  font-family: "Space Grotesk", sans-serif;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -1.6px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 12px;
  background: var(--accent);
  color: #101108;
  font-size: 26px;
  line-height: 1;
  transform: rotate(180deg);
}

.topbar-actions { display: flex; align-items: center; gap: 20px; }
.connection { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.connection-dot { width: 7px; height: 7px; border-radius: 50%; background: #777; }
.connection.is-online .connection-dot { background: var(--accent); box-shadow: 0 0 10px #d5ff6280; }
.connection.is-error .connection-dot { background: #ff706c; }

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 160ms ease, background 160ms ease, opacity 160ms ease;
}

.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .55; }
.button-primary { background: var(--accent); color: #14150e; }
.button-primary:hover:not(:disabled) { background: #e0ff8a; }
.button-wide { width: 100%; }

main { width: min(100%, var(--page-width)); margin: 0 auto; }
.feed { display: grid; min-height: calc(100dvh - 76px); place-items: center; padding: 30px 22px 50px; }

.video-card {
  position: relative;
  display: grid;
  width: min(100%, 1030px);
  height: min(790px, calc(100dvh - 130px));
  min-height: 460px;
  grid-template-columns: minmax(0, 1fr) 82px;
  overflow: hidden;
  border: 1px solid #ffffff1c;
  border-radius: 24px;
  background: #121214;
  box-shadow: 0 26px 100px #0008;
}

.video-stage {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: #09090b;
}

.video-stage::after {
  position: absolute;
  z-index: 0;
  right: 0;
  bottom: 0;
  left: 0;
  height: 48%;
  background: linear-gradient(transparent, #000b);
  content: "";
  pointer-events: none;
}

.video-stage video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #09090b;
}

.video-details {
  position: absolute;
  z-index: 1;
  right: 28px;
  bottom: 25px;
  left: 28px;
  display: grid;
  gap: 10px;
  text-shadow: 0 2px 12px #000;
}

.creator { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.avatar {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #ffffff50;
  border-radius: 50%;
  background: linear-gradient(135deg, #d5ff62, #81c1a0);
  color: #16170f;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  text-shadow: none;
}

.creator-name { display: grid; gap: 2px; }
.creator-name small { color: #ffffffa8; font-size: 12px; font-weight: 500; }
.caption { max-width: 610px; margin: 0; line-height: 1.5; overflow-wrap: anywhere; }
.audio-title { display: flex; align-items: center; gap: 7px; color: #ffffffcf; font-size: 12px; }
.audio-icon { display: inline-block; font-size: 14px; }

.video-actions { display: flex; flex-direction: column; align-items: center; justify-content: end; gap: 22px; padding: 20px 10px 29px; }
.action { display: grid; justify-items: center; gap: 7px; padding: 4px; border: 0; background: transparent; cursor: pointer; }
.action-icon {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border: 1px solid #ffffff1a;
  border-radius: 50%;
  background: #ffffff0a;
  font-size: 21px;
  transition: background 150ms ease, color 150ms ease, transform 150ms ease;
}
.action:hover .action-icon { transform: scale(1.06); background: #ffffff19; }
.action.is-liked .action-icon { border-color: #ff668666; background: #ff668622; color: #ff829e; }
.action-count { color: #c9c9c5; font-size: 11px; }
.mute-control {
  position: absolute;
  z-index: 1;
  top: 18px;
  right: 18px;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid #ffffff25;
  border-radius: 50%;
  background: #0008;
  cursor: pointer;
}

.loading-state, .empty-state, .error-state { display: grid; justify-items: center; gap: 14px; text-align: center; }
.loading-state p, .empty-state p, .error-state p { margin: 0; color: var(--muted); }
.empty-state { max-width: 390px; padding: 42px 24px; }
.empty-icon { display: grid; width: 74px; height: 74px; place-items: center; border: 1px solid #d5ff6240; border-radius: 25px; background: #d5ff6210; color: var(--accent); font-size: 30px; }
.empty-state h1, .error-state h1 { margin: 0; font-family: "Space Grotesk", sans-serif; font-size: 28px; letter-spacing: -1px; }
.empty-state p { max-width: 330px; line-height: 1.6; }
.loader { width: 27px; height: 27px; border: 2px solid #ffffff22; border-top-color: var(--accent); border-radius: 50%; animation: spin 750ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.sheet {
  width: min(100% - 28px, 500px);
  max-height: min(86dvh, 780px);
  padding: 0;
  border: 1px solid #ffffff1d;
  border-radius: 23px;
  background: #171719;
  color: #f7f7f4;
  box-shadow: 0 26px 100px #000b;
}
.sheet::backdrop { background: #000a; backdrop-filter: blur(5px); }
.sheet-content { display: grid; gap: 17px; padding: 25px; }
.sheet-heading { display: flex; align-items: start; justify-content: space-between; }
.sheet-heading h2 { margin: 1px 0 0; font-family: "Space Grotesk", sans-serif; font-size: 25px; letter-spacing: -.7px; }
.eyebrow { margin: 0; color: var(--accent); font-size: 10px; font-weight: 700; letter-spacing: 1.5px; }
.icon-button { display: grid; width: 36px; height: 36px; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: #ffffff09; cursor: pointer; font-size: 23px; line-height: 1; }
.file-picker { display: grid; min-height: 144px; align-content: center; justify-items: center; gap: 7px; border: 1px dashed #ffffff3d; border-radius: 16px; background: #ffffff05; color: #fff; cursor: pointer; text-align: center; }
.file-picker:hover { border-color: var(--accent); background: #d5ff6208; }
.file-picker span:last-of-type { color: var(--muted); font-size: 12px; }
.file-picker-icon { color: var(--accent); font-size: 28px; }
.file-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.field-label { margin-bottom: -11px; font-size: 13px; font-weight: 700; }
.field-label span { color: var(--muted); font-weight: 400; }
textarea, .comment-form input { width: 100%; border: 1px solid var(--line); border-radius: 12px; outline: 0; background: #0d0d0f; color: #fff; }
textarea { min-height: 86px; padding: 12px; resize: vertical; }
textarea:focus, .comment-form input:focus { border-color: #d5ff6290; }
.privacy-note { margin: -7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; text-align: center; }
.form-error { min-height: 0; margin: -7px 0 0; color: #ff9e9b; font-size: 12px; }
.form-error:empty { display: none; }
.comments-sheet { width: min(100% - 28px, 540px); }
.comments-list { display: grid; max-height: 48dvh; gap: 16px; overflow-y: auto; padding: 3px 1px; }
.comment { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: start; }
.comment .avatar { width: 32px; height: 32px; font-size: 12px; }
.comment-body { display: grid; gap: 4px; }
.comment-body strong { font-size: 12px; }
.comment-body p { margin: 0; color: #d2d2ce; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.no-comments { color: var(--muted); font-size: 13px; text-align: center; }
.comment-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.comment-form input { min-width: 0; padding: 0 12px; }
.toast { position: fixed; z-index: 5; right: 18px; bottom: 20px; max-width: calc(100% - 36px); padding: 12px 16px; transform: translateY(20px); border: 1px solid var(--line); border-radius: 12px; background: #202023; color: #fff; opacity: 0; pointer-events: none; transition: opacity 180ms ease, transform 180ms ease; }
.toast.is-visible { transform: translateY(0); opacity: 1; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }

@media (max-width: 680px) {
  .topbar { height: 63px; padding: 0 16px; }
  .brand { font-size: 23px; }
  .brand-mark { width: 30px; height: 30px; border-radius: 10px; }
  .topbar-actions { gap: 12px; }
  .connection { font-size: 0; }
  .connection-dot { width: 8px; height: 8px; }
  .button { min-height: 39px; padding: 0 13px; border-radius: 11px; font-size: 13px; }
  .feed { min-height: calc(100dvh - 63px); padding: 0; }
  .video-card { width: 100%; height: calc(100dvh - 63px); min-height: 400px; grid-template-columns: minmax(0, 1fr) 68px; border: 0; border-radius: 0; box-shadow: none; }
  .video-stage { background: #080809; }
  .video-stage video { object-fit: cover; }
  .video-details { right: 14px; bottom: max(22px, env(safe-area-inset-bottom)); left: 15px; gap: 9px; }
  .video-actions { gap: 19px; padding: 14px 6px max(24px, env(safe-area-inset-bottom)); }
  .action-icon { width: 44px; height: 44px; font-size: 19px; }
  .action-count { font-size: 10px; }
  .mute-control { top: 14px; right: 13px; width: 36px; height: 36px; }
  .sheet-content { padding: 21px; }
  .empty-state { padding: 30px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
