* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

:root {
  --bg: #0b0d12;
  --bg-elevated: #11131a;
  --panel: #161922;
  --panel-2: #1b1f2a;
  --panel-3: #202532;
  --border: #2a3140;
  --border-soft: #232938;
  --text: #eceff4;
  --muted: #9aa4b2;
  --muted-2: #7f8997;
  --accent: #10a37f;
  --accent-hover: #0d8c6e;
  --accent-soft: rgba(16, 163, 127, 0.12);
  --danger: #ef4444;
  --warning: #f59e0b;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.32);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

html,
body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at top, #131722 0%, #0b0d12 35%, #0b0d12 100%);
  color: var(--text);
  font-family: Arial, sans-serif;
  min-height: 100%;
}

body {
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: rgba(17, 19, 26, 0.97);
  border-right: 1px solid var(--border-soft);
  padding: 20px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.brand h1 {
  margin: 0;
  font-size: 1.12rem;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.brand-logo {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--panel);
}

.sidebar-note {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 16px;
  color: var(--muted);
  box-shadow: var(--shadow);
}

.sidebar-note p {
  margin: 0;
  font-size: 0.92rem;
}

.sidebar-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.sidebar-history-header h3 {
  margin: 0;
  font-size: 1rem;
}

.history-sidebar-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-item {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 12px 13px;
  cursor: pointer;
  transition: 0.2s ease;
}

.history-item:hover {
  background: #1d2330;
  border-color: #334155;
}

.history-item h4 {
  margin: 0 0 6px;
  font-size: 0.95rem;
}

.history-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.87rem;
  line-height: 1.45;
}

.main-content {
  padding: 24px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  background: rgba(22, 25, 34, 0.9);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.hero-brand-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hero h2 {
  margin: 0 0 8px;
  font-size: 1.5rem;
}

.hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.hero-logo {
  width: 68px;
  height: 68px;
  border-radius: 18px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--panel);
}

.panel {
  background: rgba(22, 25, 34, 0.92);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-header h3 {
  margin: 0;
  font-size: 1.08rem;
}

.panel-tag {
  background: var(--accent-soft);
  color: #79e4c6;
  border: 1px solid rgba(16, 163, 127, 0.25);
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  white-space: nowrap;
}

textarea,
input[type="text"],
input[type="file"] {
  width: 100%;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  font-size: 0.96rem;
  outline: none;
  transition: 0.2s ease;
}

textarea:focus,
input[type="text"]:focus,
input[type="file"]:focus {
  border-color: rgba(16, 163, 127, 0.55);
  box-shadow: 0 0 0 4px rgba(16, 163, 127, 0.12);
}

textarea {
  resize: vertical;
  min-height: 120px;
  font-family: inherit;
  line-height: 1.6;
}

.upload-block {
  margin-top: 14px;
  margin-bottom: 10px;
  padding: 14px;
  border: 1px dashed #344155;
  border-radius: var(--radius-md);
  background: #12161f;
}

.upload-label {
  display: inline-block;
  margin-bottom: 10px;
  color: #8ce7d0;
  font-weight: bold;
}

.voice-actions,
.input-actions,
.history-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.copy-btn {
  border: none;
  cursor: pointer;
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 0.93rem;
  transition: 0.2s ease;
}

.primary-btn {
  background: var(--accent);
  color: white;
  font-weight: bold;
}

.primary-btn:hover {
  background: var(--accent-hover);
}

.secondary-btn {
  background: #252b37;
  color: var(--text);
  border: 1px solid var(--border);
}

.secondary-btn:hover {
  background: #2d3442;
}

.ghost-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.ghost-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.copy-btn {
  background: #222834;
  color: #dbe3ec;
  border: 1px solid var(--border);
  padding: 8px 12px;
}

.copy-btn:hover {
  background: #2b3342;
}

.primary-btn:disabled,
.secondary-btn:disabled,
.ghost-btn:disabled,
.copy-btn:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.is-active {
  background: var(--accent) !important;
  color: white !important;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 4px rgba(16, 163, 127, 0.18);
}

.small-btn {
  padding: 8px 12px;
  font-size: 0.86rem;
}

.status-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

#statusMessage,
#voiceStatus,
#liveStatus,
.small-text {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.notice {
  color: var(--muted);
}

.error {
  color: #fca5a5 !important;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.hidden {
  display: none !important;
}

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

.result-panel {
  min-height: 300px;
}

.empty-state {
  color: var(--muted);
  padding: 10px 2px;
}

.result-card,
.detail-card {
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-top: 14px;
}

.result-card h4,
.detail-card h4 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 1rem;
}

.result-card p,
.detail-card p {
  margin: 0;
  line-height: 1.65;
  color: var(--text);
}

.copy-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.hashtag-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.hashtag {
  background: rgba(16, 163, 127, 0.12);
  color: #8ce7d0;
  border: 1px solid rgba(16, 163, 127, 0.22);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.88rem;
}

.image-card {
  overflow: hidden;
}

.generated-image {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--border);
  margin-top: 10px;
  background: #0b0d12;
}

.live-state-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #222834;
  color: #cbd5e1;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.86rem;
}

.live-badge-active {
  background: rgba(16, 163, 127, 0.12);
  color: #8ce7d0;
  border-color: rgba(16, 163, 127, 0.28);
}

.live-chat-card {
  margin-top: 14px;
}

.live-messages {
  min-height: 180px;
  max-height: 280px;
  overflow-y: auto;
  white-space: pre-wrap;
  line-height: 1.7;
  color: var(--text);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 7, 10, 0.72);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  z-index: 2;
  width: min(920px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  margin: 20px auto;
  background: #12161f;
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-soft);
  background: #171c26;
}

.modal-header h3 {
  margin: 0;
}

.modal-content {
  padding: 20px;
  max-height: calc(100vh - 130px);
  overflow-y: auto;
}

.listening {
  border-color: rgba(16, 163, 127, 0.7) !important;
  box-shadow: 0 0 0 4px rgba(16, 163, 127, 0.14);
}

.voice-live {
  color: #79e4c6 !important;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #0f1218;
}

::-webkit-scrollbar-thumb {
  background: #2a3140;
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: #394255;
}

@media (max-width: 1000px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-soft);
  }

  .main-content {
    padding: 18px;
  }
}

@media (max-width: 640px) {
  .main-content {
    padding: 14px;
  }

  .panel,
  .hero,
  .sidebar-note {
    padding: 16px;
  }

  .hero-brand-row {
    align-items: flex-start;
  }

  .hero h2 {
    font-size: 1.28rem;
  }

  .brand-logo,
  .hero-logo {
    width: 54px;
    height: 54px;
  }

  .modal-card {
    width: calc(100vw - 16px);
    margin: 8px auto;
    border-radius: 18px;
  }

  .modal-content {
    padding: 14px;
  }
}
.sidebar-history-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-group {
  overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.25s ease, margin-top 0.25s ease;
  max-height: 2000px;
  opacity: 1;
}

.history-group-collapsed {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  pointer-events: none;
}

.live-upload-block {
  margin-top: 14px;
}
