/* Hub — Mobile-first (390x844 target) */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0f0f1a;
  color: #fff;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 4px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(15, 15, 26, 0.9);
}

.header-title {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.header-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #1a1a3a;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  padding: 0;
}

.header-btn:active {
  opacity: 0.7;
}

/* Sections */
.section-pad {
  padding: 12px 16px 0;
}

.section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #555;
  margin-bottom: 8px;
}

/* Favorites Grid */
.favorites-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.fav-tile {
  text-align: center;
  cursor: pointer;
  position: relative;
}

.fav-tile:active {
  opacity: 0.7;
}

.fav-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin: 0 auto 3px;
  position: relative;
}

.streak-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  background: #f97316;
  color: #fff;
  font-size: 7px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 6px;
  line-height: 1.3;
  white-space: nowrap;
}

.fav-name {
  font-size: 9px;
  color: #ddd;
  font-weight: 500;
}

.fav-last {
  font-size: 8px;
  color: #666;
}

/* Divider */
.divider {
  height: 1px;
  background: #1a1a3a;
  margin: 10px 16px;
}

/* All Tracks */
.all-tracks {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 100px;
}

.track-card {
  background: #1a1a2e;
  border: 1px solid #2a2a4a;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: row;
  gap: 10px;
  align-items: center;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.track-card:active {
  opacity: 0.7;
}

.card-icon {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.card-text {
  flex: 1;
  min-width: 0;
}

.card-name {
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}

.card-stats {
  font-size: 10px;
  color: #888;
  margin-top: 1px;
}

.card-chevron {
  color: #444;
  font-size: 14px;
  flex-shrink: 0;
}

/* FAB */
.fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #3b82f6;
  border: none;
  cursor: pointer;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
  z-index: 100;
}

.fab:active {
  opacity: 0.7;
}

/* Utility */
.hidden {
  display: none;
}

/* Log Viewer */
.log-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 8px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(15, 15, 26, 0.9);
}

.log-back-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #1a1a3a;
  border: none;
  cursor: pointer;
  color: #fff;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.log-back-btn:active {
  opacity: 0.7;
}

.log-title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

/* Filter chips */
.log-filters {
  display: flex;
  gap: 6px;
  padding: 6px 16px 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.log-filters::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  flex-shrink: 0;
  padding: 4px 12px;
  border-radius: 16px;
  border: 1px solid #2a2a4a;
  background: #1a1a2e;
  color: #999;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.filter-chip:active {
  opacity: 0.7;
}

.filter-chip.active {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #fff;
}

/* Date group */
.log-date-group {
  padding: 10px 16px 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #555;
  font-weight: 600;
  position: sticky;
  top: 52px;
  background: #0f0f1a;
  z-index: 10;
}

/* Log entries */
.log-entry {
  margin: 0 12px 4px;
  background: #1a1a2e;
  border: 1px solid #2a2a4a;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
}

.log-entry:active {
  opacity: 0.85;
}

.log-entry-summary {
  display: flex;
  gap: 8px;
  padding: 8px 10px;
  align-items: flex-start;
}

.log-entry-color {
  width: 3px;
  min-height: 32px;
  border-radius: 2px;
  flex-shrink: 0;
  align-self: stretch;
}

.log-entry-body {
  flex: 1;
  min-width: 0;
}

.log-entry-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.log-entry-track {
  font-size: 10px;
  font-weight: 600;
  color: #aaa;
}

.log-entry-time {
  font-size: 9px;
  color: #666;
  flex-shrink: 0;
}

.log-entry-question {
  font-size: 11px;
  color: #ddd;
  margin-top: 2px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.log-entry-preview {
  font-size: 10px;
  color: #777;
  margin-top: 2px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Expanded entry */
.log-entry.expanded .log-entry-question {
  -webkit-line-clamp: unset;
  display: block;
}

.log-entry.expanded .log-entry-preview {
  display: none;
}

.log-entry-detail {
  display: none;
  padding: 0 10px 10px 21px;
}

.log-entry.expanded .log-entry-detail {
  display: block;
}

.log-entry-response {
  font-size: 11px;
  color: #bbb;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 6px;
}

.log-entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.log-meta-tag {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #0f0f1a;
  color: #888;
  border: 1px solid #2a2a4a;
}

/* Load more */
.log-load-more-wrap {
  padding: 12px 16px 100px;
  text-align: center;
}

.log-load-more {
  padding: 8px 24px;
  border-radius: 8px;
  background: #1a1a3a;
  border: 1px solid #2a2a4a;
  color: #aaa;
  font-size: 12px;
  cursor: pointer;
}

.log-load-more:active {
  opacity: 0.7;
}

/* Empty state */
.log-empty {
  text-align: center;
  color: #555;
  padding: 40px 16px;
  font-size: 13px;
}

/* Long-press animation */
@keyframes long-press-scale {
  0% { transform: scale(1); }
  50% { transform: scale(0.9); }
  100% { transform: scale(1); }
}

.fav-tile.long-pressed {
  animation: long-press-scale 0.3s ease;
}
