:root {
  --bg-main: #0c111d;
  --bg-card: #161f30;
  --bg-card-alt: #1c273c;
  --bg-input: #0f1624;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --secondary: #10b981;
  --accent-purple: #8b5cf6;
  --accent-amber: #f59e0b;
  --text-main: #f3f4f6;
  --text-dim: #9ca3af;
  --border: #2d3b55;
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font);
  background: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  padding: 16px;
  display: flex;
  justify-content: center;
}

.app-container {
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 30px;
}

.app-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 6px;
}

.header-icon {
  font-size: 2rem;
  background: linear-gradient(135deg, #2563eb, #8b5cf6);
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.35);
  flex-shrink: 0;
}

.header-text h1 {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
}

.header-text p {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.feedback {
  display: none;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  animation: slideIn 0.25s ease-out;
}

.feedback.show {
  display: block;
}

.feedback.success {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.5);
  color: #34d399;
}

.feedback.info {
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.5);
  color: #60a5fa;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.priority-card {
  border-width: 2px;
}

.text-priority {
  border-color: #3b82f6;
  background: linear-gradient(180deg, #182338 0%, #161f30 100%);
}

.audio-priority {
  border-color: #8b5cf6;
  background: linear-gradient(180deg, #201c38 0%, #161f30 100%);
}

.badge-priority {
  position: absolute;
  top: -10px;
  right: 16px;
  background: linear-gradient(90deg, #f59e0b, #ef4444);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 3px 10px;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

.card-title {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.card-title .icon {
  font-size: 1.6rem;
  line-height: 1;
}

.card-title h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

.card-title h3 {
  font-size: 1rem;
  font-weight: 600;
}

.card-title small {
  color: var(--text-dim);
  font-size: 0.78rem;
  display: block;
  margin-top: 2px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #cbd5e1;
}

input[type="text"],
select,
textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-main);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

textarea {
  resize: vertical;
  min-height: 85px;
  line-height: 1.4;
}

.input-with-ext {
  display: flex;
  gap: 8px;
}

.input-with-ext input {
  flex: 1;
}

.input-with-ext select {
  width: 150px;
}

.static-ext {
  display: flex;
  align-items: center;
  padding: 0 14px;
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-weight: 700;
  color: var(--accent-purple);
}

.input-custom-format {
  display: flex;
  align-items: center;
  gap: 6px;
}

.input-custom-format input:first-child {
  flex: 2;
}

.input-custom-format input:last-child {
  flex: 1;
  text-transform: lowercase;
}

.input-custom-format .dot {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-dim);
}

.quick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.tag {
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  color: #93c5fd;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
}

.tag:hover {
  background: #2563eb;
  color: white;
  border-color: #2563eb;
}

.audio-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  background: rgba(0,0,0,0.2);
  padding: 10px;
  border-radius: 10px;
}

.param {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.param label {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.param input[type="range"] {
  accent-color: var(--accent-purple);
  width: 100%;
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 18px;
  border-radius: 12px;
  border: none;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.2s, background 0.2s;
  flex: 1;
  min-width: 140px;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.audio-priority .btn-primary {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.btn-secondary {
  background: #334155;
  color: #f8fafc;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: #cbd5e1;
}

.btn-subtle {
  background: transparent;
  color: var(--text-dim);
  font-size: 0.8rem;
  padding: 6px;
  text-decoration: underline;
  border: none;
  cursor: pointer;
}

.audio-status {
  font-size: 0.8rem;
  color: #a78bfa;
  min-height: 18px;
}

.history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-input);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.85rem;
}

.history-item .file-info {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item .file-name {
  font-weight: 600;
  color: #e2e8f0;
}

.history-item .file-date {
  font-size: 0.7rem;
  color: var(--text-dim);
}

.history-item .btn-dl {
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.75rem;
  cursor: pointer;
}

.empty-hist {
  color: var(--text-dim);
  font-size: 0.82rem;
  text-align: center;
  padding: 10px 0;
}

.app-footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 8px;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 480px) {
  body {
    padding: 10px;
  }
  .input-with-ext {
    flex-direction: column;
  }
  .input-with-ext select {
    width: 100%;
  }
  .actions-row {
    flex-direction: column;
  }
  .btn {
    width: 100%;
  }
}
