:root {
  --bg0: #0b1118;
  --bg1: #121a24;
  --ink: #f2efe8;
  --muted: #9aa7b5;
  --accent: #e8a04a;
  --accent-2: #3ecf9a;
  --line: rgba(242, 239, 232, 0.12);
  --danger: #ff7a6a;
  --font-display: "Outfit", "Be Vietnam Pro", sans-serif;
  --font-body: "Be Vietnam Pro", "Noto Sans Thai", sans-serif;
  --touch: 64px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg0);
  color: var(--ink);
  font-family: var(--font-body);
}

body {
  min-height: 100dvh;
  overflow-x: hidden;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(1200px 700px at 15% -10%, rgba(232, 160, 74, 0.18), transparent 55%),
    radial-gradient(900px 600px at 90% 10%, rgba(62, 207, 154, 0.12), transparent 50%),
    linear-gradient(165deg, #0b1118 0%, #152033 48%, #0b1118 100%);
  animation: drift 18s ease-in-out infinite alternate;
}

.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(circle at 50% 30%, black, transparent 75%);
  opacity: 0.35;
}

@keyframes drift {
  from { filter: saturate(1) brightness(1); transform: scale(1); }
  to { filter: saturate(1.08) brightness(1.05); transform: scale(1.03); }
}

.dashboard, .youtube-app {
  position: relative;
  z-index: 1;
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: clamp(1.25rem, 3vw, 2.5rem);
}

.hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem;
  min-height: 28vh;
  animation: rise 700ms ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.brand {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3rem, 9vw, 5.5rem);
  letter-spacing: -0.04em;
  line-height: 0.95;
}

.tagline {
  margin: 0.6rem 0 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.hero-actions, .yt-controls, .yt-login-actions, .yt-search-row, .yt-url-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.btn {
  min-height: var(--touch);
  min-width: var(--touch);
  padding: 0 1.35rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(18, 26, 36, 0.72);
  color: var(--ink);
  font: 600 1.05rem/1 var(--font-body);
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.btn:active { transform: scale(0.98); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #f0c27a);
  color: #1a1208;
  border-color: transparent;
}
.btn-ghost:hover, .btn-primary:hover { border-color: rgba(242,239,232,0.35); }

.status {
  margin-top: 1.75rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 2rem;
  animation: rise 900ms ease both;
}

.metric-value {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(3.5rem, 12vw, 6rem);
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 1;
}

.metric-label, .status-meta, .widget-sub, .yt-note {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.status-meta {
  grid-column: 1 / -1;
  font-size: 1rem;
}

.widgets {
  margin-top: 2.5rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem 1.5rem;
  border-top: 1px solid var(--line);
  padding-top: 1.75rem;
  animation: rise 1100ms ease both;
}

.widget h2 {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.widget-value {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.widget-news {
  grid-column: 1 / -1;
}

.news-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.news-list a {
  color: var(--ink);
  text-decoration: none;
  font-size: 1.15rem;
  line-height: 1.35;
  display: block;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--line);
}

.news-list a:active { color: var(--accent-2); }

.youtube-app {
  min-height: 100dvh;
  animation: rise 400ms ease both;
}

.yt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.yt-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
}

.yt-search-row input,
.yt-url-row input {
  flex: 1;
  min-height: var(--touch);
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(18, 26, 36, 0.85);
  color: var(--ink);
  padding: 0 1rem;
  font: 500 1.1rem/1.2 var(--font-body);
}

.yt-results {
  margin-top: 1.25rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.yt-card {
  text-align: left;
  background: rgba(18, 26, 36, 0.7);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.75rem;
  color: inherit;
  cursor: pointer;
  min-height: 120px;
}

.yt-card img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 10px;
  display: block;
  margin-bottom: 0.6rem;
  background: #000;
}

.yt-card strong {
  display: block;
  font-size: 1rem;
  line-height: 1.3;
}

.yt-card span {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.yt-player {
  margin-top: 1.5rem;
}

#yt-canvas {
  width: 100%;
  height: auto;
  display: block;
  background: #000;
  border-radius: 18px;
  border: 1px solid var(--line);
}

.yt-now {
  margin: 0.85rem 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.yt-login-panel {
  margin: 1rem 0;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.yt-login-panel iframe {
  width: 100%;
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #000;
  margin-top: 0.75rem;
}

@media (max-width: 800px) {
  .widgets { grid-template-columns: 1fr 1fr; }
  .status { grid-template-columns: 1fr 1fr; }
  .brand { font-size: clamp(2.6rem, 14vw, 4rem); }
}

@media (max-width: 520px) {
  .widgets { grid-template-columns: 1fr; }
}
