/* DroidStore — theme tokens mirror coins.megahard.pro
   (dark default, :has(#theme-toggle:checked) flip to light) */

*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%}
body{
  font-family:Arial,sans-serif;
  font-size:13px;
  color:#e6edf3;
  background:#0d1117;
  line-height:1.4;
  min-height:100vh;
}
a{color:inherit;text-decoration:none}
a.link{color:#58a6ff}
a.link:hover{text-decoration:underline}
button{font:inherit;color:inherit;background:none;border:none;cursor:pointer}

/* Header */
header{padding:12px 16px;border-bottom:1px solid #30363d;display:flex;align-items:center;gap:12px;flex-wrap:wrap}
header h1{font-size:15px;font-weight:bold}
header .sub{font-size:11px;color:#8b949e}
header .grow{flex:1}

.search{
  background:#161b22;border:1px solid #30363d;color:#e6edf3;
  border-radius:4px;padding:5px 9px;font-size:12px;min-width:180px;
}
.search:focus{outline:none;border-color:#58a6ff}

/* Theme toggle — same pattern as coins */
.theme-toggle{position:absolute;opacity:0;pointer-events:none}
.theme-label{
  cursor:pointer;font-size:14px;user-select:none;
  padding:3px 9px;border:1px solid #30363d;border-radius:4px;
  background:#161b22;color:#e6edf3;line-height:1.2;
}
.theme-label::before{content:"\2600"}

/* Connect / device card */
.device{
  margin:14px 16px;padding:12px 14px;border:1px solid #30363d;border-radius:6px;
  background:#161b22;display:flex;align-items:center;gap:14px;flex-wrap:wrap;
}
.device .info{flex:1;min-width:180px}
.device .info .line1{font-weight:bold}
.device .info .line2{color:#8b949e;font-size:11px;margin-top:2px}
.device .actions{display:flex;gap:8px}
.btn{
  background:#238636;color:#fff;border:1px solid #2ea043;
  border-radius:4px;padding:6px 12px;font-size:12px;font-weight:bold;cursor:pointer;
}
.btn:hover{background:#2ea043}
.btn:disabled{background:#30363d;border-color:#30363d;color:#8b949e;cursor:not-allowed}
.btn.secondary{background:#21262d;border-color:#30363d;color:#e6edf3}
.btn.secondary:hover{background:#30363d}
.btn.danger{background:#da3633;border-color:#f85149}
.btn.danger:hover{background:#f85149}

/* Tab bar — sits below the device card, above the per-tab content */
.tabs{
  display:flex;gap:0;margin:14px 16px 0;border-bottom:1px solid #30363d;
  flex-wrap:wrap;
}
.tab{
  padding:8px 14px;font-size:12px;font-weight:bold;color:#8b949e;
  background:none;border:none;border-bottom:2px solid transparent;
  cursor:pointer;text-transform:uppercase;letter-spacing:0.5px;
  margin-bottom:-1px;
}
.tab:hover:not(:disabled):not(.active){color:#e6edf3}
.tab.active{color:#e6edf3;border-bottom-color:#58a6ff}
.tab:disabled{color:#484f58;cursor:not-allowed;opacity:0.55}

/* Per-tab search row */
.tab-search-row{
  padding:12px 16px 0;display:flex;gap:8px;align-items:center;flex-wrap:wrap;
}
.tab-search-row .search{flex:1;min-width:180px}

body:has(#theme-toggle:checked) .tabs{border-bottom-color:#e0e0e0}
body:has(#theme-toggle:checked) .tab{color:#888}
body:has(#theme-toggle:checked) .tab:hover:not(:disabled):not(.active){color:#111}
body:has(#theme-toggle:checked) .tab.active{color:#111;border-bottom-color:#0969da}
body:has(#theme-toggle:checked) .tab:disabled{color:#c0c0c0}

/* Sections */
section{padding:8px 16px 18px}
section h2{font-size:13px;font-weight:bold;color:#e6edf3;margin:14px 0 8px;text-transform:uppercase;letter-spacing:0.5px}
section h2 .count{color:#8b949e;font-weight:normal;margin-left:6px}

/* Card grid */
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:10px}

.card{
  border:1px solid #30363d;border-radius:6px;background:#161b22;
  padding:10px 12px;display:flex;flex-direction:column;gap:6px;min-height:104px;
}
.card .top{display:flex;align-items:center;gap:10px}
.card .icon{
  width:36px;height:36px;border-radius:8px;background:#0d1117;
  display:flex;align-items:center;justify-content:center;font-weight:bold;color:#8b949e;
  flex-shrink:0;border:1px solid #30363d;font-size:14px;text-transform:uppercase;
}
.card .icon-img{
  width:36px;height:36px;border-radius:8px;flex-shrink:0;object-fit:cover;background:#0d1117;
  border:1px solid #30363d;
}
.card .src-tag{
  display:inline-block;font-size:9px;font-weight:normal;text-transform:uppercase;
  color:#8b949e;border:1px solid #30363d;border-radius:3px;padding:0 4px;
  vertical-align:1px;margin-left:4px;letter-spacing:0.3px;
}
body:has(#theme-toggle:checked) .card .icon-img{background:#fff;border-color:#e0e0e0}
body:has(#theme-toggle:checked) .card .src-tag{color:#888;border-color:#d0d0d0}
.card .title{font-weight:bold;font-size:13px;color:#e6edf3;line-height:1.2;word-break:break-word}
.card .pkg{font-size:10px;color:#6e7681;font-family:Menlo,Consolas,monospace;word-break:break-all;margin-top:1px}
.card .summary{color:#8b949e;font-size:11px;line-height:1.35;flex:1}
.card .meta{display:flex;justify-content:space-between;align-items:center;gap:8px;flex-wrap:wrap}
.card .ver{color:#8b949e;font-size:11px}
.card .ver .have{color:#e6edf3}
.card .ver .arrow{margin:0 4px;color:#3fb950}
.card .ver .new{color:#3fb950;font-weight:bold}
.card .age{color:#6e7681;font-size:11px;cursor:help}
body:has(#theme-toggle:checked) .card .age{color:#777}
.card .actions{display:flex;gap:6px}
.card .btn{padding:4px 10px;font-size:11px}
.card.installed-current .top .title::after{content:" \2713";color:#3fb950}
.card.installed-outdated{border-color:#bb8009}
.card.installing .actions{opacity:0.5;pointer-events:none}
.card .status{font-size:11px;color:#8b949e;font-style:italic}
.card .status.err{color:#f85149;font-style:normal}
.card .status.ok{color:#3fb950}
.card .status .reinstall-btn{display:inline-block;margin-top:6px;vertical-align:middle}
.card .dl{margin:2px 0 0}
.card .dl-bar{height:5px;background:#21262d;border:1px solid #30363d;border-radius:3px;overflow:hidden}
.card .dl-bar-fill{height:100%;background:#3fb950;width:0;transition:width 0.15s linear}
.card .dl-text{margin-top:3px;font-size:10px;color:#8b949e;font-family:Menlo,Consolas,monospace}
body:has(#theme-toggle:checked) .card .dl-bar{background:#f0f0f0;border-color:#d0d0d0}
body:has(#theme-toggle:checked) .card .dl-text{color:#888}

/* Loading / errors */
.notice{
  margin:16px;padding:14px;border:1px solid #30363d;border-radius:6px;background:#161b22;
}
.notice.error{border-color:#f85149;color:#f85149}
.notice.warn{border-color:#bb8009}
.empty{color:#8b949e;font-size:12px;font-style:italic;padding:8px 0}

/* Unsupported-browser full-page notice */
.unsupported{
  display:flex;align-items:center;justify-content:center;min-height:80vh;padding:24px;
}
.unsupported .inner{
  max-width:560px;border:1px solid #30363d;border-radius:8px;background:#161b22;
  padding:24px 28px;
}
.unsupported h2{font-size:18px;margin-bottom:14px}
.unsupported p{margin:8px 0;color:#c9d1d9}
.unsupported .ok{color:#3fb950}
.unsupported .bad{color:#f85149}
.unsupported ul{margin:6px 0 12px 20px;color:#c9d1d9}

/* Donate footer parity with coins */
.donate-section{margin:3rem auto 2rem;text-align:center}
.donate-label{font-size:13px;color:#8b949e;margin-bottom:10px}
.donate-qr{width:160px;height:160px;border-radius:8px;border:1px solid #30363d;background:#fff}
@media(max-width:600px){.donate-qr{width:140px;height:140px}}
body:has(#theme-toggle:checked) .donate-qr{border-color:#e0e0e0}

/* Spinner */
.spin{
  display:inline-block;width:10px;height:10px;border-radius:50%;
  border:2px solid #30363d;border-top-color:#58a6ff;animation:spin 0.7s linear infinite;
  vertical-align:-1px;margin-right:4px;
}
@keyframes spin{to{transform:rotate(360deg)}}

/* Light theme — mirror coins' :has(#theme-toggle:checked) flip */
body:has(#theme-toggle:checked){color:#111;background:#fff}
body:has(#theme-toggle:checked) header{border-bottom-color:#e0e0e0}
body:has(#theme-toggle:checked) header .sub{color:#888}
body:has(#theme-toggle:checked) .theme-label{background:#fff;color:#111;border-color:#d0d0d0}
body:has(#theme-toggle:checked) .theme-label::before{content:"\263E"}
body:has(#theme-toggle:checked) .search{background:#fff;color:#111;border-color:#d0d0d0}
body:has(#theme-toggle:checked) .device,
body:has(#theme-toggle:checked) .card,
body:has(#theme-toggle:checked) .notice,
body:has(#theme-toggle:checked) .unsupported .inner{background:#fafafa;border-color:#e0e0e0}
body:has(#theme-toggle:checked) .card .title,
body:has(#theme-toggle:checked) section h2{color:#111}
body:has(#theme-toggle:checked) .card .summary,
body:has(#theme-toggle:checked) .device .info .line2,
body:has(#theme-toggle:checked) .card .ver,
body:has(#theme-toggle:checked) .status,
body:has(#theme-toggle:checked) section h2 .count,
body:has(#theme-toggle:checked) .donate-label{color:#666}
body:has(#theme-toggle:checked) .card .icon{background:#fff;border-color:#e0e0e0;color:#888}
body:has(#theme-toggle:checked) .card .pkg{color:#aaa}
body:has(#theme-toggle:checked) .btn.secondary{background:#fff;border-color:#d0d0d0;color:#111}
body:has(#theme-toggle:checked) .btn.secondary:hover{background:#f0f0f0}
body:has(#theme-toggle:checked) .card.installed-outdated{border-color:#d98e00}
body:has(#theme-toggle:checked) .unsupported p,
body:has(#theme-toggle:checked) .unsupported ul{color:#333}
body:has(#theme-toggle:checked) .ver .have{color:#111}
body:has(#theme-toggle:checked) .pos,
body:has(#theme-toggle:checked) .ver .new{color:#0a7d3e}

@media(max-width:600px){
  header h1{font-size:14px}
  .grid{grid-template-columns:repeat(auto-fill,minmax(170px,1fr))}
  .search{min-width:0;width:100%}
}
