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

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface-btn: #1e1e1e;
  --surface-btn-hover: #2a2a2a;
  --border: #333;
  --border-focus: #555;
  --text: #e0e0e0;
  --text-heading: #fff;
  --text-muted: #888;
  --text-placeholder: #666;
  --accent: #c0392b;
  --accent-hover: #a93226;
  --accent-light: #e74c3c;
  --success: #27ae60;
  --overlay-bg: rgba(0, 0, 0, 0.7);
  --drag-hint: rgba(192, 57, 43, 0.08);
}

html[data-theme='light'] {
  --bg: #f4f4f4;
  --surface: #fff;
  --surface-btn: #fff;
  --surface-btn-hover: #eee;
  --border: #ccc;
  --border-focus: #999;
  --text: #222;
  --text-heading: #111;
  --text-muted: #666;
  --text-placeholder: #999;
  --accent: #c0392b;
  --accent-hover: #a93226;
  --accent-light: #e74c3c;
  --success: #27ae60;
  --overlay-bg: rgba(0, 0, 0, 0.5);
  --drag-hint: rgba(192, 57, 43, 0.12);
}

body {
  font-family:
    'Inter',
    system-ui,
    -apple-system,
    sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem;
}

h1 {
  font-size: 1.8rem;
  margin-bottom: 0.25rem;
  color: var(--text-heading);
}

.subtitle {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.toolbar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

button,
.button {
  background: var(--surface-btn);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background 0.15s;
  text-decoration: none;
  display: inline-block;
  line-height: 1.2;
}

button:hover,
.button:hover:not(.disabled) {
  background: var(--surface-btn-hover);
}

button:disabled,
.button.disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

button:disabled:hover,
.button.disabled:hover {
  background: var(--surface-btn);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent-hover);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary:disabled:hover {
  background: var(--accent);
}

/* Theme switcher */
.theme-switcher {
  position: fixed;
  top: 1rem;
  right: 1rem;
}

.theme-switcher > button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
}

.theme-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  min-width: 100px;
  z-index: 200;
}

.theme-menu.open {
  display: flex;
  flex-direction: column;
}

.theme-menu button {
  border: none;
  border-radius: 0;
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  width: 100%;
}

.theme-menu button:hover {
  background: var(--surface-btn-hover);
}

.theme-menu button.active {
  color: var(--accent);
}

/* Drop zone */
.drop-zone {
  width: 100%;
  max-width: 800px;
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 2.5rem 1rem;
  text-align: center;
  transition:
    border-color 0.2s,
    background 0.2s;
  margin-bottom: 1.5rem;
}

.drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--drag-hint);
}

.drop-zone.has-file {
  border-color: var(--success);
  border-style: solid;
}

.drop-zone .file-info {
  display: none;
}

.drop-zone.has-file .drop-prompt {
  display: none;
}

.drop-zone.has-file .file-info {
  display: block;
}

.drop-zone p {
  color: var(--text-placeholder);
  font-size: 0.95rem;
  margin: 0;
}

.drop-zone .drop-icon {
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.drop-zone .drop-text {
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.drop-zone .drop-subtext {
  color: var(--text-placeholder);
  font-size: 0.9rem;
}

.drop-zone .file-label {
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}

.drop-zone .file-label:hover {
  color: var(--accent-light);
}

.drop-zone input[type='file'] {
  display: none;
}

.drop-zone .file-info .file-icon {
  color: var(--success);
  margin-bottom: 0.75rem;
}

.drop-zone .file-info .file-name {
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 500;
}

.drop-zone .file-info .status {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.editor-area {
  width: 100%;
  max-width: 800px;
  flex: 1;
  min-height: 300px;
}

.editor-area textarea {
  width: 100%;
  height: 100%;
  min-height: 300px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.85rem;
  resize: vertical;
  outline: none;
}

.editor-area textarea:focus {
  border-color: var(--border-focus);
}

.warnings {
  width: 100%;
  max-width: 800px;
  margin-bottom: 1.5rem;
  display: none;
}

.warnings.has-warnings {
  display: block;
}

.warnings-header {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

.warnings-list {
  list-style: none;
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  max-height: 150px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.5rem 0.75rem;
}

.warnings-list li {
  padding: 0.15rem 0;
}

.warnings-list li + li {
  border-top: 1px solid var(--border);
}

.drag-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  z-index: 100;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
  pointer-events: none;
}

.drag-overlay svg {
  color: #fff;
}

.drag-overlay p {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 500;
  color: #fff;
}

.drag-overlay.active {
  display: flex;
}
