* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Segoe UI', sans-serif;
  background: #1a1a2e;
  color: #e0e0e0;
  min-height: 100vh;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.app-header {
  text-align: center;
  padding: 24px 0 16px;
}

h1 {
  color: #7b9eff;
  font-size: 1.55rem;
  letter-spacing: 0.05em;
}

h2,
.section-head label,
.field-label {
  color: #8f9cff;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

h2 {
  margin-bottom: 14px;
  text-transform: uppercase;
}

.card {
  background: #16213e;
  border: 1px solid rgba(123, 158, 255, 0.12);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
}

.setup-card,
.input-panel,
.editor-card {
  padding: 18px;
}

.setup-card {
  display: grid;
  gap: 12px;
}

.title-input,
.editor {
  width: 100%;
  border: 1px solid rgba(123, 158, 255, 0.18);
  border-radius: 10px;
  background: #111936;
  color: #f4f6ff;
  outline: none;
}

.title-input {
  min-height: 46px;
  padding: 0 14px;
}

.title-input:focus,
.editor:focus {
  border-color: #7b9eff;
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.22);
}

.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 6px;
}

.mode-tab {
  min-height: 44px;
  border-radius: 999px;
  background: #222b52;
  color: #aab6ff;
  font-weight: 700;
  padding: 0 12px;
}

.mode-tab.active {
  background: #4361ee;
  color: white;
  box-shadow: 0 4px 18px rgba(67, 97, 238, 0.36);
}

.input-grid,
.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.input-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  min-height: 330px;
}

.record-btn {
  width: 168px;
  height: 168px;
  border-radius: 50%;
  background: #4361ee;
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 700;
  box-shadow: 0 4px 24px rgba(67, 97, 238, 0.45);
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.record-btn:active,
.file-btn:active,
.primary-btn:active,
.secondary-btn:active,
.copy-btn:active {
  transform: scale(0.96);
}

.record-btn.recording {
  background: #e63946;
  box-shadow: 0 4px 24px rgba(230, 57, 70, 0.45);
  animation: pulse 1.5s ease-in-out infinite;
}

.btn-icon {
  color: #ffb4bc;
  font-size: 2.2rem;
  line-height: 1;
}

.elapsed-time {
  color: #dbe2ff;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.live-box {
  width: 100%;
  min-height: 94px;
  border-radius: 12px;
  background: #111936;
  border: 1px solid rgba(123, 158, 255, 0.14);
  padding: 14px;
  overflow: auto;
}

.live-text,
.format-help,
.progress-meta,
.status,
.save-message {
  color: #9fa6c7;
  font-size: 0.9rem;
  line-height: 1.6;
}

.file-btn,
.primary-btn,
.secondary-btn {
  min-height: 46px;
  border-radius: 999px;
  color: white;
  font-weight: 700;
  padding: 0 22px;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.file-btn,
.primary-btn {
  background: #4361ee;
  box-shadow: 0 4px 18px rgba(67, 97, 238, 0.36);
}

.secondary-btn {
  background: #26345f;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.16);
}

.file-input {
  display: none;
}

.progress-wrap {
  width: 100%;
  margin-top: auto;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.chunk-progress {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border: none;
  border-radius: 999px;
  background: #0f1730;
}

.chunk-progress::-webkit-progress-bar {
  background: #0f1730;
}

.chunk-progress::-webkit-progress-value {
  background: #4cc9a0;
  border-radius: 999px;
}

.chunk-progress::-moz-progress-bar {
  background: #4cc9a0;
  border-radius: 999px;
}

.status {
  min-height: 1.6em;
  margin: 18px 0 0;
  text-align: center;
}

.editor-card {
  display: grid;
  gap: 12px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.copy-btn {
  min-height: 34px;
  border-radius: 999px;
  background: #26345f;
  color: #dbe2ff;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0 14px;
}

.editor {
  min-height: 260px;
  padding: 14px;
  line-height: 1.7;
  resize: vertical;
}

.actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
}

.save-message {
  margin-top: 14px;
  text-align: center;
}

.save-message a {
  color: #7bdbff;
  font-weight: 700;
}

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

@keyframes pulse {
  0%, 100% { box-shadow: 0 4px 24px rgba(230, 57, 70, 0.45); }
  50% { box-shadow: 0 4px 48px rgba(230, 57, 70, 0.85); }
}

@media (max-width: 760px) {
  .container {
    padding: 16px 12px 32px;
  }

  .input-grid,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .record-btn {
    width: 156px;
    height: 156px;
  }

  .actions {
    flex-direction: column;
  }

  .primary-btn,
  .secondary-btn {
    width: 100%;
  }
}
