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

html, body {
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

/* App Container */
#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  height: 100dvh;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

/* Header */
.header {
  text-align: center;
  padding: 16px var(--row-padding) 12px;
  flex-shrink: 0;
}

.header-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.header-subtitle {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  margin-top: 2px;
}

.header-separator {
  height: 0.5px;
  background: var(--separator);
  margin: 12px var(--row-padding) 0;
}

/* App List */
.app-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

/* Pull to Refresh Indicator */
.pull-indicator {
  text-align: center;
  padding: 0;
  height: 0;
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 13px;
  transition: height 0.2s, padding 0.2s;
}

.pull-indicator.visible {
  height: 40px;
  padding: 10px 0;
}

.pull-indicator .spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--text-tertiary);
  border-top-color: var(--text-secondary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* App Row */
.app-row {
  display: flex;
  align-items: center;
  padding: 12px var(--row-padding);
  gap: 12px;
}

.app-row-separator {
  height: 0.5px;
  background: var(--separator);
  margin-left: 88px;
  margin-right: var(--row-padding);
}

/* App Icon */
.app-icon {
  width: var(--icon-size);
  height: var(--icon-size);
  min-width: var(--icon-size);
  border-radius: var(--icon-radius);
  background: var(--icon-placeholder);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.app-icon-fallback {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

/* App Info */
.app-info {
  flex: 1;
  min-width: 0;
}

.app-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-meta {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.app-date {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 1px;
}

/* Action Button */
.action-btn {
  flex-shrink: 0;
  height: var(--button-height);
  padding: 0 18px;
  border: none;
  border-radius: var(--button-radius);
  background: var(--accent);
  color: #ffffff;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}

.action-btn:active {
  background: var(--accent-active);
}

.action-btn.update {
  background: var(--accent);
}

.action-btn.open {
  background: var(--bg-tertiary);
  color: var(--accent);
}

/* Footer */
.footer {
  flex-shrink: 0;
  text-align: center;
  padding: 12px var(--row-padding);
}

.footer a {
  color: var(--text-tertiary);
  font-size: 13px;
  text-decoration: none;
}

.footer a:active {
  color: var(--text-secondary);
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-secondary);
  font-size: 15px;
  gap: 8px;
  padding: 40px;
  text-align: center;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 8px;
}
