:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #17191c;
  --muted: #737983;
  --border: #e6e8ec;
  --primary: #635bff;
  --primary-hover: #5148e5;
  --danger: #dc4444;
  --success: #29976b;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

button,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.app {
  max-width: 1000px;
  margin: 0 auto;
  padding: 32px 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 48px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  max-width: 130px;
  max-height: 36px;
  object-fit: contain;
}

.brand-divider {
  height: 24px;
  width: 1px;
  background: var(--border);
}

.app-name {
  font-weight: 600;
  font-size: 14px;
}

.language-control {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  margin-left: auto;
}

.language-control select {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text);
}

.intro {
  margin-bottom: 28px;
}

.intro h1 {
  font-size: clamp(26px, 4vw, 36px);
  letter-spacing: -1.2px;
  margin: 0 0 10px;
  font-weight: 700;
}

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

.recording-card,
.workspace-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
}

.recording-card {
  padding: 24px;
}

.recording-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.recording-header h2,
.feedback-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
}

.subtext {
  color: var(--muted);
  margin: 7px 0 0;
  font-size: 13px;
}

.status {
  padding: 6px 10px;
  border-radius: 30px;
  font-size: 12px;
  white-space: nowrap;
}

.status-idle {
  background: #f0f1f3;
  color: #707782;
}

.status-recording {
  background: #fff0f0;
  color: #d33f3f;
}

.status-processing {
  background: #f0efff;
  color: var(--primary);
}

.status-success {
  background: #eaf8f1;
  color: var(--success);
}

.recording-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.record-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--primary);
  color: white;
  border: 0;
  border-radius: 9px;
  font-weight: 600;
  transition: background 0.2s;
}

.record-button:hover {
  background: var(--primary-hover);
}

.record-button.is-recording {
  background: var(--danger);
}

.record-icon {
  width: 11px;
  height: 11px;
  background: currentColor;
  border-radius: 50%;
}

.record-button.is-recording .record-icon {
  border-radius: 3px;
}

.button {
  padding: 11px 16px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: white;
  font-weight: 550;
  transition: 0.15s ease;
}

.button:hover:not(:disabled) {
  background: #f5f6f8;
}

.button-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.button-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  color: white;
}

.button-secondary {
  color: var(--text);
}

.timer {
  margin-left: auto;
  font-family: monospace;
  font-size: 15px;
  color: var(--muted);
}

.recording-progress {
  height: 4px;
  margin-top: 22px;
  background: #f0f1f3;
  overflow: hidden;
  border-radius: 5px;
}

.recording-progress div {
  height: 100%;
  width: 0%;
  background: var(--primary);
  transition: width 0.2s linear;
}

.workspace-card {
  overflow: hidden;
}

.workspace-tabs {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
}

.tab {
  padding: 16px 18px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-weight: 550;
  margin-bottom: -1px;
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-panel {
  display: none;
}

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

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}

.editor-toolbar button {
  min-width: 32px;
  height: 30px;
  padding: 4px 8px;
  background: white;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #535963;
}

.editor-toolbar button:hover {
  background: #f1f2f5;
  border-color: var(--border);
}

.toolbar-divider {
  height: 22px;
  width: 1px;
  background: var(--border);
  margin: 0 5px;
}

.editor {
  min-height: 240px;
  padding: 22px;
  outline: none;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.editor:empty::before {
  content: attr(data-placeholder);
  color: #a0a5ae;
  pointer-events: none;
}

.editor:focus {
  outline: none;
}

.editor h2 {
  font-size: 1.35em;
}

.editor h3 {
  font-size: 1.15em;
}

.editor ul,
.editor ol {
  padding-left: 26px;
}

.editor a {
  color: var(--primary);
}

.editor-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}

.text-button {
  border: 0;
  background: none;
  color: var(--muted);
  padding: 5px;
}

.text-button:hover {
  color: var(--danger);
}

.action-area {
  margin-top: 24px;
}

.action-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

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

.error-message {
  border: 1px solid #f1caca;
  background: #fff3f3;
  color: #a32d2d;
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  line-height: 1.5;
}

.feedback-section {
  margin-top: 24px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.feedback-header {
  margin-bottom: 16px;
}

.feedback-block {
  margin-top: 12px;
  line-height: 1.6;
}

.feedback-block:empty {
  display: none;
}

.feedback-block h3 {
  font-size: 14px;
  margin: 0 0 8px;
}

.feedback-block ul {
  padding-left: 22px;
  margin-top: 8px;
}

.footer {
  margin-top: 36px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 600px) {
  .app {
    padding: 20px 14px;
  }

  .topbar {
    margin-bottom: 30px;
  }

  .logo {
    max-width: 90px;
  }

  .intro h1 {
    font-size: 27px;
  }

  .recording-card {
    padding: 18px;
  }

  .recording-header {
    flex-direction: column;
  }

  .timer {
    margin-left: 0;
    width: 100%;
    margin-top: 8px;
  }

  .editor {
    min-height: 220px;
    padding: 16px;
  }

  .editor-toolbar {
    padding: 10px;
    gap: 3px;
  }

  .editor-toolbar button {
    padding: 4px 6px;
  }

  .action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .action-buttons .button-primary {
    grid-column: 1 / -1;
  }
}
