:root {
  color-scheme: light;
  --ink: #202124;
  --muted: #667085;
  --line: #d8dee8;
  --panel: #ffffff;
  --page: #f5f6f8;
  --blue: #265fba;
  --red: #b33939;
  --green: #357a52;
  --amber: #9a6a16;
  --shadow: 0 10px 28px rgba(30, 35, 45, 0.08);
}

* {
  box-sizing: border-box;
}

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

@media (min-width: 941px) {
  body {
    overflow: hidden;
  }
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 34px;
  border: 1px solid var(--blue);
  border-radius: 6px;
  color: #fff;
  background: var(--blue);
  padding: 0 12px;
  cursor: pointer;
}

button:disabled {
  border-color: #b6bfcd;
  background: #b6bfcd;
  cursor: not-allowed;
}

button.secondary {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

button.icon-button {
  width: 34px;
  padding: 0;
  border-color: var(--line);
  color: var(--ink);
  background: #fff;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(320px, 390px) 1fr;
  height: 100vh;
  min-height: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  min-height: 0;
  padding: 18px;
  overflow: hidden;
  background: #eef1f5;
  border-right: 1px solid var(--line);
}

.brand-row,
.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.1;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
}

.brand-row p,
.section-header p,
.theme-item p,
.description,
.meta-line,
#pageLabel {
  color: var(--muted);
}

.search-panel,
.detail-pane,
.generator-pane {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.search-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
}

label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

input,
select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 9px;
}

.field-row,
.toolbar,
.export-row,
.playback-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.field-row > label {
  flex: 1;
}

.theme-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
  overscroll-behavior: contain;
}

.theme-item {
  display: block;
  width: 100%;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
  margin-bottom: 8px;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
}

.theme-item.active {
  border-color: var(--blue);
  box-shadow: inset 3px 0 0 var(--blue);
}

.theme-item strong {
  display: -webkit-box;
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.theme-item p {
  overflow: hidden;
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.tag {
  border-radius: 999px;
  background: #f0f2f5;
  color: #475467;
  padding: 2px 7px;
  font-size: 12px;
}

.tag.key {
  background: #e7f1eb;
  color: var(--green);
}

.tag.meter {
  background: #f7eddc;
  color: var(--amber);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.workspace {
  display: grid;
  grid-template-rows: minmax(380px, 58vh) minmax(320px, auto);
  gap: 16px;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 18px;
}

.detail-pane,
.generator-pane {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
}

.detail-pane {
  overflow: hidden;
}

.score-surface {
  position: relative;
  flex: 1;
  min-height: 260px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.score-surface img {
  display: none;
  width: 100%;
  min-width: 620px;
  height: auto;
  padding: 12px 32px 12px 12px;
}

.score-surface.has-score img {
  display: block;
}

.score-surface.has-score .empty-state {
  display: none;
}

.empty-state {
  display: grid;
  min-height: 260px;
  place-items: center;
  color: var(--muted);
}

.export-row {
  flex-wrap: wrap;
}

.playback-row {
  align-items: end;
}

.playback-row label {
  max-width: 320px;
  flex: 1;
}

.export-row a {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 6px 9px;
}

.description {
  line-height: 1.45;
  max-height: 58px;
  overflow: auto;
}

.generator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 10px;
}

.generator-param.is-hidden {
  display: none;
}

.generated-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
  overflow: auto;
}

.sample-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.sample-card h3 {
  margin: 0;
  font-size: 15px;
}

.sample-score {
  height: clamp(190px, 24vh, 280px);
  min-height: 190px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.sample-score img {
  display: block;
  width: 115%;
  min-width: 620px;
  max-width: none;
  padding: 12px;
}

.code-line {
  overflow: hidden;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-ok {
  color: var(--green);
}

.status-bad {
  color: var(--red);
}

@media (max-width: 940px) {
  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow: visible;
  }

  .theme-list {
    max-height: 45vh;
  }

  .workspace {
    grid-template-rows: auto auto;
    overflow: visible;
  }

  .generator-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .sample-score img {
    width: 140%;
    min-width: 760px;
  }
}

@media (max-width: 520px) {
  .field-row,
  .toolbar,
  .playback-row {
    flex-wrap: wrap;
  }

  .generator-grid {
    grid-template-columns: 1fr;
  }

  .generated-list {
    grid-template-columns: 1fr;
  }
}
