/* ===== Postalk — CSS ===== */

/* Reset & Base */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --tv-primary: #667eea;
  --tv-primary-dark: #5a6fd6;
  --tv-secondary: #764ba2;
  --tv-bg: #f5f5f7;
  --tv-card: #ffffff;
  --tv-text: #1a1a2e;
  --tv-text-sub: #888;
  --tv-border: #e5e5ea;
  --tv-success: #34c759;
  --tv-error: #ff3b30;
  --tv-radius: 14px;
  --tv-radius-sm: 10px;
}

body {
  background: var(--tv-bg);
  color: var(--tv-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Sans", "Noto Sans JP", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}

.tv-hidden { display: none !important; }

/* ===== Toast ===== */
.tv-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  background: var(--tv-text);
  color: #fff;
  padding: 10px 24px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  animation: tv-fade-in 0.2s ease;
  max-width: 90vw;
  text-align: center;
}
.tv-toast--error { background: var(--tv-error); }
.tv-toast--success { background: var(--tv-success); }

/* ===== Header ===== */
.tv-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--tv-primary), var(--tv-secondary));
  color: #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
}
.tv-header__title { font-size: 18px; font-weight: 700; letter-spacing: 0.3px; }
.tv-header__account {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 20px;
  padding: 6px 14px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.tv-header__account:hover { background: rgba(255,255,255,0.25); }

/* ===== Main ===== */
.tv-main {
  max-width: 480px;
  margin: 0 auto;
  padding: 12px 12px 80px;
}

/* ===== Section ===== */
.tv-section {
  background: var(--tv-card);
  border-radius: var(--tv-radius);
  padding: 20px 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.tv-section__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--tv-text-sub);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tv-section__title span {
  font-weight: 400;
  font-size: 13px;
  color: var(--tv-text-sub);
}

/* ===== Mic Area ===== */
.tv-mic-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 0 16px;
}
.tv-mic-btn {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--tv-primary), var(--tv-secondary));
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(102,126,234,0.35);
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
}
.tv-mic-btn--invite::before,
.tv-mic-btn--invite::after {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid var(--tv-primary);
  opacity: 0;
  animation: tv-ring 2.4s ease-out infinite;
}
.tv-mic-btn--invite::after {
  animation-delay: 1.2s;
}
@keyframes tv-ring {
  0% { opacity: 0.3; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.25); }
}
.tv-mic-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 28px rgba(102,126,234,0.45);
}
.tv-mic-btn:active { transform: scale(0.97); }
.tv-mic-btn--recording {
  animation: tv-pulse 1.2s ease-in-out infinite;
  background: linear-gradient(135deg, #ff3b30, #ff6b6b);
  box-shadow: 0 4px 24px rgba(255,59,48,0.4);
}
@keyframes tv-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
.tv-mic-hint {
  margin-top: 14px;
  font-size: 15px;
  color: var(--tv-text-sub);
  text-align: center;
}

/* ===== Text Input ===== */
.tv-textarea {
  width: 100%;
  border: 1.5px solid var(--tv-border);
  border-radius: var(--tv-radius-sm);
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  line-height: 1.6;
  resize: vertical;
  transition: border-color 0.2s;
  background: var(--tv-card);
  color: var(--tv-text);
}
.tv-textarea:focus {
  outline: none;
  border-color: var(--tv-primary);
  box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}
.tv-textarea::placeholder { color: #bbb; }

.tv-char-counter {
  text-align: right;
  font-size: 12px;
  color: var(--tv-text-sub);
  margin-top: 4px;
}
.tv-char-counter--over { color: var(--tv-error); font-weight: 600; }

/* ===== Input Actions ===== */
.tv-input-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.tv-input-actions .tv-btn { flex: 1; }

/* ===== Character Select (input) ===== */
.tv-char-select-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  background: #f8f8fa;
  border-radius: var(--tv-radius-sm);
}
.tv-char-select-row__label {
  font-size: 13px;
  color: var(--tv-text-sub);
  white-space: nowrap;
}
.tv-select {
  flex: 1;
  border: 1.5px solid var(--tv-border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--tv-text);
}

/* ===== Buttons ===== */
.tv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.tv-btn:active { transform: scale(0.97); }
.tv-btn--primary {
  background: linear-gradient(135deg, var(--tv-primary), var(--tv-primary-dark));
  color: #fff;
}
.tv-btn--primary:hover { background: var(--tv-primary-dark); }
.tv-btn--post {
  background: linear-gradient(135deg, #f87171, #e11d48);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  padding: 14px 18px;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(225,29,72,0.3);
  transition: transform 0.15s, box-shadow 0.15s;
}
.tv-btn--post:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(225,29,72,0.4);
}
.tv-btn--post:active { transform: scale(0.98); }
.tv-btn--disabled {
  opacity: 0.35;
  pointer-events: none;
}
.tv-btn--outline {
  background: transparent;
  border: 1.5px solid var(--tv-border);
  color: var(--tv-text);
}
.tv-btn--outline:hover { background: #f5f5f7; }
.tv-btn--sm { padding: 7px 14px; font-size: 13px; border-radius: 8px; }
.tv-btn--full { width: 100%; }
.tv-btn--danger { background: var(--tv-error); color: #fff; }
.tv-btn--xs { padding: 4px 10px; font-size: 12px; border-radius: 6px; }

/* ===== Preview ===== */
.tv-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tv-char-count { font-size: 13px; color: var(--tv-text-sub); font-weight: 400; }

.tv-post-actions {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tv-post-actions__row {
  display: flex;
  gap: 8px;
}
.tv-post-actions__row .tv-btn { flex: 1; }

/* ===== Badge ===== */
.tv-badge {
  background: var(--tv-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

/* ===== Tabs ===== */
.tv-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--tv-border);
  margin-bottom: 14px;
}
.tv-tab {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 10px 0;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: var(--tv-text-sub);
  cursor: pointer;
  transition: all 0.2s;
}
.tv-tab--active {
  color: var(--tv-primary);
  border-bottom-color: var(--tv-primary);
}

/* ===== History Items ===== */
/* ===== Usage Info ===== */
.tv-usage-info {
  text-align: center;
  margin-top: 10px;
  font-size: 14px;
  color: var(--tv-text);
}
.tv-usage-info__count {
  font-weight: 700;
  color: var(--tv-primary);
  font-size: 16px;
}
.tv-usage-sub {
  display: block;
  font-size: 11px;
  color: var(--tv-text-sub);
  margin-top: 2px;
}
.tv-usage-info--exhausted {
  color: var(--tv-error);
}

/* ===== Insights Summary ===== */
.tv-insights-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--tv-border);
}
.tv-insights-summary__item {
  text-align: center;
}
.tv-insights-summary__val {
  display: block;
  font-size: 20px;
  font-weight: 700;
  color: var(--tv-primary);
}
.tv-insights-summary__label {
  font-size: 11px;
  color: var(--tv-text-sub);
}

.tv-history-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--tv-border);
}
.tv-history-item:last-child { border-bottom: none; }
.tv-history-item__text {
  font-size: 14px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tv-history-item__meta {
  display: flex;
  gap: 12px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--tv-text-sub);
}

/* ===== Drafts ===== */
.tv-draft-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--tv-border);
  cursor: pointer;
}
.tv-draft-item:last-child { border-bottom: none; }
.tv-draft-item__text {
  flex: 1;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tv-draft-item__date { font-size: 12px; color: var(--tv-text-sub); margin-left: 8px; }
.tv-draft-item__delete {
  background: none;
  border: none;
  color: var(--tv-text-sub);
  cursor: pointer;
  padding: 4px;
  margin-left: 8px;
  font-size: 16px;
}
.tv-draft-item__delete:hover { color: var(--tv-error); }

/* ===== Schedule ===== */
.tv-schedule-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--tv-border);
  font-size: 14px;
}
.tv-schedule-item:last-child { border-bottom: none; }
.tv-schedule-item__time { font-weight: 600; }
.tv-schedule-item__text {
  font-size: 13px;
  color: var(--tv-text-sub);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tv-schedule-status {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.tv-schedule-status--pending { background: #fff3cd; color: #856404; }
.tv-schedule-status--posted { background: #d4edda; color: #155724; }
.tv-schedule-status--failed { background: #f8d7da; color: #721c24; }

.tv-input {
  width: 100%;
  border: 1.5px solid var(--tv-border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  margin-bottom: 8px;
}
.tv-input:focus { outline: none; border-color: var(--tv-primary); }

/* ===== Hamburger Button ===== */
.tv-hamburger {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
}
.tv-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

/* ===== Menu Overlay & Drawer ===== */
.tv-menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
}
.tv-menu-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4);
  animation: tv-fade-in 0.2s ease;
}
@keyframes tv-fade-in { from { opacity: 0; } to { opacity: 1; } }
.tv-menu-drawer {
  position: absolute;
  top: 0;
  right: 0;
  width: 280px;
  max-width: 80vw;
  height: 100%;
  background: var(--tv-card);
  box-shadow: -4px 0 24px rgba(0,0,0,0.12);
  animation: tv-slide-left 0.25s ease;
  display: flex;
  flex-direction: column;
}
@keyframes tv-slide-left { from { transform: translateX(100%); } to { transform: translateX(0); } }
.tv-menu-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--tv-border);
}
.tv-menu-drawer__title { font-size: 16px; font-weight: 700; }
.tv-menu-drawer__close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--tv-text-sub);
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}
.tv-menu-drawer__nav {
  padding: 8px 0;
  flex: 1;
  overflow-y: auto;
}
.tv-menu-drawer__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 500;
  color: var(--tv-text);
  cursor: pointer;
  transition: background 0.15s;
}
.tv-menu-drawer__item:hover { background: #f5f5f7; }
.tv-menu-drawer__item--danger { color: var(--tv-error); }
.tv-menu-drawer__item--danger:hover { background: #fff5f5; }
.tv-menu-drawer__divider {
  height: 1px;
  background: var(--tv-border);
  margin: 8px 20px;
}

/* ===== Character Slots ===== */
.tv-char-slot {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: #f8f8fa;
  border: 1.5px solid var(--tv-border);
  border-radius: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.tv-char-slot:hover {
  border-color: var(--tv-primary);
  background: rgba(102,126,234,0.04);
}
.tv-char-slot--empty { border-style: dashed; }
.tv-char-slot__icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--tv-primary), var(--tv-secondary));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}
.tv-char-slot--empty .tv-char-slot__icon {
  background: var(--tv-border);
  color: var(--tv-text-sub);
}
.tv-char-slot__info { flex: 1; min-width: 0; }
.tv-char-slot__name { font-weight: 600; font-size: 15px; }
.tv-char-slot__desc { font-size: 13px; color: var(--tv-text-sub); margin-top: 2px; }
.tv-char-slot__arrow { font-size: 24px; color: var(--tv-text-sub); flex-shrink: 0; }

/* ===== Character Form ===== */
.tv-char-form-group { margin-bottom: 16px; }
.tv-char-form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--tv-text-sub);
  margin-bottom: 6px;
}
.tv-char-form-row { display: flex; gap: 10px; }
.tv-char-voice-btn-area {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--tv-border);
}
.tv-char-back {
  background: none;
  border: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--tv-primary);
  cursor: pointer;
  padding: 0;
  margin-bottom: 16px;
  font-family: inherit;
}
.tv-char-back:hover { text-decoration: underline; }

/* ===== Variation Picker ===== */
.tv-variation-popup {
  max-height: 90vh;
  height: 85vh;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
  border-radius: 16px 16px 0 0;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  margin: 0 auto;
  animation: tv-slide-up 0.3s ease-out;
}
@keyframes tv-slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.tv-variation-slider {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  gap: 0;
  flex: 1;
  min-height: 0;
  touch-action: pan-x;
}
.tv-variation-slider::-webkit-scrollbar { display: none; }
.tv-variation-slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  padding: 20px;
  overflow-y: auto;
}
.tv-variation-slide__label {
  font-size: 18px;
  font-weight: 700;
  color: var(--tv-primary);
  margin-bottom: 4px;
}
.tv-variation-slide__desc {
  font-size: 13px;
  color: var(--tv-text-sub);
  margin-bottom: 16px;
}
.tv-variation-slide__sample {
  font-size: 15px;
  line-height: 1.9;
  white-space: pre-wrap;
  background: var(--tv-bg);
  border-radius: 12px;
  padding: 20px;
}
/* Nav arrows + dots */
.tv-variation-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  flex-shrink: 0;
}
.tv-variation-arrow {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: var(--tv-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
  transition: opacity 0.2s;
}
.tv-variation-arrow:disabled {
  background: var(--tv-border);
  color: var(--tv-text-sub);
  opacity: 0.4;
  cursor: default;
}
.tv-variation-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-shrink: 0;
}
.tv-variation-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--tv-border);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: all 0.2s;
}
.tv-variation-dot--active {
  background: var(--tv-primary);
  width: 24px;
  border-radius: 5px;
}

/* ===== Voice Recording Popup ===== */
.tv-voice-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}
.tv-voice-popup {
  background: var(--tv-card);
  border-radius: 20px;
  padding: 32px 24px;
  text-align: center;
  width: 280px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.tv-voice-popup__indicator {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 16px;
  background: var(--tv-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tv-voice-popup__ring {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 3px solid var(--tv-primary);
  opacity: 0.4;
  animation: tv-ring-pulse 1.5s ease-in-out infinite;
}
@keyframes tv-ring-pulse {
  0%, 100% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(1.15); opacity: 0.1; }
}
.tv-voice-popup__status {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}
.tv-voice-popup__preview {
  font-size: 13px;
  color: var(--tv-text-sub);
  min-height: 40px;
  max-height: 80px;
  overflow-y: auto;
  margin-bottom: 16px;
  line-height: 1.5;
}
.tv-voice-popup__stop {
  width: 100%;
}

/* ===== Creating Loading ===== */
.tv-creating-overlay {
  position: fixed;
  inset: 0;
  z-index: 260;
  background: rgba(255,255,255,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: tv-fade-in 0.2s ease;
}
.tv-creating-content { text-align: center; }
.tv-creating-dots {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 20px;
}
.tv-creating-dots span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--tv-primary), var(--tv-secondary));
  animation: tv-bounce 1.4s ease-in-out infinite;
}
.tv-creating-dots span:nth-child(2) { animation-delay: 0.2s; }
.tv-creating-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes tv-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1.1); opacity: 1; }
}
.tv-creating-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--tv-text);
}

/* ===== Result Popup ===== */
.tv-result-overlay {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.tv-result-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  animation: tv-fade-in 0.2s ease;
}
.tv-result-popup {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  background: var(--tv-card);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -4px 30px rgba(0,0,0,0.15);
  animation: tv-slide-up 0.3s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.tv-result-popup__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--tv-border);
}
.tv-result-popup__title { font-size: 16px; font-weight: 700; }
.tv-result-popup__close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--tv-text-sub);
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}
.tv-result-popup__body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}
.tv-result-popup__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--tv-text-sub);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.tv-result-popup__text {
  width: 100%;
  font-size: 15px;
  line-height: 1.8;
  white-space: pre-wrap;
  padding: 14px 16px;
  background: #f8f8fa;
  border-radius: 12px;
  border: 1.5px solid var(--tv-border);
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.2s, background 0.2s;
}
.tv-result-popup__text:focus {
  border-color: var(--tv-primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
  outline: none;
}
.tv-result-popup__tts {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 14px;
  color: var(--tv-primary);
  background: rgba(102,126,234,0.08);
  border: 1.5px solid rgba(102,126,234,0.25);
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s;
}
.tv-result-popup__tts:hover {
  background: rgba(102,126,234,0.15);
  border-color: var(--tv-primary);
}
.tv-result-popup__actions {
  padding: 12px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--tv-border);
}
.tv-result-popup__row {
  display: flex;
  gap: 8px;
}
.tv-result-popup__row .tv-btn { flex: 1; }

/* ===== Fixed Footer Nav ===== */
.tv-footer-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 150;
  display: flex;
  background: var(--tv-card);
  border-top: 1px solid var(--tv-border);
  padding: 6px 0 env(safe-area-inset-bottom, 8px);
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
}
.tv-footer-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  padding: 6px 0;
  font-size: 11px;
  font-family: inherit;
  color: var(--tv-text-sub);
  cursor: pointer;
  transition: color 0.15s;
}
.tv-footer-nav__item--active { color: var(--tv-primary); }
.tv-footer-nav__item:hover { color: var(--tv-primary); }

/* ===== Footer Panel (slide up) ===== */
.tv-footer-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 160;
  background: var(--tv-card);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.12);
  max-height: 65vh;
  display: flex;
  flex-direction: column;
  animation: tv-slide-up 0.25s ease;
}
@keyframes tv-slide-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.tv-footer-panel__header {
  display: flex;
  align-items: center;
  padding: 12px 16px 0;
  border-bottom: 1px solid var(--tv-border);
  flex-shrink: 0;
}
.tv-footer-panel__header .tv-tabs {
  flex: 1;
  min-width: 0;
}
.tv-footer-panel__close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--tv-text-sub);
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  flex-shrink: 0;
  margin-left: 8px;
}
.tv-footer-panel__body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px 80px;
}

/* ===== Empty State ===== */
.tv-empty {
  text-align: center;
  padding: 24px 0;
  color: var(--tv-text-sub);
  font-size: 14px;
}

/* ===== OAuth Guide Screen ===== */
.tv-oauth-guide {
  text-align: center;
  padding: 40px 20px;
}
.tv-oauth-guide__icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--tv-primary), var(--tv-secondary));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.tv-oauth-guide__title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}
.tv-oauth-guide__desc {
  font-size: 14px;
  color: var(--tv-text-sub);
  margin-bottom: 24px;
  line-height: 1.6;
}

/* ===== Schedule datetime input ===== */
.tv-schedule-input {
  margin-top: 12px;
  padding: 12px;
  background: #f8f8fa;
  border-radius: var(--tv-radius-sm);
}
.tv-schedule-input label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--tv-text-sub);
  margin-bottom: 6px;
}

/* ===== Model Select Popup ===== */
.tv-model-list {
  list-style: none;
  padding: 0;
}
.tv-model-list li {
  padding: 14px 16px;
  border-bottom: 1px solid var(--tv-border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  transition: background 0.15s;
}
.tv-model-list li:hover { background: #f5f5f7; }
.tv-model-list li:last-child { border-bottom: none; }
.tv-model-list li.tv-model--active { color: var(--tv-primary); font-weight: 600; }

/* ===== Responsive ===== */
@media (min-width: 768px) {
  .tv-main { padding: 20px 16px 100px; }
  .tv-section { padding: 24px 20px; }
}
