:root {
  --bg: #0e1116;
  --panel: #161b22;
  --edge: #272e38;
  --text: #e6edf3;
  --dim: #8b949e;
  --accent: #4aa3ff;
  --good: #3fb950;
  --bad: #f85149;
  --warn: #d29922;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 ui-sans-serif, -apple-system, "Segoe UI", system-ui, sans-serif;
  display: flex;
  justify-content: center;
  padding: 40px 20px;
  min-height: 100vh;
}

main { width: 100%; max-width: 680px; }

h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -0.3px; }
h2 { font-size: 15px; margin: 28px 0 10px; color: var(--dim); font-weight: 600; }
p  { color: var(--dim); margin: 0 0 18px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 16px;
}

label { display: block; font-size: 13px; color: var(--dim); margin: 12px 0 5px; }

input, textarea {
  width: 100%;
  background: #0d1117;
  border: 1px solid var(--edge);
  border-radius: 7px;
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
  outline: none;
}
input:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 150px; font-family: ui-monospace, Menlo, monospace; font-size: 14px; }

button {
  background: var(--accent);
  color: #06121f;
  border: 0;
  border-radius: 7px;
  padding: 10px 18px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
button:hover { filter: brightness(1.1); }
button:disabled { opacity: 0.5; cursor: default; }
button.ghost { background: transparent; color: var(--dim); border: 1px solid var(--edge); font-weight: 400; }
button.ghost:hover { color: var(--text); }
button.danger { background: transparent; color: var(--bad); border: 1px solid var(--edge); font-weight: 400; padding: 5px 10px; font-size: 13px; }

.row { display: flex; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }

.msg { padding: 10px 12px; border-radius: 7px; font-size: 14px; margin: 14px 0 0; display: none; }
.msg.show { display: block; }
.msg.err  { background: rgba(248,81,73,0.12);  color: var(--bad);  border: 1px solid rgba(248,81,73,0.3); }
.msg.ok   { background: rgba(63,185,80,0.12);  color: var(--good); border: 1px solid rgba(63,185,80,0.3); }
.msg.warn { background: rgba(210,153,34,0.12); color: var(--warn); border: 1px solid rgba(210,153,34,0.35); }

code, .mono {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 13px;
  background: #0d1117;
  border: 1px solid var(--edge);
  border-radius: 6px;
  padding: 2px 6px;
  word-break: break-all;
}

.linkbox { display: block; padding: 10px 12px; color: var(--accent); margin: 8px 0 12px; }

.recovery {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 17px;
  letter-spacing: 1px;
  text-align: center;
  padding: 16px;
  background: #0d1117;
  border: 1px dashed var(--warn);
  border-radius: 8px;
  color: var(--warn);
  margin: 12px 0;
  user-select: all;
}

.drop {
  border: 1px solid var(--edge);
  border-bottom: 0;
  padding: 12px 14px;
  display: flex;
  gap: 12px;
  align-items: center;
}
.drop:first-child { border-radius: 8px 8px 0 0; }
.drop:last-child  { border-radius: 0 0 8px 8px; border-bottom: 1px solid var(--edge); }
.drop .meta { font-size: 12px; color: var(--dim); }
.drop pre {
  margin: 6px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 13px;
  max-height: 220px;
  overflow: auto;
}

.dragging { outline: 2px dashed var(--accent); outline-offset: -8px; }
.muted { color: var(--dim); font-size: 13px; }
.center { text-align: center; }
a { color: var(--accent); }

/* utility classes - CSP forbids inline style attributes */
.hidden { display: none; }
.mt0 { margin-top: 0; }
.mb4 { margin-bottom: 4px; }
.mb14 { margin-bottom: 14px; }
.mt14 { margin-top: 14px; }
.mt16 { margin-top: 16px; }
.mt10 { margin-top: 10px; }
.m0 { margin: 0; }
.gap { margin: 4px 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
kbd {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px;
  border: 1px solid var(--edge);
  border-radius: 4px;
  padding: 1px 5px;
  background: #0d1117;
}
.empty { text-align: center; color: var(--dim); padding: 28px 10px; }
.drop-body { flex: 1; min-width: 0; }

.danger-zone { border-color: rgba(248, 81, 73, 0.35); margin-top: 28px; }
.danger-zone h2 { color: var(--bad); }

button.danger-solid {
  background: var(--bad);
  color: #fff;
  border: 0;
  font-weight: 600;
  padding: 10px 18px;
  font-size: 15px;
}
button.danger-solid:hover { filter: brightness(1.1); }

/* ---------- QR ---------- */

#qr-wrap { margin-top: 14px; }
#qr {
  display: flex;
  justify-content: center;
  padding: 16px;
  background: #fff;          /* scanners expect a light quiet zone */
  border-radius: 8px;
}
#qr svg { display: block; width: 100%; max-width: 260px; height: auto; }
.qr-hint { margin: 10px 0 0; font-size: 13px; }

/* ---------- small screens ---------- */

@media (max-width: 600px) {
  body { padding: 20px 14px; }

  h1 { font-size: 20px; }
  .panel { padding: 16px; }

  /* Button rows stack rather than squeezing to unreadable widths. */
  .row { flex-wrap: wrap; }
  .row > button { flex: 1 1 auto; min-width: 44%; }

  /* A drop's text and its actions need their own lines on a narrow screen. */
  .drop { flex-direction: column; align-items: stretch; gap: 10px; }
  .drop .row { justify-content: flex-end; }

  /* 84 characters of link has to wrap, not overflow the viewport. */
  .linkbox { font-size: 12px; }

  textarea { min-height: 180px; }   /* thumbs need a bigger target */
  #qr svg { max-width: 220px; }
}

/* Comfortable tap targets, per WCAG 2.5.8. */
@media (pointer: coarse) {
  button { min-height: 44px; }
  button.danger { min-height: 36px; }
  input { min-height: 44px; }
}
