:root {
  color-scheme: dark;
  --paper: #0d1019;
  --surface: #181d2b;
  --surface-raised: #20283a;
  --input: #111724;
  --ink: #f3f3fd;
  --muted: #aeb9ce;
  --line: #353d53;
  --accent: #b4baff;
  --button: #c0c5ff;
  --button-ink: #15182d;
  --soft: #222a40;
  --placeholder: #8b98b0;
  --error: #ffb8b2;
  --focus: #d7d9ff;
  --glow: #6761ae22;
  --shadow: 0 20px 56px #05061369;
}

:root[data-theme="light"] {
  color-scheme: light;
  --paper: #f6f6fb;
  --surface: #fff;
  --surface-raised: #f4f5fb;
  --input: #fff;
  --ink: #202437;
  --muted: #536079;
  --line: #cdd3e4;
  --accent: #5255a6;
  --button: #5054a4;
  --button-ink: #fff;
  --soft: #eceefb;
  --placeholder: #737e95;
  --error: #af3942;
  --focus: #5259b0;
  --glow: #7672bd14;
  --shadow: 0 20px 50px #21244914;
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 84% -10%, var(--glow), transparent 34rem),
    var(--paper);
  color: var(--ink);
  font:
    15px/1.6 ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}
header,
footer {
  max-width: 1160px;
  margin: auto;
  padding: 28px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}
header {
  padding-top: 18px;
  padding-bottom: 12px;
}
.brand {
  color: var(--ink);
  text-decoration: none;
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.04em;
  white-space: nowrap;
}
.brand span {
  color: var(--muted);
  font-weight: 400;
  margin-left: 8px;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.badge {
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 6px 13px;
  font-size: 12px;
  white-space: nowrap;
}
button {
  font: inherit;
  cursor: pointer;
}
#theme-toggle {
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 7px 15px;
  color: var(--ink);
  background: var(--surface);
  font-size: 12px;
  white-space: nowrap;
}
#theme-toggle:hover,
#attach:hover,
#file-list button:hover {
  border-color: var(--accent);
}
main {
  max-width: 1100px;
  margin: auto;
  padding: 16px 32px 24px;
}
.intro {
  margin-bottom: 22px;
}
.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.18em;
}
h1 {
  margin: 11px 0 0;
  font-size: clamp(28px, 4.2vw, 50px);
  line-height: 1.16;
  font-weight: 660;
  letter-spacing: -0.047em;
  white-space: nowrap;
}
.dot {
  color: var(--accent);
}
form {
  max-width: 850px;
  padding: 25px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}
fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.composer {
  background: var(--input);
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 18px;
  transition: border-color 0.15s;
}
.composer:focus-within,
.composer.drag {
  border-color: var(--accent);
}
.composer.drag {
  background: var(--soft);
}
.composer-label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
}
textarea,
input,
select {
  font: inherit;
  color: var(--ink);
}
#text {
  display: block;
  width: 100%;
  min-height: 140px;
  max-height: 470px;
  border: 0;
  outline: 0;
  border-radius: 6px;
  background: transparent;
  padding: 4px 0;
  resize: vertical;
  font-size: 16px;
  line-height: 1.65;
}
textarea::placeholder,
input::placeholder {
  color: var(--placeholder);
  opacity: 1;
}
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}
#text:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}
.composer-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 13px;
}
#files {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
#attach {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 620;
  white-space: nowrap;
}
#attach span[aria-hidden] {
  font-size: 19px;
  line-height: 1;
}
.drop-hint,
.hint {
  color: var(--muted);
  font-size: 12px;
}
.hint {
  margin: 9px 2px 0;
}
#file-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
#file-list:not(:empty) {
  margin-top: 13px;
}
#file-list li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  min-width: 0;
  padding: 5px 7px 5px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
  font-size: 12px;
}
#file-list li span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#file-list li span.error {
  color: var(--error);
}
#file-list button {
  flex: none;
  padding: 1px 6px;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
}
details {
  margin-top: 25px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 16px 2px;
}
summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}
summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  margin-left: 10px;
}
.metadata {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  padding-top: 20px;
}
.metadata label {
  display: grid;
  gap: 7px;
  font-size: 12px;
}
.model-field {
  position: relative;
  display: grid;
  gap: 7px;
  min-width: 0;
}
.model-field label {
  display: block;
}
#model-matches {
  position: absolute;
  z-index: 6;
  top: calc(100% + 3px);
  left: 0;
  right: 0;
  max-height: 224px;
  overflow-y: auto;
  margin: 0;
  padding: 5px;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-raised);
  box-shadow: var(--shadow);
}
#model-matches[hidden] {
  display: none;
}
#model-matches li {
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--ink);
  font-size: 13px;
  overflow-wrap: anywhere;
  cursor: pointer;
}
#model-matches li:hover,
#model-matches li[aria-selected="true"] {
  background: var(--soft);
  color: var(--accent);
}
.metadata .wide {
  grid-column: 1/-1;
}
.metadata input,
.metadata select,
.metadata textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input);
  font-size: 14px;
}
.metadata textarea {
  resize: vertical;
}
.notice {
  margin: 20px 0 0;
  padding: 14px 17px;
  border-radius: 10px;
  background: var(--soft);
  font-size: 12px;
  color: var(--muted);
}
.notice strong {
  color: var(--ink);
}
.notice p {
  margin: 5px 0 7px;
}
a {
  color: var(--accent);
}
#submit,
#another {
  padding: 11px 17px;
  border: 0;
  border-radius: 9px;
  background: var(--button);
  color: var(--button-ink);
  font-size: 13px;
  font-weight: 700;
}
#submit {
  flex: none;
  margin-left: auto;
  white-space: nowrap;
}
#submit span {
  margin-left: 12px;
}
#submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
#submit:not(:disabled):hover,
#another:hover {
  filter: brightness(1.07);
}
progress {
  width: 100%;
  margin-top: 19px;
  accent-color: var(--accent);
}
#status {
  color: var(--muted);
  font-size: 13px;
}
#status.error {
  color: var(--error);
}
#receipt {
  background: var(--soft);
  border-radius: 10px;
  margin-top: 16px;
  padding: 21px;
}
#receipt h2 {
  margin: 0;
}
#receipt p {
  font-size: 13px;
}
#receipt code {
  display: block;
  overflow-wrap: anywhere;
  padding: 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
}
.bottom-note {
  max-width: 850px;
  margin: 32px 0;
}
.bottom-note h2 {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 650;
}
.bottom-note p {
  margin: 0;
  color: var(--accent);
  font-size: 14px;
}
footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}
@media (max-width: 680px) {
  header,
  footer {
    padding: 19px 18px;
  }
  header {
    padding-top: 12px;
    padding-bottom: 8px;
  }
  .badge {
    display: none;
  }
  main {
    padding: 12px 16px 24px;
  }
  .intro {
    margin-bottom: 18px;
  }
  h1 {
    font-size: clamp(19px, 4.1vw, 29px);
    letter-spacing: -0.045em;
  }
  form {
    padding: 16px;
  }
  .composer {
    padding: 14px;
  }
  #text {
    min-height: 120px;
  }
  .drop-hint {
    display: none;
  }
  .metadata {
    grid-template-columns: 1fr;
  }
  summary span {
    display: block;
    margin: 3px 0 0;
  }
}
@media (max-width: 410px) {
  .brand {
    font-size: 17px;
  }
  #theme-toggle {
    padding: 6px 10px;
  }
  h1 {
    font-size: clamp(18px, 5.1vw, 21px);
  }
  .attach-text {
    display: none;
  }
  #attach {
    padding: 7px 10px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .composer {
    transition: none;
  }
}
