/* ===== Counter Screen ===== */

#screen-counter {
  gap: var(--space-md);
}

/* Header */
.counter-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}

.counter-target {
  font-family: var(--font-gothic);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

/* Items list */
.counter-items {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-md);
  flex: 1;
  overflow-y: auto;
}

/* Individual item */
.counter-item {
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  -webkit-tap-highlight-color: transparent;
}

.counter-item.tappable {
  cursor: pointer;
  user-select: none;
  border: 2px solid transparent;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.counter-item.tappable:active {
  transform: scale(0.97);
  background: rgba(255, 215, 0, 0.25);
  border-color: var(--color-button);
}

.counter-item-header {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xs);
}

.counter-item-text {
  font-family: var(--font-primary);
  font-size: var(--font-size-md);
  color: var(--color-text-primary);
}

.counter-item-count {
  font-family: var(--font-gothic);
  font-size: var(--font-size-sm);
  color: #FFFFFF;
  font-weight: 600;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

/* Progress bar */
.counter-progress-bar {
  width: 100%;
  height: 12px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.counter-progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--color-bg-gradient-start), var(--color-button));
  transition: width 0.4s ease;
  min-width: 0;
}

/* Total display */
.counter-total {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-md) 0;
}

.counter-total-number {
  font-family: var(--font-gothic);
  font-size: var(--font-size-xxl);
  font-weight: 700;
  color: #FFFFFF;
  line-height: 1.1;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6), 0 0 4px rgba(0, 0, 0, 0.4);
}

.counter-total-label {
  font-family: var(--font-gothic);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-top: var(--space-xs);
}

/* Mic indicator */
.mic-indicator {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mic-icon {
  font-size: 36px;
  z-index: 1;
  filter: grayscale(1) brightness(0.6);
  transition: filter 0.3s;
}

.mic-indicator.listening .mic-icon {
  filter: none;
}

.mic-pulse {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(76, 175, 80, 0.15);
  opacity: 0;
  transition: opacity 0.3s;
}

.mic-indicator.listening .mic-pulse {
  opacity: 1;
  animation: mic-pulse-anim 1.5s ease-in-out infinite;
}

@keyframes mic-pulse-anim {
  0% { transform: scale(0.8); opacity: 0.6; }
  50% { transform: scale(1.2); opacity: 0.2; }
  100% { transform: scale(0.8); opacity: 0.6; }
}

/* Mic status area */
.counter-mic {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
}

.counter-mic-status {
  font-family: var(--font-gothic);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  transition: color 0.3s;
}

.counter-mic-status.listening {
  color: #4CAF50;
}

.counter-mic-status.paused {
  color: #9E9E9E;
}

.counter-mic-status.error,
.counter-mic-status.unsupported {
  color: #F44336;
}

/* Real-time transcript */
.counter-transcript {
  font-family: var(--font-gothic);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  min-height: 1.4em;
  text-align: center;
  opacity: 0.7;
  font-style: italic;
}

/* Count-up flash animation */
.counter-item.flash {
  animation: count-flash 0.4s ease-out;
}

@keyframes count-flash {
  0% { background: rgba(201, 168, 76, 0.5); transform: scale(1.03); }
  100% { background: rgba(255, 255, 255, 0.1); transform: scale(1); }
}

/* Tap instruction */
.counter-tap-hint {
  display: none;
  text-align: center;
  font-family: var(--font-gothic);
  font-size: var(--font-size-md);
  color: var(--color-text-secondary);
  padding: var(--space-sm) 0;
}

.counter-tap-hint.visible {
  display: block;
}

.counter-mic.hidden {
  display: none;
}

.btn-manual-large {
  display: none;
  width: 100%;
  padding: var(--space-lg);
  font-size: var(--font-size-xl);
  font-weight: 700;
  background: var(--color-button);
  color: var(--color-button-text);
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  box-shadow: var(--shadow-button);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s;
}

.btn-manual-large.visible {
  display: block;
}

.btn-manual-large:active {
  transform: scale(0.96);
}

/* Controls */
.counter-controls {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
}

.counter-controls .btn {
  min-width: 100px;
}

/* Navigation (prev/next) */
.counter-nav {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-sm);
}

.btn-nav {
  font-family: var(--font-gothic);
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: var(--space-xs) var(--space-md);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn-nav:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--color-text-primary);
}

.btn-nav:active {
  transform: scale(0.96);
}
