:root {
  color-scheme: dark;
  --font-body: "Segoe UI Variable", "Segoe UI", Tahoma, sans-serif;
  --font-display: Georgia, "Times New Roman", serif;
  --bg: #07161a;
  --bg-alt: #0e252b;
  --surface: rgba(8, 30, 35, 0.84);
  --surface-strong: rgba(10, 37, 43, 0.96);
  --line: rgba(163, 208, 200, 0.14);
  --line-strong: rgba(163, 208, 200, 0.24);
  --text: #ecf4ef;
  --muted: #9eb5ad;
  --accent: #76e0c2;
  --accent-strong: #15aa83;
  --warn: #ffb460;
  --danger: #ff7a7a;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

body[data-theme="light"] {
  color-scheme: light;
  --bg: #f4efe5;
  --bg-alt: #ece2d0;
  --surface: rgba(255, 250, 243, 0.78);
  --surface-strong: rgba(255, 252, 247, 0.92);
  --line: rgba(24, 80, 74, 0.12);
  --line-strong: rgba(24, 80, 74, 0.22);
  --text: #18352f;
  --muted: #5f716d;
  --accent: #00745b;
  --accent-strong: #0f5d4c;
  --warn: #b47017;
  --danger: #bd3d3d;
  --shadow: 0 24px 60px rgba(66, 46, 14, 0.12);
}

* {
  box-sizing: border-box;
}

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

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  overflow-x: hidden;
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(118, 224, 194, 0.16), transparent 28%),
    radial-gradient(circle at 85% 10%, rgba(255, 180, 96, 0.18), transparent 24%),
    linear-gradient(160deg, var(--bg) 0%, var(--bg-alt) 100%);
}

.page-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 92%);
}

.shell {
  width: min(1180px, calc(100vw - 1.5rem));
  margin: 0 auto;
  padding: 1.25rem 0 4rem;
}

.masthead,
.band {
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.masthead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.5rem;
  align-items: start;
  padding: 1.5rem;
  border-radius: 18px;
}

.masthead h1,
.summary-copy h2,
.section-heading h2,
.auth-copy h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.02;
}

.lead,
.support-copy,
.auth-copy p {
  margin: 0.75rem 0 0;
  max-width: 56rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

.kicker {
  margin: 0 0 0.6rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.16rem;
  font-size: 1.5rem;
  font-weight: 700;
}

.masthead-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.action-button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #06241c;
  padding: 0.88rem 1.2rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease, box-shadow 160ms ease;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.18);
}

body[data-theme="light"] .action-button {
  color: #f5f3ea;
}

body[data-theme="light"] .action-button.ghost {
  color: var(--text);
  background: rgba(24, 80, 74, 0.05);
  border-color: rgba(24, 80, 74, 0.18);
}

.action-button:hover {
  transform: translateY(-1px);
}

.action-button:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
}

.action-button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line-strong);
  box-shadow: none;
}

.locale-button {
  min-width: 4.5rem;
}

.action-button.wide {
  width: 100%;
}

.dashboard {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.auth-band {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(18rem, 28rem);
  gap: 1.2rem;
  margin-top: 1rem;
  padding: 1.3rem;
  border-radius: 18px;
}

.auth-form,
.stack-form {
  display: grid;
  gap: 0.9rem;
}

label {
  display: grid;
  gap: 0.45rem;
  font-size: 0.92rem;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background-color: var(--bg-alt);
  color: var(--text);
  font: inherit;
  padding: 0.9rem 1rem;
  color-scheme: dark;
}

body[data-theme="light"] input,
body[data-theme="light"] select,
body[data-theme="light"] textarea {
  background-color: var(--surface-strong);
  color-scheme: light;
}

.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input-wrapper input {
  padding-right: 3rem;
}

.password-toggle-btn {
  position: absolute;
  right: 0.4rem;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
  z-index: 2;
}

.password-toggle-btn:hover {
  color: var(--text);
}

.password-toggle-btn svg {
  pointer-events: none;
}

textarea {
  resize: vertical;
}

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

.summary-band,
.primary-band,
.content-band,
.admin-band {
  border-radius: 18px;
  padding: 1.3rem;
}

.summary-band {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
}

.summary-stats,
.detail-grid,
.admin-grid,
.three-up,
.two-up {
  display: grid;
  gap: 0.8rem;
}

.summary-stats {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stat-chip,
.detail-block,
.entry-card,
.admin-panel,
.user-card {
  border: 1px solid var(--line);
  background: var(--surface-strong);
}

.stat-chip,
.detail-block {
  border-radius: 14px;
  padding: 1rem;
}

.stat-chip span,
.detail-block span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 0.35rem;
}

.stat-chip strong,
.detail-block strong {
  font-size: 1.05rem;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-heading h2,
.section-heading h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2vw, 2rem);
}

.content-band {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.content-column {
  min-width: 0;
}

.entry-list,
.user-list {
  display: grid;
  gap: 0.8rem;
}

.entry-card,
.admin-panel,
.user-card {
  border-radius: 14px;
  padding: 1rem;
}

.entry-card h3,
.user-card h3,
.admin-panel h3 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
}

.entry-meta,
.user-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.entry-body,
.guide-body,
.secret-value,
.support-text {
  line-height: 1.7;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.entry-body,
.support-text,
.secret-value {
  white-space: pre-wrap;
}

.guide-body {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  background: var(--surface-strong);
}

.guide-shell {
  display: grid;
  gap: 1rem;
}

.guide-hero,
.guide-empty-state {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-strong);
}

.guide-hero {
  padding: 1rem;
  background:
    linear-gradient(135deg, rgba(118, 224, 194, 0.2), rgba(255, 180, 96, 0.08)),
    var(--surface-strong);
}

.guide-hero h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.5rem;
}

.guide-hero p:last-child {
  margin: 0.7rem 0 0;
  color: var(--muted);
}

.platform-selector-wrap {
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.platform-selector-wrap label {
  font-size: 0.82rem;
  color: var(--muted);
}

.platform-selector {
  max-width: 400px;
}

.user-admin-controls {
  margin-bottom: 1.5rem;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
}

.user-admin-controls .field-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.user-admin-controls label {
  font-size: 0.82rem;
  color: var(--muted);
}

.user-selector {
  width: 100%;
}

.guide-tab,
.guide-link {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  padding: 0.65rem 1rem;
  cursor: pointer;
}

.guide-link {
  background: linear-gradient(135deg, rgba(118, 224, 194, 0.2), rgba(21, 170, 131, 0.26));
}

.guide-card-grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.guide-card,
.quick-app-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  background: var(--surface-strong);
}

.quick-app-card {
  display: grid;
  gap: 0.85rem;
  padding: 0.9rem;
}

.guide-card[data-tone="android"],
.quick-app-card[data-tone="android"],
.guide-card[data-tone="tv"],
.quick-app-card[data-tone="tv"] {
  box-shadow: 
    inset 0 3px 0 rgba(118, 224, 194, 0.85),
    0 8px 24px rgba(118, 224, 194, 0.12);
}

.guide-card[data-tone="ios"],
.quick-app-card[data-tone="ios"] {
  box-shadow: 
    inset 0 3px 0 rgba(134, 181, 255, 0.85),
    0 8px 24px rgba(134, 181, 255, 0.12);
}

.guide-card[data-tone="pc"],
.quick-app-card[data-tone="pc"],
.guide-card[data-tone="win"],
.quick-app-card[data-tone="win"],
.guide-card[data-tone="macos"],
.quick-app-card[data-tone="macos"],
.guide-card[data-tone="linux"],
.quick-app-card[data-tone="linux"] {
  box-shadow: 
    inset 0 3px 0 rgba(255, 180, 96, 0.85),
    0 8px 24px rgba(255, 180, 96, 0.12);
}

.guide-card-head h4,
.quick-app-card h4 {
  margin: 0.5rem 0 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
}

.quick-app-head {
  display: grid;
  gap: 0.45rem;
}

.quick-app-head h4 {
  margin: 0;
  font-size: 1.05rem;
}

.guide-chip {
  display: inline-flex;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--accent);
  font-size: 0.8rem;
}

.guide-card-copy,
.quick-app-card p {
  margin: 0.75rem 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.quick-app-card p {
  margin: 0;
}

.guide-actions,
.quick-app-actions {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-top: 0.9rem;
}

.quick-app-actions {
  margin-top: 0;
  align-items: stretch;
}

.quick-launch-link {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 12rem;
  min-height: 2.75rem;
  border-radius: 12px;
  padding: 0.8rem 1rem;
  background: linear-gradient(135deg, rgba(118, 224, 194, 0.24), rgba(21, 170, 131, 0.32));
  border: 1px solid rgba(118, 224, 194, 0.35);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
}

.quick-install-link {
  flex: 0 1 auto;
}

.quick-copy-link {
  background: transparent;
  border-color: var(--line-strong);
}

.guide-step-group {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

.guide-step-group strong {
  color: var(--accent);
}

.guide-step-group ol {
  margin: 0.65rem 0 0;
  padding-left: 1.25rem;
}

.guide-step-group li + li {
  margin-top: 0.45rem;
}

.guide-empty-state {
  padding: 1rem;
  color: var(--muted);
}

.guide-body h2,
.guide-body h3 {
  font-family: var(--font-display);
  margin-top: 0;
}

.guide-body p,
.guide-body li {
  color: var(--text);
}

.guide-body ol {
  padding-left: 1.3rem;
}

.admin-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  margin-bottom: 1rem;
}

.three-up {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.two-up {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.compact {
  align-items: end;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  color: var(--text);
}

.checkbox-row input {
  width: auto;
  margin: 0;
}

.user-card {
  display: grid;
  gap: 0.85rem;
}

.user-card header,
.secret-header {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: start;
  min-width: 0;
}

.mini-actions,
.secret-actions {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.mini-actions button,
.secret-actions button {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  font: inherit;
  border-radius: 999px;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
}

.detail-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.detail-block h3 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
}

.detail-block-wide {
  grid-column: 1 / -1;
}

@media (min-width: 600px) {
  .detail-block-span-2 {
    grid-column: span 2;
  }
}

.detail-block p {
  margin: 0;
}

.quick-app-section {
  display: grid;
  gap: 0.85rem;
}

.quick-app-copy {
  display: grid;
  gap: 0.2rem;
}

.quick-start-block .quick-app-copy .hint {
  max-width: 50rem;
}

.quick-app-copy strong {
  display: block;
}

.quick-app-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.secret-value.is-blurred {
  filter: blur(7px);
  user-select: none;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  font-size: 0.82rem;
  text-transform: capitalize;
}

.status-pill.online {
  color: var(--accent);
}

.status-pill.offline,
.status-pill.invalid {
  color: var(--danger);
}

.status-pill.unknown {
  color: var(--warn);
}

.hint {
  color: var(--muted);
  font-size: 0.88rem;
}

.hidden {
  display: none !important;
}

body.modal-open {
  overflow: hidden;
}

.media-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.media-modal.hidden {
  display: none !important;
}

.media-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 12, 18, 0.7);
  backdrop-filter: blur(10px);
  cursor: pointer;
}

.media-modal-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(760px, 100%);
  max-height: calc(100vh - 2rem);
  background: var(--surface-strong);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.media-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  padding: 1.1rem 1.3rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(118, 224, 194, 0.14), transparent);
}

.media-modal-header h3 {
  margin: 0.25rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2.2vw, 1.55rem);
  line-height: 1.2;
}

.media-modal-body {
  padding: 1.1rem 1.3rem 1.3rem;
  overflow-y: auto;
}

.media-modal-video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
}

.media-modal-video {
  width: 100%;
  height: 100%;
  display: block;
}

.media-modal-fallback {
  margin: 0.9rem 0 0;
  padding: 0.85rem 1rem;
  color: var(--warn);
  background: rgba(255, 180, 96, 0.08);
  border: 1px solid rgba(255, 180, 96, 0.28);
  border-radius: 12px;
  line-height: 1.5;
}

.media-modal-steps {
  margin: 0;
  padding-left: 1.4rem;
  color: var(--text);
  line-height: 1.65;
}

.media-modal-steps li {
  padding-left: 0.25rem;
}

.media-modal-steps li + li {
  margin-top: 0.7rem;
}

@media (max-width: 640px) {
  .media-modal {
    padding: 0.5rem;
  }

  .media-modal-card {
    max-height: calc(100vh - 1rem);
    border-radius: 14px;
  }

  .media-modal-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
  }

  .media-modal-header .action-button {
    align-self: flex-end;
  }
}

@media (max-width: 980px) {
  .masthead,
  .auth-band,
  .summary-band,
  .content-band,
  .summary-stats {
    grid-template-columns: 1fr;
  }

  .section-heading,
  .user-card header,
  .secret-header {
    align-items: start;
    flex-direction: column;
  }

  .guide-actions,
  .quick-app-actions {
    width: 100%;
  }

  .masthead-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .shell {
    width: calc(100vw - 1rem);
    padding-top: 0.75rem;
  }

  .masthead,
  .auth-band,
  .summary-band,
  .primary-band,
  .content-band,
  .admin-band {
    padding: 1rem;
    border-radius: 16px;
  }

  .masthead h1,
  .summary-copy h2,
  .section-heading h2,
  .auth-copy h2 {
    font-size: clamp(2rem, 10vw, 3rem);
  }

  .masthead-actions {
    width: 100%;
  }

  .masthead-actions .action-button {
    flex: 1 1 8rem;
    text-align: center;
  }

  .secret-actions,
  .mini-actions,
  .guide-actions,
  .quick-app-actions {
    width: 100%;
  }

  .secret-actions button,
  .mini-actions button,
  .guide-link,
  .quick-launch-link {
    flex: 1 1 9rem;
    text-align: center;
  }

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

.site-footer {
  margin-top: 4rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  text-align: center;
}

.site-footer .footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
}

.site-footer a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color var(--motion-fast) ease-out;
}

.site-footer a:hover {
  color: var(--primary);
  text-decoration: underline;
}
