:root {
  color-scheme: dark;
  --bg: #000000;
  --panel: #0d0d0d;
  --panel-strong: #050505;
  --text: #f1f1f1;
  --muted: #999999;
  --highlight: #ffffff;
  --button-gold: #ffffff;
  --button-text: #111111;
  --border: rgba(255, 255, 255, 0.08);
  --phone-bg: #0b0b0b;
  --phone-text: #ffffff;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.splash-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000000;
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.5s ease;
}

.splash-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.splash-screen video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.enter-gate {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000000;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
}

.enter-gate.hidden {
  display: none;
}

.enter-gate-title {
  font-size: clamp(1.8rem, 6vw, 3rem);
  font-weight: bold;
  color: var(--highlight);
  letter-spacing: 0.05em;
}

.enter-gate-btn {
  font-size: 1.1rem;
  padding: 16px 48px;
}

.auth-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 8px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  border-radius: 10px;
  font-weight: bold;
}

.auth-tab.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-form.hidden {
  display: none;
}

.auth-form input {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 1rem;
}

.auth-link {
  background: transparent;
  border: none;
  color: var(--highlight);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 4px;
  text-align: center;
}

.auth-error {
  background: rgba(220, 60, 60, 0.15);
  border: 1px solid rgba(220, 60, 60, 0.4);
  color: #ffb4b4;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.9rem;
}

.auth-success {
  background: rgba(60, 180, 100, 0.15);
  border: 1px solid rgba(60, 180, 100, 0.4);
  color: #b6f2c9;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.9rem;
}

.auth-error.hidden,
.auth-success.hidden {
  display: none;
}

.history-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  z-index: 1400;
  display: flex;
  align-items: center;
  justify-content: center;
}

.history-panel.hidden {
  display: none;
}

.history-panel-inner {
  background: var(--panel-strong);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 24px;
  width: min(90vw, 640px);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.history-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.history-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-entry {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 12px 14px;
}

.history-entry-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.history-entry ul {
  margin: 4px 0 0;
  padding-left: 16px;
  font-size: 0.9rem;
}

.history-empty {
  color: var(--muted);
  text-align: center;
  padding: 20px 0;
}

.save-toast {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 1300;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.82);
  color: #ffffff;
  border-radius: 14px;
  font-size: 0.92rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.save-toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.site-footer {
  max-width: 920px;
  margin: 32px auto 0;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.owner-link-visible {
  display: inline-block;
  text-align: center;
  padding: 12px 28px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  font-size: 1rem;
  font-weight: bold;
}

.owner-link-visible:hover {
  background: rgba(255, 255, 255, 0.12);
}

.security-shell {
  max-width: 920px;
  margin: 0 auto;
  padding: 28px 24px 32px;
}

header h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.6rem);
}

header p {
  margin: 8px 0 22px;
  color: #94a3b8;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.hamburger {
  position: fixed;
  top: 22px;
  right: 24px;
  z-index: 1100;
  background: rgba(0, 0, 0, 0.35);
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 34px;
  height: 24px;
  padding: 6px;
  border-radius: 8px;
  flex-shrink: 0;
}

body.light-mode .hamburger {
  background: rgba(255, 255, 255, 0.5);
}

.hamburger span {
  display: block;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background-color: #f1f1f1 !important;
}

body.light-mode .hamburger span {
  background-color: #111111 !important;
}

.header-top .title-block {
  min-width: 0;
  padding-right: 50px;
}

.profile-card {
  min-width: 0;
}

.profile-info span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--button-gold);
  color: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  overflow: hidden;
  position: relative;
}

.avatar-canvas {
  display: none;
  width: 52px;
  height: 52px;
  border-radius: 50%;
}

.avatar-canvas.visible {
  display: block;
}

.profile-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-email {
  color: #94a3b8;
  font-size: 0.9rem;
}

.side-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100vh;
  max-height: 100dvh;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.96);
  backdrop-filter: blur(12px);
  box-shadow: 24px 0 60px rgba(0, 0, 0, 0.34);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  z-index: 1000;
  transform: translateX(-320px);
  transition: transform 0.25s ease;
}

.side-menu:not(.hidden) {
  transform: translateX(0);
}

.menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.close-menu {
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 1.6rem;
  cursor: pointer;
}

.menu-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.menu-item {
  width: 100%;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border-radius: 14px;
  padding: 14px 16px;
  text-align: right;
  cursor: pointer;
}

.menu-item:disabled {
  opacity: 0.6;
  cursor: default;
}

.menu-item.gold {
  background: var(--button-gold);
  color: var(--button-text);
}

body.light-mode .menu-item,
body.light-mode .menu-color span,
body.light-mode .link-item,
body.light-mode .menu-note,
body.light-mode .close-menu {
  color: #111111;
}

body:not(.light-mode) .menu-note,
body:not(.light-mode) .close-menu {
  color: #f1f1f1;
}

.menu-color {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.menu-color input {
  border: none;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 12px;
  cursor: pointer;
}

.rgb-box {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text);
  font-size: 0.9rem;
}

.rgb-box .rgb-label {
  opacity: 0.8;
  letter-spacing: 0.08em;
}

body,
.security-shell,
.side-menu,
.action-panel,
.phone-panel,
.status-card,
.report-panel,
.btn,
.menu-item,
.app-select,
.rgb-box {
  transition: background 0.35s ease, color 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
}

.language-popup {
  position: absolute;
  right: 0;
  top: 48px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  min-width: 160px;
  z-index: 1200;
  padding: 8px 6px;
}

.language-popup.hidden { display: none; }

.language-popup button {
  width: 100%;
  text-align: right;
  background: transparent;
  border: none;
  padding: 8px 10px;
  color: var(--text);
  cursor: pointer;
  border-radius: 8px;
}

.language-popup button:hover { background: rgba(255,255,255,0.04); }

/* Display selected language text and hide native select box appearance */
.language-display {
  color: var(--text);
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
}

#languageSelect {
  background: transparent;
  border: none;
  color: transparent;
  text-shadow: 0 0 0 transparent;
  width: 0;
  height: 0;
  padding: 0;
  margin: 0;
  appearance: none;
}

.link-item {
  text-decoration: none;
}

.menu-note {
  color: #c8d1e0;
  font-size: 0.9rem;
  line-height: 1.4;
}

.action-panel {
  background: var(--panel-strong);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  padding: 22px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  margin-bottom: 20px;
}

.phone-panel {
  background: var(--phone-bg);
  color: var(--phone-text);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  padding: 22px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  margin-bottom: 20px;
}

.phone-panel .action-row {
  gap: 12px;
}

.phone-panel .selected-path {
  color: #94a3b8;
}

.progress-bar-container {
  margin: 14px 0 20px;
  display: grid;
  gap: 8px;
}

.progress-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

.progress-bar {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: visible;
  border: 1px solid rgba(255, 255, 255, 0.14);
  position: relative;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: var(--highlight);
  border-radius: 999px;
  position: relative;
}

/* fill-text removed: using .progress-label as the visible percentage */

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 18px;
}

 .app-select {
   flex: 1;
   min-width: 220px;
   padding: 14px 16px;
   border-radius: 16px;
   border: 1px solid rgba(255, 255, 255, 0.12);
   background: rgba(255, 255, 255, 0.04);
   color: var(--text);
   font-size: 1rem;
   appearance: none;
 }
 
 .app-status-row {
   display: flex;
   align-items: center;
   justify-content: space-between;
   gap: 12px;
   margin-top: 14px;
   flex-wrap: wrap;
 }
 
 .app-status-item {
   display: flex;
   flex-direction: column;
   gap: 4px;
   flex: 1;
   min-width: 130px;
 }
 
 .status-eye.small {
   font-size: 1.1rem;
   padding: 10px 10px;
 }
 
 .status-eye.small:hover {
   background: rgba(255,255,255,0.08);
 }
 
  color: var(--text);
  font-size: 1rem;
}

.path-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.status-card,
.report-panel {
  background: var(--panel-strong);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  padding: 22px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  margin-bottom: 20px;
}

.status-card h2,
.report-panel h2 {
  margin: 0 0 18px;
  color: var(--highlight);
}

.status-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.status-eye {
  background: transparent;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  color: var(--text);
}

.status-details {
  position: relative;
  margin-top: 12px;
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.06);
  padding: 12px;
  border-radius: 12px;
}

.status-details.hidden {
  display: none;
}

.status-details h3 {
  margin: 6px 0;
  font-size: 0.95rem;
  color: var(--highlight);
}

.status-details ul {
  margin: 6px 0 12px 0;
  padding-left: 16px;
  max-height: 140px;
  overflow: auto;
}

.status-details li {
  color: var(--text);
  font-size: 0.95rem;
  margin: 4px 0;
}

.status-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.status-item:last-child {
  border-bottom: none;
}

.status-item span {
  color: #94a3b8;
}

.report-panel pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 520px;
  overflow: auto;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 18px;
}

.report-problem-btn {
  margin-top: 14px;
}

.btn {
  border: none;
  cursor: pointer;
  padding: 14px 22px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 1rem;
  transition: transform 0.2s ease, background 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.14);
}

.btn.gold {
  background: var(--button-gold);
  color: var(--button-text);
}

.menu-item.gold {
  background: var(--button-gold);
  color: var(--button-text);
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  font-weight: bold;
}

.selected-path {
  margin-top: 10px;
  color: #94a3b8;
}

body.light-mode {
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  color: #1f2937;
  --text: #111111;
  --muted: #4b5563;
  --panel: #f3f4f6;
  --panel-strong: #f8fafc;
  --border: rgba(15, 23, 42, 0.1);
  --phone-bg: #ffffff;
  --phone-text: #111111;
}

body.light-mode .side-menu {
  background: rgba(255, 255, 255, 0.98);
}

body.light-mode .menu-item,
body.light-mode .menu-color,
body.light-mode .link-item {
  background: rgba(15, 23, 42, 0.06);
  color: #1f2937;
}

body.light-mode .menu-note {
  color: #475569;
}

body.light-mode .close-menu {
  color: #1f2937;
}

body.light-mode .action-panel,
body.light-mode .status-card,
body.light-mode .report-panel {
  background: #f8fafc;
  box-shadow: 0 18px 40px rgba(148, 163, 184, 0.18);
}

body.light-mode .path-input {
  background: #ffffff;
  color: #1f2937;
  border-color: rgba(148, 163, 184, 0.4);
}

body.light-mode .path-input::placeholder {
  color: rgba(100, 116, 139, 0.6);
}

/* ensure phone-panel progress text contrasts with panel background */
.phone-panel .progress-label {
  color: var(--phone-text);
}

.phone-panel .progress-fill .fill-text {
  color: var(--phone-text);
}

body.light-mode .report-panel pre {
  background: #ffffff;
  border-color: rgba(148, 163, 184, 0.25);
}
