:root {
  color-scheme: dark;
  --bg: #11100d;
  --panel: #1b1914;
  --panel-2: #242019;
  --border: #4a4233;
  --border-soft: #332e25;
  --text: #f1ead8;
  --muted: #b9ae93;
  --accent: #d5aa57;
  --accent-strong: #f0c56c;
  --danger: #e28778;
  --success: #8fc68e;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: radial-gradient(circle at 20% 0%, rgba(213, 170, 87, .08), transparent 34rem), var(--bg);
  background-attachment: fixed;
  color: var(--text);
}

button, input, select { font: inherit; }

button {
  min-height: 36px;
  border-radius: 0;
  padding: 7px 12px;
  font-weight: 750;
  cursor: pointer;
}

button:disabled { opacity: .6; cursor: wait; }

.page-shell {
  width: min(950px, calc(100% - 24px));
  margin: 0 auto;
  padding: 18px 0;
}

.hero { padding: 0 3px 12px; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; }

h1 {
  margin: 0;
  font-size: clamp(.98rem, 3vw, 2rem);
  line-height: 1.15;
  letter-spacing: -.025em;
  white-space: nowrap;
}

h1 span { color: var(--accent-strong); }

.panel {
  padding: 16px 20px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(36, 32, 25, .96), rgba(27, 25, 20, .98));
  box-shadow: 0 18px 45px rgba(0, 0, 0, .26);
}

.section-heading { margin: 0 0 10px; }
.section-heading h2, .response-panel h2 { margin: 0; font-size: 1.18rem; }
.section-heading.separated {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}

.fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  font-size: .83rem;
  font-weight: 700;
}

.field.full, .item-picker, .world-flags { grid-column: 1 / -1; }

input:not([type="radio"]):not([type="checkbox"]), select {
  min-height: 36px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 0;
  background: var(--bg);
  padding: 7px 10px;
  color: var(--text);
  outline: none;
}

input::placeholder { color: #928871; }

input:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

.password-wrap { position: relative; display: flex; }
.password-wrap input { padding-right: 70px !important; }
.password-wrap button {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  min-height: 0;
  border-left: 1px solid var(--border);
}

.secondary { border: 1px solid var(--border); background: #171510; color: var(--text); }
.secondary:hover:not(:disabled) { border-color: var(--accent); }

.item-picker { min-width: 0; }
.selected-item {
  margin: 0 0 6px;
  padding: 6px 9px;
  border: 1px solid var(--border-soft);
  background: var(--bg);
  color: var(--accent-strong);
  font-size: .8rem;
  font-weight: 700;
}

.item-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 32px;
  align-content: start;
  gap: 4px 8px;
  max-height: 154px; /* Four 32px rows, three 4px gaps and container padding. */
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
}

.item-choice {
  height: 32px;
  min-height: 0;
  min-width: 0;
  width: 100%;
  padding: 5px 9px;
  border: 1px solid var(--border-soft);
  background: var(--panel);
  color: var(--text);
  text-align: left;
  font-size: .8rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-choice:hover { border-color: var(--accent); }
.item-choice[aria-pressed="true"] {
  border-color: var(--accent-strong);
  background: var(--panel-2);
  color: var(--accent-strong);
  font-weight: 700;
}

.item-message { grid-column: 1 / -1; margin: 0; padding: 7px; color: var(--muted); font-size: .82rem; }

.world-flags { min-width: 0; margin: 0; padding: 0; border: 0; }
.world-flags legend { margin-bottom: 5px; padding: 0; font-size: .83rem; font-weight: 700; }
.world-controls { display: grid; grid-template-columns: minmax(0, 230px) minmax(0, 1fr); align-items: stretch; gap: 12px; }

.segmented { display: flex; min-height: 36px; border: 1px solid var(--border); background: var(--bg); }
.segmented label { display: flex; flex: 1; min-width: 0; position: relative; cursor: pointer; }
.segmented label + label { border-left: 1px solid var(--border); }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented span { display: flex; flex: 1; align-items: center; justify-content: center; font-size: .8rem; font-weight: 800; }
.segmented input:checked + span { background: var(--accent); color: #17130c; }
.segmented input:focus-visible + span { outline: 2px solid var(--accent-strong); outline-offset: -2px; }

.inline-note { margin: 6px 0 0; color: var(--muted); font-size: .79rem; line-height: 1.4; }
.inline-note.warn { color: var(--danger); }
.inline-note[hidden] { display: none; }

.idempotency-option {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 12px;
  cursor: pointer;
  color: var(--text);
  font-size: .85rem;
  line-height: 1.3;
}
.idempotency-option input[type="checkbox"] {
  flex: 0 0 17px;
  display: block;
  width: 17px;
  height: 17px;
  min-width: 17px;
  min-height: 17px;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.idempotency-option span { display: block; }

.controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.primary { border: 1px solid var(--accent-strong); background: var(--accent); color: #17130c; }
.primary:hover:not(:disabled) { background: var(--accent-strong); }

.notice {
  margin-top: 12px;
  border-left: 3px solid var(--accent);
  background: rgba(213, 170, 87, .08);
  padding: 9px 11px;
  color: var(--muted);
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.notice.error { border-color: var(--danger); background: rgba(226, 135, 120, .08); }
.notice.success { border-color: var(--success); background: rgba(143, 198, 142, .08); }

.response-panel { margin-top: 12px; }
.response-panel p { color: var(--muted); font-size: .82rem; overflow-wrap: anywhere; }
.response-panel pre {
  max-height: 350px;
  overflow: auto;
  border: 1px solid var(--border-soft);
  padding: 12px;
  background: var(--bg);
  font-size: .82rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 600px) {
  .page-shell { width: calc(100% - 16px); padding-top: 12px; }
  .panel { padding: 12px; }
  .fields { grid-template-columns: 1fr; gap: 10px; }
  .field.full { grid-column: auto; }
  .world-controls { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 8px; }
  .world-controls select { min-width: 0; }
  .segmented span { font-size: .71rem; }
  .item-results { grid-template-columns: 1fr; }
  .section-heading.separated { margin-top: 12px; }
}

/* Chat message and optional evidence share a compact line. */
.extra-fields{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  align-items:end;
  gap:14px;
  margin-top:10px;
}
.screenshot-option{
  display:flex;
  align-items:center;
  gap:9px;
  min-height:36px;
  cursor:pointer;
  font-size:.85rem;
  line-height:1.3;
}
.screenshot-option input[type="checkbox"]{
  flex:0 0 17px;
  display:block;
  width:17px;
  height:17px;
  min-height:17px;
  min-width:17px;
  margin:0;
  padding:0;
  accent-color:var(--accent);
  cursor:pointer;
}
@media(max-width:600px){
  .extra-fields{grid-template-columns:minmax(0,1fr) auto;gap:8px}
}
