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

:root {
  --woobles: #2cc1bd;
  --woobles-soft: #d8f3f2;
  --black: #000000;
  --white: #ffffff;
  --gray: #888888;
  --line: #dddddd;
  --border: #d4d4d4;
}

html {
  font-size: 18px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--white);
  color: var(--black);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem;
}

#app {
  width: 100%;
  max-width: 400px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.site-footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--gray);
  margin-top: auto;
  padding-top: 1.25rem;
  line-height: 1.5;
}

.site-footer a {
  color: var(--woobles);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.screen {
  border: 1px solid var(--border);
  padding: 1.5rem;
}

.hidden {
  display: none !important;
}

h1 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.hint {
  color: var(--gray);
  font-size: 0.8rem;
  margin-bottom: 1rem;
  line-height: 1.4;
}

textarea {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--black);
  resize: vertical;
  min-height: 4rem;
  max-height: 21vh;
}

textarea:focus {
  outline: 2px solid var(--woobles);
  outline-offset: 0;
}

.stitch-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin: 0.85rem 0 1.25rem;
  font-size: 0.75rem;
  color: var(--gray);
}

.stitch-legend code {
  background: var(--woobles-soft);
  color: var(--woobles);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 600;
}

button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--black);
}

button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.primary {
  width: 100%;
  padding: 0.75rem;
  background: var(--woobles);
  border-color: var(--woobles);
  color: var(--white);
  font-weight: 600;
  font-size: 0.95rem;
}

.secondary {
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
}

.text-btn {
  background: none;
  border: none;
  color: var(--gray);
  font-size: 0.8rem;
  margin-top: 1rem;
  width: 100%;
  padding: 0.5rem;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.text-btn:hover {
  color: var(--black);
}

/* Tracking screen */
.progress-bar {
  height: 4px;
  background: var(--line);
  overflow: hidden;
  margin-bottom: 0.5rem;
}

#progress-fill {
  height: 100%;
  background: var(--woobles);
  width: 0%;
  transition: width 0.2s ease;
}

.progress-text {
  text-align: center;
  color: var(--gray);
  font-size: 0.65rem;
  margin-bottom: 1rem;
}

.stitch-number {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--woobles);
  margin-bottom: 0.25rem;
}

.current-stitch {
  text-align: center;
  font-size: 1.85rem;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 2rem;
  min-height: 2.25rem;
}

.voice-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 0.75rem;
  color: var(--gray);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.mic-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--line);
}

.mic-dot.listening {
  background: var(--woobles);
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.controls {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.icon-btn {
  width: 2.75rem;
  flex-shrink: 0;
  font-size: 1.1rem;
  padding: 0;
}

.icon-btn.active {
  background: var(--woobles);
  border-color: var(--woobles);
  color: var(--white);
}

.controls .primary {
  flex: 1;
}

.controls .secondary {
  flex-shrink: 0;
}

.round-done .current-stitch {
  font-size: 1.5rem;
}
