@font-face {
  font-family: "Luciole Mono";
  src: url("/static/fonts/LucioleMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Luciole Mono";
  src: url("/static/fonts/LucioleMono-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --page: #1f5963;
  --panel: #18464f;
  --inset: #12383f;
  --line: rgba(244, 251, 248, 0.16);
  --foam: #f4fbf8;
  --mist: #d7eee7;
  --hint: #c5e2da;
  --brass: #f0b429;
  --brass-ink: #2a220c;
  --signal: #7af0c4;
  --coral: #ffb1a4;
  --shadow: 0 18px 50px rgba(12, 40, 46, 0.28);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: "Luciole Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 16px;
  line-height: 1.45;
  color: var(--foam);
  background:
    radial-gradient(900px 420px at 100% -8%, rgba(240, 180, 41, 0.22), transparent 58%),
    radial-gradient(720px 480px at -12% 110%, rgba(122, 240, 196, 0.16), transparent 52%),
    var(--page);
}

.desk {
  width: min(1080px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.2rem 0 1.2rem;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 1.15rem 1.25rem;
  align-items: start;
}

.mast { grid-column: 1 / -1; padding-bottom: 0.4rem; }

.kicker {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  color: var(--brass);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0.35rem 0 0.4rem;
  font-size: clamp(3.1rem, 8vw, 5.4rem);
  line-height: 0.9;
  font-weight: 700;
  letter-spacing: -0.04em;
}

h1 span { color: var(--brass); }

.deck {
  max-width: 38rem;
  margin: 0;
  color: var(--mist);
}

.lamp {
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 50%;
  background: var(--hint);
  box-shadow: 0 0 0 0 rgba(122, 240, 196, 0.4);
}

.lamp.busy {
  background: var(--brass);
  animation: pulse 1s ease-in-out infinite;
}

.lamp.ok { background: var(--signal); box-shadow: 0 0 12px var(--signal); }
.lamp.bad { background: var(--coral); box-shadow: 0 0 12px var(--coral); }

@keyframes pulse {
  50% { transform: scale(0.82); }
}

.composer, .ticket, .reply {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.composer { padding: 1.1rem 1.15rem 1rem; }

.field { margin-bottom: 0.95rem; }

.label-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.4rem;
  color: var(--hint);
  font-size: 0.82rem;
}

.label-row label { color: var(--foam); }

textarea, button, input { font: inherit; color: inherit; }

textarea {
  display: block;
  width: 100%;
  resize: vertical;
  min-height: 9.2rem;
  padding: 0.85rem 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--inset);
  caret-color: var(--brass);
}

textarea::placeholder { color: rgba(197, 226, 218, 0.55); }

textarea:focus, button:focus-visible, .drop:focus-within {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}

.drop {
  position: relative;
  min-height: 7.4rem;
  padding: 0.9rem;
  border-radius: 12px;
  border: 1px dashed rgba(240, 180, 41, 0.55);
  background: var(--inset);
}

.drop.hot { border-style: solid; background: rgba(240, 180, 41, 0.1); }

.drop input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.drop p { margin: 0.35rem 0 0; color: var(--mist); }

#preview { margin: 0; display: flex; gap: 0.8rem; align-items: center; }

#preview[hidden], #note-img[hidden], #reply-img[hidden], #reply-facts[hidden], #reply-body[hidden], #form-error[hidden] {
  display: none;
}

#preview img, #note-img, #reply-img {
  display: block;
  max-width: 100%;
  border-radius: 10px;
}

#preview img {
  width: 4.6rem;
  height: 4.6rem;
  object-fit: cover;
}

#preview figcaption {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

#preview-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 16rem;
}

#clear-image {
  position: relative;
  z-index: 1;
  align-self: flex-start;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--mist);
  cursor: pointer;
}

.form-error {
  margin: 0 0 0.7rem;
  color: var(--coral);
}

#send {
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 0.85rem 1rem;
  background: var(--brass);
  color: var(--brass-ink);
  font-weight: 700;
  cursor: pointer;
}

#send:disabled { cursor: not-allowed; opacity: 0.45; }

#send:not(:disabled):hover { filter: brightness(1.06); }

.fine {
  margin: 0.75rem 0 0;
  color: var(--hint);
  font-size: 0.82rem;
}

.fine code { color: var(--foam); }

.stack { display: grid; gap: 1.15rem; }

.ticket, .reply { padding: 1rem 1.05rem 1.05rem; }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

#ticket-state { margin: 0; color: var(--hint); font-size: 0.82rem; }

.note {
  background:
    radial-gradient(circle at 0 12px, transparent 8px, var(--inset) 8.5px) left / 14px 100% repeat-y,
    var(--inset);
  margin-left: 0.35rem;
  padding: 0.9rem 0.95rem 0.95rem 1.15rem;
  border-radius: 0 14px 14px 0;
}

.note-from {
  margin: 0;
  color: var(--brass);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.note-text { margin: 0.35rem 0 0; white-space: pre-wrap; word-break: break-word; }

#note-img { margin-top: 0.75rem; max-height: 180px; object-fit: cover; }

.pill {
  margin: 0;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: var(--inset);
  color: var(--hint);
  font-size: 0.78rem;
}

.pill.ok { color: var(--brass-ink); background: var(--signal); }
.pill.bad { color: var(--brass-ink); background: var(--coral); }

#reply-lead { margin: 0; color: var(--mist); }

#reply-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.28rem 0.8rem;
  margin: 0.85rem 0 0;
}

#reply-facts dt { color: var(--hint); }
#reply-facts dd { margin: 0; min-width: 0; overflow-wrap: break-word; }

#reply-img { margin-top: 0.85rem; max-height: 280px; object-fit: contain; background: var(--inset); }

#reply-body {
  margin: 0.85rem 0 0;
  padding: 0.8rem;
  overflow: auto;
  max-height: 22rem;
  border-radius: 12px;
  background: var(--inset);
  color: var(--mist);
  font-size: 15px;
  line-height: 1.4;
  white-space: pre;
}

footer {
  width: min(1080px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 0.2rem 0 1.6rem;
  color: var(--hint);
  font-size: 0.75rem;
}

footer p { margin: 0; }

@media (max-width: 840px) {
  .desk { grid-template-columns: 1fr; width: min(1080px, calc(100% - 1.2rem)); padding-top: 1.3rem; }
  h1 { font-size: 3.3rem; }
  #reply-facts { grid-template-columns: 1fr; gap: 0.1rem 0; }
  #reply-facts dd { margin-bottom: 0.45rem; }
}

@media (prefers-reduced-motion: reduce) {
  .lamp.busy { animation: none; }
  #send:not(:disabled):hover { filter: none; }
}
