/* 控制端 · 移动优先 App Shell */

.app-control {
  --header-h: 52px;
  --voice-dock-h: 96px;
  --tab-bar-h: 56px;
  --bottom-inset: calc(var(--voice-dock-h) + var(--tab-bar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: var(--bottom-inset);
}

.app-control .app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--header-h);
  padding: 0 16px;
  padding-top: env(safe-area-inset-top, 0);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: var(--header-bg, rgba(15, 17, 21, 0.92));
  backdrop-filter: blur(12px);
}

.app-control .app-header h1 {
  font-size: 17px;
  margin: 0;
}

.header-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: #252932;
  color: #c5d4e8;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  max-width: 48vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-action .live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6b7280;
  flex-shrink: 0;
  transition: background 0.25s, box-shadow 0.25s;
}

.header-action.online .live-dot {
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
}

.app-main {
  padding: 12px 16px 8px;
  max-width: 640px;
  margin: 0 auto;
}

.tab-panel {
  display: none;
  animation: fadeIn 0.2s ease;
}

.tab-panel.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.device-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.device-grid .span-full {
  grid-column: 1 / -1;
}

@media (max-width: 380px) {
  .device-grid {
    grid-template-columns: 1fr;
  }
}

.hint-text {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 12px;
}

.cmd-examples {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  color: #c5cad3;
  line-height: 1.7;
}

/* 固定语音 dock · 仅麦克风 */
.voice-dock.voice-only {
  padding: 6px 16px 10px;
}

.voice-dock.voice-only .voice-dock-inner {
  flex-direction: column;
}

.voice-dock.voice-only .voice-mic-wrap {
  margin-top: 0;
  width: 72px;
  height: 72px;
}

.voice-label {
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.voice-mic-wrap.processing .voice-label,
.voice-mic-wrap.recording .voice-label {
  color: var(--accent);
  font-weight: 600;
}

.voice-mic:disabled {
  opacity: 0.85;
  cursor: wait;
}

.voice-mic-wrap.processing .voice-mic {
  pointer-events: none;
}

.voice-mic-wrap.success .voice-label {
  color: var(--ok);
}

.voice-spinner {
  position: absolute;
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.voice-spinner.hidden {
  display: none;
}

.voice-mic-wrap.processing .mic-icon {
  opacity: 0;
}

.voice-mic-wrap.processing .voice-spinner {
  display: block;
}

.voice-toast.ok {
  border-color: rgba(74, 222, 128, 0.45);
}

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

/* legacy input styles removed — voice-only dock */
.voice-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--tab-bar-h);
  z-index: 40;
  padding: 10px 14px 12px;
  background: var(--dock-bg, rgba(20, 24, 32, 0.94));
  border-top: 1px solid var(--line);
  backdrop-filter: blur(20px);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.35);
}

.voice-dock-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  max-width: 640px;
  margin: 0 auto;
  position: relative;
}

.voice-input-shell {
  display: flex;
  align-items: center;
  width: 100%;
  height: 46px;
  padding: 4px 4px 4px 16px;
  margin-bottom: 8px;
  border-radius: 23px;
  border: 1px solid #3a4150;
  background: linear-gradient(180deg, #161a22 0%, #0f1218 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.voice-text {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  outline: none;
}

.voice-text::placeholder {
  color: #6b7280;
}

.voice-send {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: linear-gradient(145deg, #4a5568, #2d3748);
  color: #e8eaed;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.12s;
}

.voice-send:active {
  transform: scale(0.92);
  background: #6c9bcf;
}

.voice-mic-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -28px;
  width: 64px;
  height: 64px;
  pointer-events: none;
}

.voice-mic-wrap .voice-mic {
  pointer-events: auto;
}

.voice-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 200, 87, 0.45);
  opacity: 0;
  transform: scale(0.85);
}

.voice-mic-wrap.recording .voice-ring-1 {
  opacity: 1;
  animation: voiceRing 1.4s ease-out infinite;
}

.voice-mic-wrap.recording .voice-ring-2 {
  opacity: 1;
  animation: voiceRing 1.4s ease-out 0.45s infinite;
}

@keyframes voiceRing {
  0% {
    transform: scale(0.75);
    opacity: 0.7;
  }
  100% {
    transform: scale(1.35);
    opacity: 0;
  }
}

.voice-mic {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(145deg, #ffd875 0%, #f4a261 48%, #e76f51 100%);
  color: #1a1200;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow:
    0 6px 20px rgba(244, 162, 97, 0.45),
    0 0 0 4px rgba(20, 24, 32, 0.9);
  transition: transform 0.15s, box-shadow 0.2s;
}

.voice-mic:active {
  transform: scale(0.94);
}

.voice-mic-wrap.recording .voice-mic {
  background: linear-gradient(145deg, #ff6b6b, #ee5a24);
  color: #fff;
  box-shadow:
    0 6px 24px rgba(238, 90, 36, 0.5),
    0 0 0 4px rgba(20, 24, 32, 0.9);
}

.voice-mic-wrap.recording .mic-icon {
  animation: micBreathe 0.6s ease-in-out infinite alternate;
}

@keyframes micBreathe {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.08);
  }
}

.voice-toast {
  position: fixed;
  left: 50%;
  top: calc(var(--header-h) + env(safe-area-inset-top, 0px) + 12px);
  transform: translateX(-50%);
  z-index: 100;
  max-width: min(90vw, 360px);
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(40, 44, 52, 0.96);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--text);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: toastIn 0.25s ease;
}

.voice-toast.error {
  border-color: rgba(248, 113, 113, 0.5);
  color: #fecaca;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-8px);
  }
}

/* 底部导航 */
.tab-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  height: calc(var(--tab-bar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: flex-start;
  background: var(--tab-bg, rgba(26, 29, 36, 0.96));
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.tab-item {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  padding: 8px 4px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
}

.tab-item .tab-icon {
  font-size: 18px;
  line-height: 1;
}

.tab-item.active {
  color: var(--accent);
}

.tab-voice-spacer {
  pointer-events: none;
  visibility: hidden;
}

/* 中间麦克风与导航视觉对齐：dock 已居中麦克风 */
@media (min-width: 641px) {
  .voice-dock,
  .tab-bar {
    max-width: 640px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 16px 16px 0 0;
  }
}

/* 定时 */
.schedule-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.schedule-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.schedule-form input[type="time"],
.schedule-form input[type="text"],
.settings-field input,
.settings-field select {
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #12151a;
  color: var(--text);
  padding: 0 12px;
  font-size: 14px;
}

.sched-repeat {
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
  color: var(--text) !important;
}

.btn-primary {
  height: 44px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #1a1200;
  font-weight: 600;
  cursor: pointer;
}

.btn-ghost {
  display: block;
  text-align: center;
  padding: 12px;
  color: #6c9bcf;
  text-decoration: none;
  font-size: 14px;
}

.entry-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.entry-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.entry-list li:last-child {
  border-bottom: none;
}

.entry-list .sched-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.entry-list button.link-danger {
  background: none;
  border: none;
  color: var(--err);
  font-size: 12px;
  margin-top: 6px;
  cursor: pointer;
  padding: 0;
}

/* 我的 */
.profile-hero {
  display: flex;
  align-items: center;
  gap: 14px;
}

.profile-hero .avatar {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: #252932;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}

.profile-name {
  font-size: 17px;
  font-weight: 600;
}

.entry-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.entry-item {
  display: grid;
  grid-template-columns: 32px 1fr 20px;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  text-align: left;
}

.entry-chevron {
  color: var(--muted);
  font-size: 18px;
}

.sub-panel.hidden {
  display: none !important;
}

.sub-panel:not(.hidden) {
  margin-top: 12px;
}

.sub-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  font-weight: 600;
}

.back-sub {
  border: none;
  background: none;
  color: #6c9bcf;
  font-size: 15px;
  cursor: pointer;
  padding: 0;
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  font-size: 12px;
  color: var(--muted);
}

#panelProfile .entry-menu.hidden {
  display: none;
}

/* 状态抽屉 */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 60;
}

.status-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 70;
  max-height: 78vh;
  padding: 12px 20px calc(24px + env(safe-area-inset-bottom, 0px));
  background: #1a1d24;
  border-radius: 20px 20px 0 0;
  border: 1px solid var(--line);
  transform: translateY(0);
  animation: sheetUp 0.28s ease;
}

@keyframes sheetUp {
  from {
    transform: translateY(100%);
  }
}

.sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: #3d4452;
  margin: 0 auto 12px;
}

.status-sheet h2 {
  margin: 0 0 8px;
  font-size: 17px;
}

.live-summary {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
}

.mini-room {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.mini-cell {
  background: #12151a;
  border-radius: 12px;
  padding: 12px;
  border: 1px solid var(--line);
}

.mini-cell span {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.mini-cell strong {
  font-size: 14px;
  margin-top: 4px;
  display: block;
}

.sheet-close {
  width: 100%;
  margin-top: 8px;
}

.hidden {
  display: none !important;
}

.app-control .log-list,
.app-control .queue-list {
  max-height: 50vh;
}
