:root {
  --bg: #120606;
  --bg2: #1a0707;
  --panel: #241010;
  --panel2: #2a0c0c;
  --text: #ffe8e8;
  --muted: #ffb3b3;
  --accent: #c62828;
  --accent2: #ff7a7a;
  --border: rgba(255, 122, 122, 0.16);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: Arial, sans-serif;
  background: linear-gradient(180deg, #120606 0%, #0d0303 100%);
  color: var(--text);
}

body {
  min-height: 100vh;
}

a {
  color: var(--accent2);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button, input, textarea {
  font: inherit;
}

.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  padding: 20px;
  flex-shrink: 0;
}

.logo {
  margin: 0 0 20px;
  font-size: 22px;
  color: var(--text);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nav-btn {
  width: 100%;
  padding: 12px 14px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
}

.nav-btn:hover,
.nav-btn.active {
  background: var(--accent);
}

.content {
  flex: 1;
  padding: 20px;
}

.tab {
  display: none;
}

.tab.active {
  display: block;
}

html.chromebook .nav-btn[data-tab="jetstream"] {
  display: none;
}

html.chromebook .nav-btn[data-tab="jetstream"].active {
  background: transparent;
  color: inherit;
}

html.chromebook .nav-btn[data-tab="playables"] {
  background: rgba(255, 82, 82, 0.15);
  color: #ff8a80;
}

html.chromebook #jetstream.tab {
  display: none !important;
}

html.chromebook #playables.tab {
  display: block;
}

.browser-frame {
  width: 100%;
  height: calc(100vh - 40px);
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #120606;
}

.jetstream-embed {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: calc(100vh - 40px);
}

.jetstream-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(36, 16, 16, 0.95), rgba(18, 6, 6, 0.95));
}

.jetstream-banner strong {
  color: var(--accent2);
  font-size: 1.1rem;
  margin-right: 10px;
}

.jetstream-tag {
  color: var(--muted);
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  text-transform: lowercase;
}

.ads-banner-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ads-banner-head strong {
  color: var(--accent2);
  font-size: 1.1rem;
}

.ads-tag {
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}

.jetstream-open {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(198, 40, 40, 0.2);
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  font: inherit;
}

.jetstream-open:hover {
  background: var(--accent);
  text-decoration: none;
}

.jetstream-embed .browser-frame {
  flex: 1;
  height: auto;
  min-height: 0;
}

.jetstream-chromebook-note {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 24px;
  border: 1px solid rgba(255, 193, 7, 0.35);
  border-radius: 14px;
  background: rgba(255, 193, 7, 0.08);
  text-align: center;
}

.jetstream-chromebook-note p {
  max-width: 520px;
  margin: 0 0 16px;
  color: #ffdca8;
  line-height: 1.5;
}

.jetstream-chromebook-open {
  padding: 10px 18px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(180deg, #ff5252, #b71c1c);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  font: inherit;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.card {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  overflow: hidden;
}

.card h3 {
  margin: 0 0 10px;
  word-break: break-word;
}

.card-link {
  display: block;
  margin-bottom: 14px;
  word-break: break-word;
  color: var(--muted);
}

.open-link {
  display: inline-block;
  padding: 10px 12px;
  background: var(--accent);
  color: white;
  border-radius: 10px;
  text-decoration: none;
}

.open-link:hover {
  filter: brightness(1.08);
  text-decoration: none;
}

.playables-wrap {
  min-height: calc(100vh - 40px);
}

.playables-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}

.playables-grid.hidden {
  display: none;
}

.playable-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel2);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
}

.playable-card:hover {
  border-color: rgba(255, 122, 122, 0.45);
  transform: translateY(-2px);
}

.playable-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  background: #1a0707;
}

.playable-fallback {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  font-size: 2rem;
  font-weight: bold;
  background: linear-gradient(180deg, #3a1010, #1a0707);
  color: var(--accent2);
}

.playable-info {
  padding: 10px 12px 12px;
}

.playable-info strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.92rem;
  line-height: 1.3;
}

.playable-info span {
  color: var(--muted);
  font-size: 0.78rem;
}

.playables-player {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: calc(100vh - 40px);
}

.playables-player.hidden {
  display: none;
}

.playables-player-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(36, 16, 16, 0.95), rgba(18, 6, 6, 0.95));
}

.playables-back {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(198, 40, 40, 0.2);
  color: var(--text);
  cursor: pointer;
  font: inherit;
}

.playables-title {
  flex: 1;
  font-weight: bold;
  color: var(--accent2);
}

.playables-frame {
  flex: 1;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #000;
}

.empty {
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--muted);
}

#announcement {
  display: none;
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel2);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 10px 24px;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  z-index: 1000;
  box-shadow: 0 4px 24px rgba(198, 40, 40, 0.3);
  backdrop-filter: blur(8px);
  max-width: 80vw;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: floatIn 0.4s ease;
}

#announcement.visible {
  display: block;
}

@keyframes floatIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.discord-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #5865F2;
  color: white;
  border-radius: 50%;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(88, 101, 242, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
  z-index: 999;
}

.discord-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 24px rgba(88, 101, 242, 0.6);
  text-decoration: none;
}

/* =========================
   SETTINGS PANEL
========================= */
.settings-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 560px;
}

.settings-card {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
}

.settings-card-title {
  font-size: 15px;
  font-weight: bold;
  margin-bottom: 4px;
  color: var(--text);
}

.settings-card-desc {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
}

.color-picker {
  width: 56px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  cursor: pointer;
  background: none;
  padding: 2px;
}

.cloak-btn {
  padding: 10px 18px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  transition: filter 0.2s;
}

.cloak-btn:hover {
  filter: brightness(1.1);
}

.suggest-area {
  width: 100%;
  padding: 12px;
  background: #160808;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  resize: vertical;
  min-height: 90px;
  font-size: 14px;
  margin-bottom: 10px;
  display: block;
}

.suggest-submit {
  padding: 10px 18px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  transition: filter 0.2s;
}

.suggest-submit:hover {
  filter: brightness(1.1);
}

.suggest-status {
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
  min-height: 18px;
}

.ads-panel {
  max-width: 820px;
}

.ads-header h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.ads-header p {
  margin: 0 0 20px;
  color: var(--muted);
  line-height: 1.5;
}

.ads-header a {
  color: #ff8a80;
}

.ads-empty {
  background: var(--panel2);
  border: 1px dashed var(--border);
  border-radius: 16px;
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

.ads-empty.hidden,
.ads-slot.hidden {
  display: none;
}

.ads-slots {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ads-slot {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
}

.ads-slot-label {
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

.ads-slot-body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 90px;
  overflow: hidden;
}

.ads-slot-body iframe {
  max-width: 100%;
}

.ads-page-body {
  padding: 24px;
}

.ads-page {
  max-width: 820px;
  margin: 0 auto;
}

.ads-page-header {
  margin-bottom: 24px;
}

.ads-page-home {
  display: inline-block;
  margin-bottom: 16px;
  font-weight: bold;
}

.ads-page-header h1 {
  margin: 0 0 8px;
  font-size: 28px;
}

.ads-page-header p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

/* =========================
   ADMIN
========================= */
.admin-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

.admin-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 18px;
}

.admin-card h2,
.admin-card h3 {
  margin-top: 0;
}

.admin-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  margin-bottom: 12px;
}

.admin-input {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #160808;
  color: var(--text);
}

.admin-btn {
  padding: 12px 14px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}

.admin-btn.secondary {
  background: #5a0b0b;
}

.admin-btn.danger {
  background: #7a1515;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  color: var(--text);
}

.admin-ads-slot {
  margin-bottom: 14px;
}

.admin-ads-label {
  display: block;
  font-size: 13px;
  font-weight: bold;
  margin-bottom: 6px;
}

.admin-ads-code {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.ads-smartlink {
  display: inline-block;
  padding: 12px 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ff5252, #b71c1c);
  color: #fff !important;
  font-weight: bold;
  text-decoration: none;
}

.ads-smartlink:hover {
  filter: brightness(1.08);
}

.status {
  margin-top: 12px;
  color: var(--muted);
}

@media (max-width: 1000px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .app {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
  }

  .browser-frame {
    height: 70vh;
  }

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