:root {
  font-family: "Inter", "Noto Sans", system-ui, sans-serif;
  color: #1f2937;
  background: #f8fafc;
}

body {
  margin: 0;
  padding: 24px;
  height: 100vh;
  box-sizing: border-box;
  overflow: auto;
}

.layout-container {
  display: flex;
  gap: 24px;
  min-height: 100%;
  max-width: 1600px;
  margin: 0 auto;
  align-items: stretch;
}

/* 左侧提词面板 - 仅在平板以上显示 */
.left-panel {
  flex: 0 0 40%;
  display: flex;
  flex-direction: column;
  min-width: 300px;
  padding-bottom: 24px;
}

.right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-bottom: 24px;
}

.right-panel > .panel:first-of-type {
  flex: 1;
}

/* 手机屏幕或竖屏：隐藏提词栏，单栏显示主UI */
@media (max-width: 768px), (orientation: portrait) {
  .left-panel {
    display: none;
  }

  .right-panel {
    flex: 1;
  }
}

/* 自定义滚动条样式 */
body::-webkit-scrollbar {
  width: 10px;
}

body::-webkit-scrollbar-track {
  background: #f1f5f9;
}

body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 5px;
}

body::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

main {
  display: flex;
  flex-direction: column;
}

header h1 {
  margin: 0 0 8px 0;
}

header p {
  margin: 0;
}

header {
  margin-bottom: 24px;
}

.panel {
  background: #ffffff;
  border-radius: 16px;
  padding: 20px 24px;
}

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

.panel-header h2 {
  margin: 0;
  line-height: 1;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.header-controls input[type="number"] {
  padding: 3px 6px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.85rem;
  text-align: center;
}

.header-controls input[type="number"]:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.loading-status {
  font-size: 0.85rem;
  color: #64748b;
}

.perf-warning {
  display: none;
  align-items: center;
  gap: 6px;
  color: #dc2626;
  font-size: 0.85rem;
  font-weight: 600;
}

.perf-warning.visible {
  display: inline-flex;
}

.perf-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid currentColor;
  font-size: 0.7rem;
  line-height: 1;
}

.file-input {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px dashed #94a3b8;
  border-radius: 12px;
  cursor: pointer;
}

.file-input input {
  display: none;
}

.controls {
  margin-top: 16px;
  display: flex;
  gap: 12px;
}

button {
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  background: #2563eb;
  color: white;
  font-weight: 600;
  cursor: pointer;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.status {
  margin-top: 16px;
  font-size: 0.95rem;
  color: #475569;
}

.result {
  font-size: 1.6rem;
  font-weight: 700;
  margin-top: 12px;
}

.scores {
  margin-top: 8px;
  color: #64748b;
}

.notes ul {
  margin: 0;
  padding-left: 20px;
  color: #475569;
}

/* 实时分析样式 */
.realtime-status {
  margin-top: 16px;
  padding: 12px;
  background: #f1f5f9;
  border-radius: 8px;
  font-size: 0.9rem;
  color: #475569;
}

.realtime-status.recording {
  background: #dcfce7;
  color: #166534;
}

.realtime-result {
  margin-top: 16px;
}

.gender-bars-wrapper {
  display: flex;
  align-items: center;
  gap: 20px;
}

.gender-bars {
  flex: 1;
  padding-left: 12px;
}

.gender-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.gender-label {
  width: 50px;
  font-weight: 600;
  font-size: 0.9rem;
}

.bar-container {
  flex: 1;
  height: 24px;
  background: #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
}

.bar {
  height: 100%;
  transition: width 0.3s ease;
  border-radius: 12px;
}

.male-bar {
  background: linear-gradient(90deg, #3b82f6, #2563eb);
}

.female-bar {
  background: linear-gradient(90deg, #ec4899, #db2777);
}

.percent {
  width: 50px;
  text-align: right;
  font-weight: 600;
  font-size: 0.9rem;
}

#recordBtn.recording {
  background: #dc2626;
}

/* 画中画按钮始终保持蓝色 */
#pipBtn.pip-active {
  background: #2563eb;
}

/* 设置行样式 */
.setting-row {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.setting-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: #475569;
}

.setting-hint {
  font-size: 0.8rem;
  color: #94a3b8;
}

/* 图表样式 */
.chart-container {
  margin-top: 20px;
  height: 300px;
  position: relative;
}

#genderChart, #f0Chart {
  width: 100%;
  height: 100%;
}

/* F0 内联显示（在进度条右侧） */
.pitch-display-inline {
  display: flex;
  align-items: baseline;
  gap: 6px;
  width: 85px;
  justify-content: flex-end;
}

.pitch-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: #2563eb;
}

.pitch-unit {
  font-size: 1rem;
  color: #64748b;
}

.pitch-range {
  display: flex;
  gap: 16px;
  font-size: 0.85rem;
}

.pitch-range-info {
  display: flex;
  gap: 16px;
  font-size: 0.85rem;
  margin-top: 12px;
  justify-content: center;
}

.range-label {
  color: #475569;
  font-weight: 500;
}

.range-male {
  color: #3b82f6;
}

.range-female {
  color: #ec4899;
}

/* 提词面板样式 */
.prompt-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.prompt-panel .panel-header h2 {
  margin: 0;
  line-height: 1;
}

.prompt-textarea {
  flex: 1;
  width: 100%;
  min-height: 400px;
  padding: 16px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  font-size: 1rem;
  font-family: inherit;
  line-height: 1.6;
  resize: none;
  background: #f8fafc;
  box-sizing: border-box;
}

.prompt-textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  background: #ffffff;
}

.prompt-textarea::placeholder {
  color: #94a3b8;
}

/* 画中画窗口样式 */
.pip-container {
  padding: 0;
  background: #ffffff;
  font-family: "Inter", "Noto Sans", system-ui, sans-serif;
  margin: 0;
  width: 100%;
  height: 100%;
}

.pip-chart-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
}

#pipGenderChart {
  width: 100%;
  height: 100%;
}

/* 设置面板样式 */
.settings-panel {
  margin-top: 24px;
}

.settings-panel .panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.settings-panel .panel-header h2 {
  margin: 0;
  line-height: 1;
}

.settings-panel .panel-header #resetParamsBtn {
  background: #f1f5f9;
  color: #475569;
  padding: 8px 16px;
}

.settings-panel .panel-header #resetParamsBtn:hover {
  background: #e2e8f0;
}

.settings-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.setting-group {
  background: #f8fafc;
  border-radius: 12px;
  padding: 16px;
}

.setting-group h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: #1f2937;
}

.setting-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.setting-effect {
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 4px;
}

.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #64748b;
  font-size: 0.65rem;
  font-style: normal;
  font-weight: 600;
}

.heart-icon {
  font-style: normal;
  color: #94a3b8;
  font-size: 0.9rem;
}

.about-content {
  margin: 0;
  font-size: 0.85rem;
  color: #64748b;
  text-align: center;
  padding: 12px 0;
}

.about-content a {
  color: #64748b;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.about-content a:hover {
  color: #475569;
}

/* 链接网格 */
.link-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 4px;
}

.link-card {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #475569;
  font-size: 0.95rem;
  font-weight: 400;
  transition: all 0.2s ease;
}

.link-card:hover {
  color: #2563eb;
}

.link-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.8;
}

.setting-group .setting-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.setting-group .setting-row {
  margin-bottom: 8px;
}

.settings-panel input[type="number"] {
  width: 70px;
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.9rem;
  text-align: center;
}

.settings-panel input[type="number"].narrow-input {
  width: 50px;
  padding: 6px 8px;
}

.settings-panel input[type="number"]:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.settings-panel button {
  padding: 6px 14px;
  font-size: 0.85rem;
}

#enableAlertBtn {
  background: #f1f5f9;
  width: 100%;
  color: #475569;
  border: 1px solid #cbd5e1;
}

#enableAlertBtn:hover {
  background: #e2e8f0;
}

/* 危险按钮样式（清空数据） */
.danger-btn {
  background: #dc2626;
  color: white;
  width: 100%;
  padding: 10px 16px;
}

.danger-btn:hover {
  background: #b91c1c;
}

.advanced-hint {
  margin: 0 0 12px 0;
  font-size: 0.8rem;
  color: #94a3b8;
}
