:root {
  color-scheme: light;
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-muted: #f1f4f6;
  --text: #20242a;
  --muted: #5d6673;
  --line: #d7dce2;
  --accent: #1c6b5a;
  --accent-strong: #155247;
  --greek: #213d72;
  --douay: #6c3f1d;
  --shadow: 0 14px 34px rgba(32, 36, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(320px, 1.15fr);
  gap: 24px;
  align-items: end;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.title-block h1 {
  margin: 0 0 8px;
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.title-block p {
  margin: 0;
  max-width: 54ch;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: end;
}

.search-mode {
  display: flex;
  grid-column: 1 / -1;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.search-mode label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-muted);
  cursor: pointer;
}

.search-mode input {
  width: 16px;
  min-height: 16px;
}

.search-mode span {
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

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

label span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

input,
select,
button {
  min-height: 44px;
  border-radius: 6px;
  border: 1px solid var(--line);
  font: inherit;
}

input,
select {
  width: 100%;
  min-width: 0;
  background: var(--surface);
  color: var(--text);
}

input {
  padding: 0 12px;
}

select {
  padding: 0 38px 0 12px;
}

button {
  padding: 0 18px;
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
}

button:hover:not(:disabled),
button:focus-visible:not(:disabled) {
  background: var(--accent-strong);
}

button:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.status {
  margin: 18px 0;
  min-height: 24px;
  color: var(--muted);
  font-size: 0.95rem;
}

.status.error {
  color: #8f1d2c;
  font-weight: 700;
}

.new-search-button {
  margin: 0 0 18px;
}

.results {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "header header"
    "greek douay"
    "matches matches";
  gap: 16px;
}

.results-header {
  grid-area: header;
  padding: 4px 0;
}

.results-header h2 {
  margin: 0;
  font-size: 1.45rem;
  line-height: 1.2;
  letter-spacing: 0;
}

.passage-panel {
  min-height: 240px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.greek-panel {
  grid-area: greek;
  border-top: 4px solid var(--greek);
}

.douay-panel {
  grid-area: douay;
  border-top: 4px solid var(--douay);
}

.passage-panel h3 {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.passage-panel p {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.65;
}

.passage-panel mark {
  border-radius: 4px;
  padding: 0 0.12em;
  background: #ffe36f;
  color: inherit;
  box-shadow: 0 0 0 1px rgba(128, 99, 0, 0.18);
}

#greek-text {
  color: var(--greek);
  font-family:
    "SBL Greek", "Noto Serif", Georgia, "Times New Roman", serif;
}

#douay-text {
  color: var(--douay);
  font-family: Georgia, "Times New Roman", serif;
}

.chapter-matches {
  grid-area: matches;
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.chapter-matches h3 {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chapter-matches ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 20px;
}

.chapter-matches a {
  color: var(--accent-strong);
  overflow-wrap: anywhere;
}

@media (max-width: 880px) {
  .toolbar,
  .controls,
  .results {
    grid-template-columns: 1fr;
  }

  .results {
    grid-template-areas:
      "header"
      "greek"
      "douay"
      "matches";
  }

  button {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding: 16px 0;
  }

  .toolbar,
  .passage-panel,
  .chapter-matches {
    padding: 16px;
  }

  .passage-panel p {
    font-size: 1.12rem;
  }
}
