:root {
  --bg0: #020914;
  --bg1: #07142b;
  --bg2: #0a2140;
  --text: #f4f8ff;
  --muted: rgba(227, 236, 255, 0.78);
  --line: rgba(188, 218, 255, 0.24);
  --panel: rgba(7, 19, 36, 0.78);
  --panel-2: rgba(8, 22, 43, 0.88);
  --glow: rgba(73, 138, 216, 0.28);
  --accent: #89c7ff;
  --ok: #8ee7b7;
  --warn: #ffd6a0;
  --media-card-ratio: 16 / 10;
  --media-dialog-ratio: 16 / 9;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(72% 90% at 50% 8%, rgba(20, 60, 118, 0.45), transparent 70%),
    linear-gradient(180deg, var(--bg2) 0%, var(--bg1) 45%, var(--bg0) 100%);
  overflow-x: hidden;
}

.noise-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 8;
  opacity: 0.14;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.44) 0.45px, transparent 0.8px),
    radial-gradient(circle at 60% 80%, rgba(255, 255, 255, 0.25) 0.5px, transparent 0.9px);
  background-size: 3px 3px, 4px 4px;
}

.snow-layer,
.snow-layer::before,
.snow-layer::after {
  content: "";
  position: fixed;
  inset: -40% 0 0 0;
  pointer-events: none;
  z-index: 7;
  background-repeat: repeat;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.85) 1px, transparent 1.3px),
    radial-gradient(circle, rgba(255, 255, 255, 0.55) 0.8px, transparent 1.2px);
  background-size: 150px 150px, 115px 115px;
  animation: snowfall 15s linear infinite;
}

.snow-layer::before {
  opacity: 0.65;
  animation-duration: 22s;
  transform: scale(1.08);
}

.snow-layer::after {
  opacity: 0.46;
  animation-duration: 31s;
  transform: scale(1.16);
}

.page {
  position: relative;
  z-index: 2;
  width: min(1280px, 94vw);
  margin: 0 auto;
  padding: clamp(2.2rem, 5vw, 4rem) 0 6rem;
}

.page-head {
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  background: linear-gradient(145deg, rgba(10, 27, 49, 0.82), rgba(8, 19, 34, 0.7));
  box-shadow: 0 20px 42px rgba(0, 0, 0, 0.28);
  padding: 1rem 1.1rem;
}

.page-head-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.9rem;
}

.page-head h1 {
  margin: 0;
  font-size: clamp(2.5rem, 8vw, 5.3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  text-shadow: 0 10px 36px rgba(0, 0, 0, 0.6);
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.head-btn,
.back-home {
  border: 1px solid rgba(203, 229, 255, 0.45);
  border-radius: 999px;
  padding: 0.52rem 0.84rem;
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.head-btn {
  background: rgba(255, 255, 255, 0.1);
  color: #eef7ff;
  cursor: pointer;
}

.back-home {
  color: #07203c;
  background: linear-gradient(135deg, #8dc9ff 0%, #6fb6ff 100%);
}

.subtitle {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: clamp(0.92rem, 2vw, 1.07rem);
}

.upload-panel {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: linear-gradient(145deg, rgba(10, 25, 45, 0.9), var(--panel));
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.26);
  padding: 0.95rem;
}

.video-form {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr 0.72fr auto;
  align-items: end;
  gap: 0.7rem;
}

.video-form label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-weight: 600;
  color: rgba(229, 240, 255, 0.9);
}

input,
textarea,
button {
  font: inherit;
}

.video-form input,
.video-form select,
.comment-form input,
.comment-form textarea,
.elone-form input {
  border: 1px solid rgba(201, 227, 255, 0.25);
  background: rgba(4, 13, 25, 0.9);
  color: var(--text);
  border-radius: 0.72rem;
  padding: 0.7rem 0.84rem;
}

.video-form input:focus,
.video-form select:focus,
.comment-form input:focus,
.comment-form textarea:focus,
.elone-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(137, 199, 255, 0.16);
}

.video-form select {
  border: 1px solid rgba(201, 227, 255, 0.25);
  background: rgba(4, 13, 25, 0.95);
  color: var(--text);
  border-radius: 0.72rem;
  padding: 0.7rem 0.84rem;
}

.video-form input[type="file"] {
  padding: 0.4rem;
  color: rgba(231, 243, 255, 0.9);
}

.video-form input[type="file"]::file-selector-button {
  border: 1px solid rgba(192, 223, 255, 0.35);
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  margin-right: 0.58rem;
  background: linear-gradient(145deg, rgba(16, 41, 72, 0.9), rgba(12, 30, 55, 0.96));
  color: #e9f4ff;
  cursor: pointer;
}

.video-form button,
.comment-form button,
.elone-form button,
.elone-quick button {
  border: none;
  border-radius: 0.8rem;
  background: linear-gradient(135deg, #8ecbff 0%, #5ea8f0 100%);
  color: #052039;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 0.78rem 1.02rem;
  cursor: pointer;
  transition: transform 160ms ease, filter 160ms ease;
}

.video-form button:hover,
.comment-form button:hover,
.elone-form button:hover,
.elone-quick button:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.status-hint {
  margin: 0.62rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.status {
  min-height: 1.35rem;
  margin: 0.45rem 0 0;
  color: var(--warn);
}

.status.success {
  color: var(--ok);
}

.media-sections {
  margin-top: 1.5rem;
  display: grid;
  gap: 1.3rem;
}

.media-type-section {
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: linear-gradient(145deg, rgba(9, 23, 41, 0.86), rgba(6, 16, 30, 0.8));
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.24);
  padding: 1rem;
}

.media-type-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.7rem;
}

.media-type-head h2 {
  margin: 0;
  font-size: clamp(1.35rem, 2.5vw, 1.9rem);
}

.media-type-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.media-category {
  margin-top: 0.95rem;
}

.media-category h3 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0.01em;
  color: rgba(229, 241, 255, 0.95);
}

.media-grid {
  margin-top: 0.68rem;
}

.video-grid {
  margin-top: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2rem 1.2rem;
  align-items: start;
}

.video-card {
  display: grid;
  gap: 0.72rem;
}

.video-card.slot-right {
  grid-column: 3;
}

.video-card.slot-middle {
  grid-column: 2;
}

.video-card.slot-left {
  grid-column: 1;
}

.video-title {
  margin: 0;
  font-size: clamp(1.2rem, 2.2vw, 1.92rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.thumb {
  position: relative;
  border: 1px solid rgba(216, 235, 255, 0.24);
  border-radius: 1.4rem;
  aspect-ratio: var(--media-card-ratio);
  overflow: hidden;
  padding: 0;
  cursor: pointer;
  background: rgba(7, 20, 36, 0.55);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.02) inset,
    0 14px 32px rgba(0, 0, 0, 0.36),
    0 0 30px var(--glow);
  transition: transform 220ms ease, border-color 220ms ease;
}

.thumb:hover {
  transform: translateY(-4px) scale(1.01);
  border-color: rgba(198, 224, 255, 0.45);
}

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

.play-badge {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4.8rem;
  height: 4.8rem;
  margin-left: -2.4rem;
  margin-top: -2.4rem;
  border-radius: 50%;
  background: rgba(12, 21, 34, 0.58);
  border: 1px solid rgba(232, 242, 255, 0.38);
  display: grid;
  place-items: center;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.34);
}

.play-icon {
  margin-left: 4px;
  width: 0;
  height: 0;
  border-top: 0.73rem solid transparent;
  border-bottom: 0.73rem solid transparent;
  border-left: 1.15rem solid rgba(243, 249, 255, 0.95);
}

.video-meta {
  display: grid;
  gap: 0.3rem;
}

.video-date {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.video-stats {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.stat {
  border: 1px solid rgba(209, 233, 255, 0.28);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(244, 250, 255, 0.96);
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  padding: 0.26rem 0.62rem;
  border-radius: 999px;
  cursor: pointer;
}

.stat .stat-label {
  font-size: 0.8rem;
  letter-spacing: 0.01em;
  color: rgba(226, 240, 255, 0.88);
}

.stat .like-count,
.stat .comment-count {
  font-size: 0.94rem;
  font-weight: 700;
  color: #f4f9ff;
}

.empty-state {
  grid-column: 1 / -1;
  border: 1px dashed rgba(203, 229, 255, 0.32);
  border-radius: 1rem;
  padding: 1.2rem;
  background: rgba(7, 20, 39, 0.5);
}

.empty-state h2 {
  margin: 0;
}

.empty-state p {
  margin: 0.45rem 0 0;
  color: var(--muted);
}

.video-dialog {
  width: min(920px, 94vw);
  border: 1px solid rgba(213, 234, 255, 0.3);
  border-radius: 1.1rem;
  padding: 0;
  background: linear-gradient(145deg, rgba(8, 22, 41, 0.98), rgba(3, 11, 20, 0.98));
  color: var(--text);
}

.video-dialog::backdrop {
  background: rgba(3, 8, 15, 0.72);
  backdrop-filter: blur(4px);
}

.dialog-close-wrap {
  display: flex;
  justify-content: flex-end;
  padding: 0.6rem 0.7rem 0;
}

.dialog-close {
  border: 1px solid rgba(213, 234, 255, 0.24);
  background: rgba(255, 255, 255, 0.08);
  color: #f2f8ff;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  cursor: pointer;
}

.dialog-shell {
  padding: 0 1rem 1rem;
}

.dialog-title {
  margin: 0;
  font-size: 1.8rem;
}

.dialog-player {
  margin-top: 0.8rem;
  border: 1px solid rgba(213, 234, 255, 0.2);
  border-radius: 0.9rem;
  overflow: hidden;
  aspect-ratio: var(--media-dialog-ratio);
  background: #000;
}

.dialog-video,
.dialog-image,
.dialog-frame {
  width: 100%;
  height: 100%;
  border: 0;
}

.dialog-image {
  object-fit: contain;
  background: #000;
}

.dialog-comments {
  margin-top: 1rem;
  border-top: 1px solid rgba(213, 234, 255, 0.18);
  padding-top: 1rem;
}

.dialog-comments-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dialog-comments-head h3 {
  margin: 0;
  font-size: 1.1rem;
}

.comment-pill {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.25rem 0.52rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.comment-list {
  list-style: none;
  margin: 0.65rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
  max-height: 220px;
  overflow: auto;
}

.comment-list li {
  border: 1px solid rgba(203, 229, 255, 0.16);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 0.75rem;
  padding: 0.55rem 0.65rem;
}

.comment-list .empty {
  text-align: center;
  color: var(--muted);
  border-style: dashed;
}

.comment-list b {
  display: inline-block;
  margin-bottom: 0.2rem;
  font-size: 0.86rem;
}

.comment-list p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.comment-form {
  margin-top: 0.7rem;
  display: grid;
  gap: 0.5rem;
}

.comment-form textarea {
  resize: vertical;
  min-height: 76px;
}

.elone-panel {
  position: fixed;
  right: clamp(0.65rem, 2vw, 1.1rem);
  bottom: clamp(0.65rem, 2vw, 1.1rem);
  z-index: 11;
  width: min(360px, 92vw);
  border: 1px solid rgba(199, 228, 255, 0.32);
  border-radius: 1rem;
  background: linear-gradient(145deg, rgba(9, 24, 44, 0.92), rgba(6, 15, 29, 0.9));
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.35);
  padding: 0.75rem;
}

.elone-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.elone-panel.dragging .elone-head {
  cursor: grabbing;
}

.elone-panel.floating {
  right: auto;
  bottom: auto;
}

.elone-head strong {
  font-size: 0.95rem;
  letter-spacing: 0.03em;
}

.elone-voice {
  border: 1px solid rgba(192, 223, 255, 0.34);
  background: rgba(255, 255, 255, 0.1);
  color: #edf6ff;
  border-radius: 999px;
  padding: 0.32rem 0.6rem;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
}

.elone-bubble {
  margin: 0.55rem 0 0;
  color: rgba(230, 241, 255, 0.92);
  line-height: 1.45;
  font-size: 0.92rem;
}

.elone-form {
  margin-top: 0.55rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.45rem;
}

.elone-form button {
  padding: 0.66rem 0.84rem;
}

.elone-quick {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.elone-quick button {
  font-size: 0.76rem;
  padding: 0.45rem 0.62rem;
}

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 480ms ease, transform 480ms ease;
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

@keyframes snowfall {
  from {
    transform: translate3d(0, -7%, 0);
  }

  to {
    transform: translate3d(-8%, 88%, 0);
  }
}

@media (max-width: 1100px) {
  .video-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem 1rem;
  }

  .video-card.slot-right,
  .video-card.slot-middle,
  .video-card.slot-left {
    grid-column: auto;
  }
}

@media (max-width: 760px) {
  :root {
    /* YouTube Shorts style: portrait format */
    --media-card-ratio: 9 / 16;
    --media-dialog-ratio: 9 / 16;
  }

  .page {
    width: min(100%, 95vw);
    padding: 1.15rem 0 3rem;
  }

  .page-head {
    border-radius: 0.9rem;
    padding: 0.85rem;
  }

  .page-head h1 {
    font-size: clamp(2rem, 12vw, 2.9rem);
  }

  .subtitle {
    font-size: 0.9rem;
  }

  .page-head-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .head-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .head-btn,
  .back-home {
    padding: 0.46rem 0.7rem;
    font-size: 0.78rem;
  }

  .upload-panel,
  .media-type-section {
    border-radius: 0.9rem;
    padding: 0.8rem;
  }

  .video-form {
    grid-template-columns: 1fr;
    gap: 0.62rem;
  }

  .video-form label {
    font-size: 0.9rem;
  }

  .video-form button {
    width: 100%;
  }

  .media-type-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.16rem;
  }

  .media-type-head h2 {
    font-size: 1.24rem;
  }

  .media-category {
    margin-top: 0.8rem;
  }

  .video-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .video-card {
    width: min(100%, 430px);
    margin: 0 auto;
  }

  .thumb {
    border-radius: 1rem;
  }

  .video-thumb,
  .image-thumb {
    object-fit: contain;
    background: #000;
  }

  .play-badge {
    width: 3.7rem;
    height: 3.7rem;
    margin-left: -1.85rem;
    margin-top: -1.85rem;
  }

  .video-title {
    font-size: 1.1rem;
  }

  .video-stats {
    gap: 0.45rem;
    flex-wrap: wrap;
  }

  .video-dialog {
    width: min(100vw - 0.8rem, 430px);
    max-height: calc(100dvh - 0.8rem);
  }

  .dialog-shell {
    padding: 0 0.72rem 0.72rem;
  }

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

  .dialog-player {
    width: min(100%, 390px);
    max-height: 70dvh;
    margin: 0.7rem auto 0;
  }

  .dialog-comments {
    margin-top: 0.75rem;
    padding-top: 0.72rem;
  }

  .comment-list {
    max-height: 170px;
  }

  .comment-form textarea {
    min-height: 66px;
  }

  .elone-panel {
    position: static;
    width: min(100%, 95vw);
    margin: 0.9rem auto 1.2rem;
    left: auto !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
  }
}

/* Emotion stats + mobile polish */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.stat {
  min-height: 2.1rem;
  padding: 0.3rem 0.68rem;
  gap: 0.46rem;
}

.stat-icons {
  display: inline-flex;
  align-items: center;
  gap: 0.24rem;
  line-height: 1;
}

.stat-icons .heart {
  color: #ff95ae;
  filter: drop-shadow(0 0 7px rgba(255, 149, 174, 0.3));
}

.stat-icons .thumbs,
.stat-icon {
  color: #d8ecff;
}

.like-btn .like-count,
.comment-btn .comment-count {
  min-width: 1.2rem;
  text-align: center;
}

@media (max-width: 760px) {
  body {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .page {
    width: 100%;
    padding: calc(0.95rem + env(safe-area-inset-top)) 0.65rem calc(1.2rem + env(safe-area-inset-bottom));
  }

  .page-head {
    padding: 0.8rem;
    border-radius: 0.85rem;
  }

  .page-head-top {
    gap: 0.6rem;
  }

  .head-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 0.5rem;
  }

  .head-btn,
  .back-home {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 2.4rem;
    padding: 0.5rem 0.62rem;
    font-size: 0.78rem;
  }

  .upload-panel,
  .media-type-section {
    padding: 0.78rem;
  }

  .video-form label {
    gap: 0.34rem;
  }

  .video-form input,
  .video-form select,
  .video-form button {
    min-height: 2.75rem;
  }

  .status-hint,
  .status {
    font-size: 0.82rem;
  }

  .media-sections {
    margin-top: 1.1rem;
    gap: 1rem;
  }

  .media-category {
    margin-top: 0.72rem;
  }

  .video-grid {
    gap: 0.95rem;
  }

  .video-card {
    width: 100%;
    max-width: 430px;
  }

  .video-title {
    font-size: 1.03rem;
    line-height: 1.2;
  }

  .thumb {
    width: 100%;
    border-radius: 0.95rem;
    max-height: 76dvh;
  }

  .video-thumb,
  .image-thumb {
    object-fit: contain;
    background: #000;
  }

  .play-badge {
    width: 3.3rem;
    height: 3.3rem;
    margin-left: -1.65rem;
    margin-top: -1.65rem;
  }

  .video-meta {
    gap: 0.38rem;
  }

  .video-date {
    font-size: 0.78rem;
  }

  .video-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }

  .stat {
    justify-content: center;
    min-height: 2.35rem;
    padding: 0.34rem 0.52rem;
  }

  .video-dialog {
    width: 100vw;
    max-width: none;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .dialog-close-wrap {
    padding: 0.55rem 0.6rem 0;
  }

  .dialog-shell {
    padding: 0 0.68rem calc(0.9rem + env(safe-area-inset-bottom));
  }

  .dialog-title {
    font-size: 1.08rem;
    line-height: 1.3;
  }

  .dialog-player {
    width: 100%;
    max-width: none;
    margin-top: 0.62rem;
    max-height: 62dvh;
  }

  .dialog-video,
  .dialog-image {
    object-fit: contain;
    background: #000;
  }

  .comment-list {
    max-height: 26dvh;
  }

  .comment-form input,
  .comment-form textarea,
  .comment-form button {
    min-height: 2.6rem;
  }

  .comment-form textarea {
    min-height: 84px;
  }

  .elone-panel {
    width: 100%;
    margin: 0.8rem 0 1.1rem;
    border-radius: 0.9rem;
    padding: 0.68rem;
  }

  .elone-form {
    grid-template-columns: 1fr;
  }

  .elone-form button {
    width: 100%;
  }

  .elone-quick {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem;
  }
}

@media (max-width: 760px) and (orientation: landscape) {
  :root {
    --media-card-ratio: 16 / 9;
    --media-dialog-ratio: 16 / 9;
  }

  .video-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .video-card {
    max-width: none;
  }

  .dialog-player {
    max-height: 52dvh;
  }
}
