:root {
  --bg: #0a0a0f;
  --surface: #16161f;
  --surface2: #1e1e2a;
  --border: #2a2a3a;
  --text: #e8e8f0;
  --text2: #8888aa;
  --accent: #6c5ce7;
  --accent2: #a29bfe;
  --green: #00b894;
  --yellow: #fdcb6e;
  --blue: #74b9ff;
  --red: #ff7675;
  --radius: 16px;
  --radius-sm: 10px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.error { color: var(--red); font-size: 0.85rem; margin-top: 8px; }

/* Login */
#login-screen {
  display: flex; align-items: center; justify-content: center;
  min-height: 100dvh;
  background: linear-gradient(135deg, #0a0a1a 0%, #1a1030 50%, #0a0a1a 100%);
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px 36px;
  width: 340px;
  text-align: center;
}
.store-logo { font-size: 64px; margin-bottom: 8px; }
.login-card h1 { font-size: 1.8rem; font-weight: 700; }
.subtitle { color: var(--text2); margin-bottom: 24px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; }
.login-card input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}
.login-card input:focus { border-color: var(--accent); }

/* Buttons */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover { background: var(--accent2); }
.btn-small { padding: 6px 14px; font-size: 0.85rem; background: var(--surface2); color: var(--text2); border: 1px solid var(--border); border-radius: 8px; }
.btn-small:hover { border-color: var(--accent); color: var(--text); }
.btn-green { background: var(--green); color: #000; }
.btn-yellow { background: var(--yellow); color: #000; }
.btn-blue { background: var(--blue); color: #000; }
.btn-action { padding: 8px 16px; font-size: 0.85rem; border-radius: 8px; border: none; cursor: pointer; font-weight: 600; }

/* Header */
header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.header-left { display: flex; align-items: center; gap: 10px; }
.store-icon { font-size: 28px; }
header h1 { font-size: 1.3rem; font-weight: 700; }
.header-right { display: flex; align-items: center; gap: 12px; }
.badge {
  background: var(--accent);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* Filter tabs */
.filter-tabs {
  display: flex; gap: 6px;
  padding: 12px 24px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tab {
  padding: 8px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text2);
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.tab.active { background: var(--accent); color: white; border-color: var(--accent); }
.tab:hover:not(.active) { border-color: var(--accent); color: var(--text); }

/* Category bar */
.category-bar {
  display: flex; gap: 6px;
  padding: 0 24px 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.cat-chip {
  padding: 4px 12px;
  background: var(--surface2);
  border-radius: 12px;
  font-size: 0.75rem;
  color: var(--text2);
  cursor: pointer;
  white-space: nowrap;
}
.cat-chip.active { background: var(--accent); color: white; }

/* App grid */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  padding: 16px 24px 100px;
}

/* App card */
.app-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: all 0.25s;
  position: relative;
  overflow: hidden;
}
.app-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.app-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.app-icon { font-size: 36px; }
.app-name { font-size: 1.1rem; font-weight: 600; }
.app-desc { color: var(--text2); font-size: 0.9rem; line-height: 1.4; margin-bottom: 12px; }
.app-meta { display: flex; gap: 8px; flex-wrap: wrap; }
.app-tag {
  padding: 3px 10px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
}
.tag-running { background: rgba(0,184,148,0.15); color: var(--green); }
.tag-stopped { background: rgba(255,118,117,0.15); color: var(--red); }
.tag-ready { background: rgba(108,92,231,0.15); color: var(--accent2); }
.tag-needs_docker { background: rgba(253,203,110,0.15); color: var(--yellow); }
.tag-concept { background: rgba(116,185,255,0.15); color: var(--blue); }
.tag-category { background: var(--surface2); color: var(--text2); }
.tag-live { background: rgba(0,184,148,0.2); color: var(--green); animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

/* Status dot */
.status-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.dot-running { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot-stopped { background: var(--red); }
.dot-ready { background: var(--accent); }
.dot-needs_docker { background: var(--yellow); }
.dot-concept { background: var(--blue); }

/* Modal */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 600px;
  max-height: 85dvh;
  overflow-y: auto;
  padding: 32px;
  position: relative;
}
.modal-close {
  position: absolute; top: 16px; right: 20px;
  background: none; border: none; color: var(--text2);
  font-size: 24px; cursor: pointer;
}
.modal-close:hover { color: var(--text); }
.modal-header { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.modal-icon { font-size: 48px; }
.modal-title h2 { font-size: 1.5rem; }
.modal-title p { color: var(--text2); }
.modal-section { margin-bottom: 20px; }
.modal-section h3 { font-size: 0.9rem; color: var(--text2); text-transform: uppercase; margin-bottom: 8px; }
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 24px; }
.team-list { list-style: none; }
.team-list li { padding: 6px 0; display: flex; justify-content: space-between; border-bottom: 1px solid var(--border); }
.team-role { color: var(--accent2); font-size: 0.85rem; }

/* Status row in card */
.status-row { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.status-text { font-size: 0.75rem; color: var(--text2); }
.container-count { font-size: 0.7rem; color: var(--accent2); background: rgba(108,92,231,0.15); padding: 1px 8px; border-radius: 8px; }

/* Container list in modal */
.container-list { display: flex; flex-direction: column; gap: 8px; }
.container-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px; background: var(--surface2); border-radius: var(--radius-sm); }
.container-info { display: flex; flex-direction: column; gap: 2px; }
.container-detail { font-size: 0.8rem; color: var(--text2); }

/* Log box */
.log-box {
  background: #0d0d14;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.75rem;
  color: var(--green);
  max-height: 300px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.log-entry { font-size: 0.8rem; color: var(--text2); padding: 3px 0; border-bottom: 1px solid var(--border); }
.log-output { color: var(--text); font-size: 0.75rem; }

/* Stats */
.stats-grid { display: flex; flex-direction: column; gap: 8px; }
.stat-card { background: var(--surface2); border-radius: var(--radius-sm); padding: 12px; }
.stat-name { font-weight: 600; margin-bottom: 6px; }
.stat-row { display: flex; justify-content: space-between; font-size: 0.85rem; padding: 2px 0; }
.stat-val { color: var(--accent2); font-weight: 600; }
.stat-bar { background: var(--border); border-radius: 4px; height: 6px; margin-top: 6px; overflow: hidden; }
.stat-fill { background: var(--accent); height: 100%; border-radius: 4px; transition: width 0.3s; }

/* Action buttons */
.btn-red { background: var(--red); color: #000; }
.hint { font-size: 0.85rem; color: var(--text2); font-style: italic; }

/* Reviews */
.review-avg { font-size: 1.1rem; margin-bottom: 12px; }
.review-score { font-weight: 700; color: var(--accent); }
.review-count { color: var(--text2); font-size: 0.85rem; }
.review-form { padding: 12px 0; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.star-picker { display: flex; gap: 4px; margin-bottom: 8px; }
.star-btn { font-size: 1.5rem; cursor: pointer; transition: transform 0.1s; }
.star-btn:hover { transform: scale(1.3); }
.review-list { display: flex; flex-direction: column; gap: 8px; }
.review-item { padding: 10px; background: var(--surface2); border-radius: var(--radius-sm); }
.review-header { display: flex; justify-content: space-between; align-items: center; }
.review-user { font-weight: 600; font-size: 0.9rem; }
.review-stars { font-size: 0.85rem; }
.review-text { color: var(--text2); font-size: 0.85rem; margin-top: 4px; }
.app-rating { color: var(--yellow); font-size: 0.8rem; font-weight: 600; }

/* Deploy modal */
.deploy-input-row { display: flex; align-items: center; gap: 4px; margin: 8px 0; }
.deploy-input { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); padding: 10px 14px; font-size: 1rem; flex: 1; outline: none; }
.deploy-input:focus { border-color: var(--accent); }
.deploy-domain { color: var(--text2); font-size: 0.95rem; white-space: nowrap; }
.deploy-preview { color: var(--accent); font-size: 0.85rem; margin-top: 4px; }
.deploy-steps { color: var(--text2); font-size: 0.85rem; padding-left: 20px; line-height: 1.8; }
.deploy-log { background: #0d0d14; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; max-height: 250px; overflow-y: auto; font-family: 'SF Mono', monospace; font-size: 0.75rem; }
.deploy-log-entry { color: var(--green); padding: 2px 0; }
.deploy-log-entry.error { color: var(--red); }
.deploy-spinner { color: var(--yellow); font-weight: 600; animation: pulse 1.5s infinite; }

/* Mobile */
@media (max-width: 600px) {
  .app-grid { grid-template-columns: 1fr; padding: 12px 16px 100px; }
  header { padding: 12px 16px; }
  .filter-tabs { padding: 10px 16px; }
  .modal-content { padding: 24px 20px; }
}
