.home-screen {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #f5f5f5;
  overflow: hidden;
}

.home-appbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(4px, 1vh, 8px) clamp(8px, 2vw, 16px);
  background: #1a237e;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.home-appbar h1 {
  font-size: clamp(12px, 1.8vh, 16px);
  margin: 0;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.appbar-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.home-appbar button {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: clamp(3px, 0.6vh, 6px);
  border-radius: 50%;
  transition: background 0.2s;
}

.home-appbar button .material-icons {
  font-size: clamp(18px, 2.8vh, 26px);
}

.home-appbar button:active:not(:disabled) {
  background: rgba(255, 255, 255, 0.15);
}

.home-appbar button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.home-body {
  --status-width: 100%;
  flex: 1;
  min-height: 0;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  padding: clamp(4px, 1vh, 12px) clamp(8px, 2vw, 16px) clamp(6px, 1.2vh, 14px);
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
  overflow: hidden;
  gap: clamp(3px, 0.8vh, 8px);
}

/* Status box */
.status-box {
  flex: 1 1 0;
  min-height: 0;
  aspect-ratio: 1 / 0.9;
  max-width: 100%;
  border-radius: clamp(10px, 2vh, 16px);
  border: clamp(2px, 0.4vh, 3px) solid;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  overflow: hidden;
}

.status-label {
  font-size: clamp(20px, 5vh, 48px);
  font-weight: 700;
}

.status-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(2px, 0.5vh, 6px);
}

.countdown-circle {
  width: clamp(40px, 8vh, 72px);
  height: clamp(40px, 8vh, 72px);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.countdown-circle svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.countdown-number {
  font-size: clamp(14px, 3vh, 28px);
  font-weight: 700;
}

.status-text {
  font-size: clamp(11px, 2vh, 18px);
  font-weight: 600;
}

/* Mic status bar */
.mic-status-bar {
  display: flex;
  align-items: center;
  gap: clamp(4px, 1vw, 8px);
  width: var(--status-width);
  padding: clamp(3px, 0.5vh, 6px) clamp(6px, 1.5vw, 12px);
  border-radius: 8px;
  font-size: clamp(10px, 1.5vh, 13px);
  box-sizing: border-box;
  flex-shrink: 0;
}

.mic-status-bar .material-icons {
  font-size: clamp(14px, 2vh, 18px);
  flex-shrink: 0;
}

.mic-status-bar select {
  flex: 1;
  min-width: 0;
  padding: clamp(2px, 0.4vh, 4px) clamp(4px, 1vw, 6px);
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: clamp(10px, 1.4vh, 12px);
  outline: none;
  background: rgba(255, 255, 255, 0.6);
}

.mic-status-bar.connected {
  background: #e8f5e9;
  color: #2e7d32;
}

.mic-status-bar.connected select {
  color: #2e7d32;
}

.mic-status-bar.disconnected {
  background: #ffebee;
  color: #c62828;
}

.mic-status-bar.disconnected select {
  color: #c62828;
}

/* Dropdown rows */
.dropdown-row {
  display: flex;
  align-items: center;
  width: var(--status-width);
  gap: clamp(2px, 0.5vw, 6px);
  flex-shrink: 0;
}

.dropdown-row .row-label {
  width: clamp(44px, 12vw, 72px);
  min-width: 40px;
  font-weight: 600;
  flex-shrink: 0;
  font-size: clamp(10px, 1.5vh, 13px);
  color: #333;
}

.dropdown-row select {
  flex: 1;
  min-width: 0;
  padding: clamp(5px, 0.8vh, 9px) clamp(6px, 1.5vw, 10px);
  border: 1px solid #ddd;
  border-radius: clamp(6px, 1vh, 10px);
  font-size: clamp(11px, 1.5vh, 14px);
  outline: none;
  background: white;
  color: #333;
  transition: border-color 0.2s;
}

.dropdown-row .driving-time-input {
  flex: 1;
  min-width: 0;
  padding: clamp(5px, 0.8vh, 9px) clamp(6px, 1.5vw, 10px);
  border: 1px solid #ddd;
  border-radius: clamp(6px, 1vh, 10px);
  font-size: clamp(11px, 1.5vh, 14px);
  outline: none;
  background: white;
  color: #333;
  transition: border-color 0.2s;
}

.dropdown-row select:focus {
  border-color: #1a237e;
}

.dropdown-row .driving-time-input:focus {
  border-color: #1a237e;
}

.dropdown-row .search-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #555;
  width: clamp(28px, 4vh, 40px);
  height: clamp(28px, 4vh, 40px);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border-radius: 50%;
  transition: background 0.2s;
}

.dropdown-row .search-btn .material-icons {
  font-size: clamp(18px, 2.5vh, 24px);
}

.dropdown-row .search-btn:active {
  background: rgba(0, 0, 0, 0.05);
}

.dropdown-row .search-btn:disabled {
  cursor: not-allowed;
  color: #ccc;
  opacity: 0.5;
}

.no-match-text {
  flex: 1;
  color: #999;
  font-size: clamp(11px, 1.5vh, 13px);
  padding: clamp(5px, 0.8vh, 9px) clamp(6px, 1.5vw, 10px);
  border: 1px solid #ddd;
  border-radius: clamp(6px, 1vh, 10px);
  background: #f5f5f5;
}

.fetch-error-text {
  flex: 1;
  color: #c62828;
  font-size: clamp(10px, 1.4vh, 12px);
  padding: clamp(5px, 0.8vh, 9px) clamp(6px, 1.5vw, 10px);
  border: 1px solid #f5c6cb;
  border-radius: clamp(6px, 1vh, 10px);
  background: #fdecea;
}

/* Buttons row */
.buttons-row {
  display: flex;
  flex-direction: row !important;
  gap: clamp(4px, 1vw, 8px);
  width: var(--status-width);
  flex-shrink: 0;
}

.buttons-row > * {
  flex: 1;
  min-width: 0;
}

/* Single button wrapper (for non-row buttons) */
.home-body > .neon-button {
  flex-shrink: 0;
  width: var(--status-width);
}

/* Neon button responsive */
.neon-button {
  height: clamp(36px, 5vh, 50px);
  font-size: clamp(11px, 1.6vh, 15px);
  border-radius: clamp(8px, 1.2vh, 12px);
}

/* Search dialog */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.search-dialog {
  background: white;
  border-radius: 14px;
  padding: 16px;
  width: 100%;
  max-width: 360px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.search-dialog h2 {
  margin: 0 0 10px;
  font-size: 16px;
  color: #333;
}

.search-dialog input {
  width: 100%;
  padding: 10px 10px 10px 36px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  margin-bottom: 8px;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

.search-dialog input:focus {
  border-color: #1a237e;
}

.search-dialog .search-input-wrapper {
  position: relative;
}

.search-dialog .search-input-wrapper .material-icons {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #999;
  font-size: 18px;
}

.search-dialog .results {
  overflow-y: auto;
  flex: 1;
}

.search-dialog .result-item {
  padding: 10px 12px;
  cursor: pointer;
  border-radius: 8px;
  font-size: 14px;
  transition: background 0.15s;
}

.search-dialog .result-item:active {
  background: #e8eaf6;
}

.search-dialog .no-match {
  padding: 16px;
  text-align: center;
  color: #999;
}

/* Spinner for submitting */
.spinner {
  width: clamp(28px, 6vh, 56px);
  height: clamp(28px, 6vh, 56px);
  border: clamp(2px, 0.4vh, 4px) solid #e0e0e0;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Desktop hover effects */
@media (hover: hover) {
  .search-dialog .result-item:hover {
    background: #f0f0f0;
  }

  .dropdown-row .search-btn:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.05);
  }
}

/* Large screens */
@media (min-width: 769px) {
  .home-body {
    max-width: 560px;
  }
}
