:root {
  color-scheme: dark;
  --gold: #e9b949;
  --surface: #181818;
  --border: #40392b;
  --muted: #c0b8a8;
}
body {
  background: radial-gradient(ellipse at top, #262015, #101010 36rem);
  font-family: system-ui, sans-serif;
}
main { max-width: 60rem; padding: 1rem clamp(1rem, 4vw, 2rem) 3rem; }
header {
  display: flex;
  align-items: center;
  gap: .9rem;
  text-align: left;
  padding: 1rem 0 1.2rem;
  background: transparent;
  border-bottom: 1px solid var(--border);
}
header img { border: 1px solid #a37e32; border-radius: .65rem; }
h1 { font-size: clamp(1.55rem, 5vw, 2.35rem); line-height: 1; letter-spacing: .12em; }
header p { margin: .4rem 0 0; font-size: .95rem; color: var(--muted); }
nav { display: flex; flex-wrap: wrap; gap: .4rem; margin: .8rem 0; }
nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: .45rem .65rem;
  border-radius: .5rem;
  color: #f2d28a;
  text-decoration: none;
  font-size: .9rem;
}
nav a:hover { background: #32291b; }
:focus-visible { outline: 3px solid #ffd76a; outline-offset: 2px; }
.settings { display: grid; gap: .3rem .75rem; }
.settings label { font-size: .9rem; color: var(--muted); }
.panel {
  padding: clamp(.9rem, 4vw, 1.5rem);
  background: var(--surface);
  border-color: var(--border);
  border-radius: 1rem;
  scroll-margin-top: .75rem;
}
.panel h2 { margin: 0 0 .8rem; }
#library-tool h2:not(:first-child) { margin-top: 1.5rem; }
button, input, select, textarea { background: #232220; border-color: #665b45; }
button:not(:disabled):hover { border-color: var(--gold); }
button, select { overflow-wrap: anywhere; }
button.primary { letter-spacing: .02em; }
textarea { resize: vertical; }
#textstatus:empty, #source:empty, #status:empty, #quickstatus:empty, #editstatus:empty { display: none; }
#text-tool small { display: block; margin-top: .75rem; }
#out { margin: .5rem 0 1rem; font-size: clamp(1.3rem, 4vw, 2rem); }
#result-tool { border-color: #8e7138; }
.stepper { display: grid; grid-template-columns: 3rem minmax(0, 1fr) 3rem; gap: .5rem; }
.stepper input { text-align: center; }
#saved { display: grid; gap: .5rem; }
#saved button { text-align: left; }
#matches { max-height: 30rem; overflow: auto; padding: 0 .2rem; }
#quickgo, #quickedit, #quickadd, #quickremove, #quickpin, #favfilter, #saveedit, #export { margin-top: .5rem; }
@media (min-width: 38rem) {
  .settings { grid-template-columns: 1fr 1fr; }
  .settings label { grid-row: 1; }
  .tapgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
