:root {
  --bg: #111;
  --panel: #1a1a1a;
  --panel-2: #181818;
  --text: #eee;
  --muted: #b6b6b6;
  --accent: #0ea5e9;
  --danger: #ef4444;
  --border: #2b2b2b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at 20% 0%, #202020 0%, #111 45%);
  color: var(--text);
  font-family: "Yu Gothic UI", "Meiryo", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: #121212;
}

.topbar h1 {
  margin: 0;
  font-size: 18px;
}

.export-actions {
  display: flex;
  gap: 8px;
}

button {
  border: 1px solid var(--border);
  background: #252525;
  color: var(--text);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

.layout {
  display: grid;
  grid-template-columns: 260px minmax(340px, 1fr) 260px;
  gap: 12px;
  min-height: calc(100vh - 61px);
  padding: 12px;
}

.panel {
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}

.panel h2 {
  margin-top: 0;
  font-size: 16px;
}

.inline-form,
.line-form {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

input,
select {
  width: 100%;
  color: var(--text);
  background: #111;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}

.section-list,
.character-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-item,
.character-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #121212;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
}

.section-item.active {
  border-color: var(--accent);
}

.section-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-btn {
  padding: 4px 8px;
  font-size: 12px;
}

.danger {
  border-color: #5a1d1d;
  color: #ff9f9f;
}

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

.center-panel {
  display: flex;
  flex-direction: column;
}

.script-list {
  flex: 1;
  min-height: 280px;
  max-height: calc(100vh - 220px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: #101010;
}

.line-form {
  margin-top: 10px;
  margin-bottom: 0;
}

.line-form select {
  width: 220px;
}

.line-item {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  gap: 10px;
  align-items: center;
  background: #1a1a1a;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 8px;
}

.line-character {
  color: var(--accent);
  font-weight: 700;
}

.line-text {
  color: var(--text);
  word-break: break-word;
}

.empty {
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .script-list {
    max-height: none;
  }

  .line-form {
    flex-wrap: wrap;
  }

  .line-form select {
    width: 100%;
  }
}
