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

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --border: rgba(255, 255, 255, 0.08);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.45);
  --accent: #ff6b35;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 3.5rem 1rem 1rem;
  gap: 0.75rem;
}

#stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  flex-shrink: 0;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.5rem 0.45rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

#input {
  flex: 1;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.6;
  padding: 0.85rem 1rem;
  resize: none;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
  transition: border-color 0.15s ease;
}

#input:focus {
  border-color: rgba(232, 121, 249, 0.35);
}

#input::placeholder {
  color: var(--muted);
}

#clear-btn {
  flex-shrink: 0;
  align-self: flex-end;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 0.4rem 0.9rem;
  transition: color 0.15s ease, border-color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

#clear-btn:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.25);
}

@media (min-width: 600px) {
  #app {
    max-width: 720px;
    margin: 0 auto;
    padding-top: 4rem;
  }

  #stats {
    grid-template-columns: repeat(6, 1fr);
  }

  .stat-value {
    font-size: 1.5rem;
  }
}

.back-link {
  position: fixed;
  top: 1.2rem;
  left: 1.5rem;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s ease;
  z-index: 10;
}

.back-link:hover {
  color: var(--text);
}

#install-btn {
  position: fixed;
  top: 1.2rem;
  right: 1.5rem;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0;
  z-index: 10;
  transition: color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

#install-btn:hover {
  color: var(--text);
}
