/* ============================================================
   Keep Alive — Dead Man's Switch
   Wide layout · No glassmorphism · Windows-style explorer
   ============================================================ */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --accent-1: #6366f1;
  --accent-2: #06b6d4;
  --accent-3: #8b5cf6;
  --discord: #5865F2;
  --text: #e2e8f0;
  --text-dim: rgba(255, 255, 255, 0.45);
  --text-dimmer: rgba(255, 255, 255, 0.25);
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.065);
  --surface-active: rgba(255, 255, 255, 0.09);
  --border: rgba(255, 255, 255, 0.07);
  --border-light: rgba(255, 255, 255, 0.12);
  --danger: #f87171;
  --warning: #fbbf24;
  --mono: 'JetBrains Mono', monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius: 10px;
}

body {
  font-family: var(--sans);
  min-height: 100vh;
  background: #07070b;
  color: var(--text);
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}

body::-webkit-scrollbar { width: 6px; }
body::-webkit-scrollbar-track { background: transparent; }
body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }

/* ── Animated background ── */

.bg-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.bg-glow .orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
  opacity: 0.3;
}

.bg-glow .orb:nth-child(1) {
  width: 600px; height: 600px;
  background: var(--accent-1);
  top: -10%; left: -5%;
  animation: drift1 180s ease-in-out infinite;
}

.bg-glow .orb:nth-child(2) {
  width: 500px; height: 500px;
  background: var(--accent-2);
  bottom: -15%; right: -5%;
  animation: drift2 220s ease-in-out infinite;
}

.bg-glow .orb:nth-child(3) {
  width: 400px; height: 400px;
  background: var(--accent-3);
  top: 50%; left: 50%;
  animation: drift3 240s ease-in-out infinite;
}

@keyframes drift1 {
  0%   { transform: translate(0, 0) scale(1); }
  15%  { transform: translate(25vw, 15vh) scale(1.1); }
  35%  { transform: translate(40vw, 50vh) scale(0.9); }
  55%  { transform: translate(10vw, 60vh) scale(1.05); }
  75%  { transform: translate(-10vw, 30vh) scale(0.95); }
  100% { transform: translate(0, 0) scale(1); }
}

@keyframes drift2 {
  0%   { transform: translate(0, 0) scale(1); }
  20%  { transform: translate(-30vw, -20vh) scale(1.08); }
  40%  { transform: translate(-50vw, -40vh) scale(0.92); }
  60%  { transform: translate(-20vw, -60vh) scale(1.04); }
  80%  { transform: translate(10vw, -25vh) scale(0.96); }
  100% { transform: translate(0, 0) scale(1); }
}

@keyframes drift3 {
  0%   { transform: translate(-50%, -50%) scale(1); }
  12%  { transform: translate(-30%, -20%) scale(1.06); }
  30%  { transform: translate(10%, -60%) scale(0.9); }
  48%  { transform: translate(25%, 10%) scale(1.1); }
  65%  { transform: translate(-10%, 30%) scale(0.94); }
  82%  { transform: translate(-40%, -10%) scale(1.03); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

.bg-glow::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
}

/* ── Layout ── */

#content {
  position: relative;
  z-index: 1;
  width: 100%;
  margin: 0 auto;
  padding: 32px 48px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.hidden { display: none !important; }

/* ── Card base ── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
}

.card-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 16px;
}

/* ── Header ── */

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--border);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-icon {
  color: var(--accent-1);
  flex-shrink: 0;
}

.header h1 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.auth-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 14px 3px 3px;
  font-size: 0.8rem;
}

.user-badge img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

.btn-logout {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-family: var(--sans);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-logout:hover {
  border-color: rgba(248, 113, 113, 0.4);
  color: var(--danger);
}

/* ── Top row (explanation + timer) ── */

.top-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* Explanation */
.explanation-card p {
  color: var(--text-dim);
  font-size: 1.05rem;
  line-height: 1.75;
  margin-bottom: 12px;
}

.explanation-card p:last-child { margin-bottom: 0; }

.explanation-card strong {
  color: var(--text);
  font-weight: 500;
}

/* Timer */
.timer-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.timer {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
}

.timer-segment {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.timer-value {
  font-family: var(--mono);
  font-size: 4.5rem;
  font-weight: 600;
  line-height: 1;
  color: var(--text);
  min-width: 2.2ch;
  text-align: center;
  font-variant-numeric: tabular-nums;
  transition: color 0.4s ease;
}

.timer-unit {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dimmer);
  margin-top: 8px;
}

.timer-sep {
  font-family: var(--mono);
  font-size: 3.8rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.12);
  padding: 0 2px;
  align-self: flex-start;
  line-height: 1;
  transition: color 0.4s;
}

.timer.warning .timer-value { color: var(--warning); }
.timer.warning .timer-sep { color: rgba(251, 191, 36, 0.25); }
.timer.critical .timer-value { color: var(--danger); }
.timer.critical .timer-sep { color: rgba(248, 113, 113, 0.35); animation: blink 1s infinite; }
.timer.ended .timer-value { color: var(--danger); }

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.2; }
}

/* Progress */
.progress-wrap { margin-top: 16px; width: 100%; }

.progress-container {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 100px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
  transition: width 0.5s ease;
  width: 0%;
}

.progress-label {
  display: block;
  margin-top: 6px;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-dimmer);
  letter-spacing: 0.3px;
  text-align: center;
}

/* ── Stats row ── */

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.stat-card {
  text-align: center;
  padding: 20px 16px;
  transition: border-color 0.2s;
}

.stat-card:hover { border-color: var(--border-light); }

.stat-value {
  font-family: var(--mono);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dimmer);
}

.stat-types-card { padding: 0; }

.stat-types-toggle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 16px 12px;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  font-family: inherit;
  transition: background 0.2s;
  border-radius: var(--radius);
}

.stat-types-toggle:hover { background: var(--surface-hover); }

/* File types panel */
.file-types-panel {
  padding: 14px 20px;
}

.file-types-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.file-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-family: var(--mono);
  color: var(--text-dim);
}

.file-type-badge .count {
  color: var(--text);
  font-weight: 600;
}

/* ── Action buttons ── */

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  font-family: var(--sans);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  background: var(--surface);
  color: var(--text);
}

.btn:hover { background: var(--surface-hover); border-color: var(--border-light); }

.btn-discord {
  background: rgba(88, 101, 242, 0.12);
  border-color: rgba(88, 101, 242, 0.25);
  color: #fff;
}

.btn-discord:hover {
  background: rgba(88, 101, 242, 0.2);
  border-color: rgba(88, 101, 242, 0.4);
}

.discord-icon { flex-shrink: 0; }

.btn-locked {
  color: var(--text-dimmer);
  cursor: not-allowed;
  opacity: 0.45;
}

.btn-locked:hover { background: var(--surface); border-color: var(--border); }

/* ═══════════════════════════════════════════════
   EXPLORER — Windows-style file manager
   ═══════════════════════════════════════════════ */

.explorer {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Toolbar / breadcrumb */
.explorer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.explorer-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0;
  font-size: 0.8rem;
}

.breadcrumb-item {
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.15s;
  white-space: nowrap;
}

.breadcrumb-item:hover { color: var(--text); background: var(--surface-hover); }
.breadcrumb-item.active { color: var(--text); cursor: default; }
.breadcrumb-item.active:hover { background: none; }

.breadcrumb-sep {
  color: var(--text-dimmer);
  font-size: 0.7rem;
  margin: 0 2px;
  user-select: none;
}

.explorer-meta {
  font-size: 0.72rem;
  color: var(--text-dimmer);
  font-family: var(--mono);
}

/* Column header */
.explorer-header {
  display: grid;
  grid-template-columns: 32px 1fr 140px 100px 90px;
  align-items: center;
  padding: 0 16px;
  height: 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.015);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-dimmer);
  text-transform: uppercase;
  user-select: none;
}

.explorer-header > div {
  padding: 0 4px;
}

.col-size { text-align: right; }

/* Body rows */
.explorer-body {
  flex: 1;
  min-height: 200px;
  max-height: 500px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.06) transparent;
}

.explorer-body::-webkit-scrollbar { width: 5px; }
.explorer-body::-webkit-scrollbar-track { background: transparent; }
.explorer-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 3px; }

.explorer-row {
  display: grid;
  grid-template-columns: 32px 1fr 140px 100px 90px;
  align-items: center;
  padding: 0 16px;
  height: 34px;
  font-size: 0.8rem;
  cursor: default;
  transition: background 0.1s;
  border-bottom: 1px solid rgba(255,255,255,0.02);
}

.explorer-row:hover {
  background: var(--surface-hover);
}

.explorer-row.selected {
  background: var(--surface-active);
}

.explorer-row.folder-row {
  cursor: pointer;
}

.explorer-row.folder-row:hover {
  background: rgba(99, 102, 241, 0.06);
}

.explorer-row > div {
  padding: 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}

.row-name {
  font-weight: 400;
  color: var(--text);
}

.folder-row .row-name {
  font-weight: 500;
  color: var(--accent-1);
}

.row-date {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-dimmer);
}

.row-type {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.row-size {
  text-align: right;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* Status bar */
.explorer-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.015);
  font-size: 0.7rem;
  color: var(--text-dimmer);
}

/* Explorer empty / loading states */
.explorer-loading,
.explorer-empty,
.explorer-not-authorized {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* ── Footer ── */

.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 20px;
  color: var(--text-dimmer);
  font-size: 0.65rem;
  letter-spacing: 0.4px;
}

/* ── Responsive ── */

@media (max-width: 900px) {
  #content {
    padding: 20px;
  }

  .timer-value { font-size: 3.5rem; }
  .timer-sep { font-size: 2.8rem; }

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

  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .explorer-header,
  .explorer-row {
    grid-template-columns: 28px 1fr 90px;
  }

  .col-date,
  .col-type,
  .row-date,
  .row-type {
    display: none;
  }
}

@media (max-width: 600px) {
  .timer-value { font-size: 2.5rem; }
  .timer-sep { font-size: 2rem; }

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

  .actions-bar {
    flex-direction: column;
  }

  .actions-bar .btn {
    width: 100%;
    justify-content: center;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}
