:root {
  --bg: #ffffff;
  --border: #000000;
  --text: #000000;
  --muted: #333333;
  --highlight: #ffff00;
  --danger: #ff0000;
  --font: "Courier New", Courier, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.4;
  border: 6px solid black;
}

a { color: inherit; font-weight: 700; }

:focus-visible {
  outline: 4px solid #0000ff;
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Header */
header {
  border-bottom: 4px solid black;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--highlight);
  flex-wrap: wrap;
}

.logo {
  font-weight: 900;
  font-size: 1.35rem;
  text-transform: uppercase;
  letter-spacing: -0.04em;
  text-decoration: none;
  color: #000;
}

.header-actions, nav {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  align-items: center;
}

nav a {
  font-size: 0.82rem;
  text-transform: uppercase;
  margin-left: 0.6rem;
}

button, .btn {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  border: 3px solid black;
  padding: 0.42rem 0.85rem;
  cursor: pointer;
  background: white;
  color: black;
  text-transform: uppercase;
  transition: background 0.08s, color 0.08s;
  line-height: 1.2;
}

button:hover, .btn:hover { background: black; color: white; }
button.primary { background: black; color: white; }
button.primary:hover { background: #222; }
button.danger:hover { background: var(--danger); border-color: var(--danger); color: white; }

/* Main */
main {
  max-width: 920px;
  margin: 0 auto;
  padding: 1.25rem 1.15rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.intro h1 {
  font-size: 1.5rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 0.35rem;
}
.intro p { font-size: 0.92rem; max-width: 62ch; }

/* Quick text */
.quick { border: 4px solid black; }

.quick-label {
  display: block;
  background: black;
  color: white;
  padding: 0.35rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.quick textarea {
  width: 100%;
  border: none;
  padding: 0.9rem 1rem;
  font-family: inherit;
  font-size: 0.95rem;
  min-height: 96px;
  resize: vertical;
  background: #fafafa;
  display: block;
}

.quick-actions { display: flex; border-top: 3px solid black; }

.quick-actions button {
  flex: 1;
  border: none;
  border-right: 3px solid black;
  padding: 0.7rem;
}
.quick-actions button:last-child { border-right: none; }

/* Toolbar */
.toolbar { display: flex; border: 3px solid black; }

.search {
  flex: 1;
  border: none;
  padding: 0.55rem 0.9rem;
  font-family: inherit;
  font-size: 0.9rem;
  background: white;
  min-width: 0;
}

.toolbar button {
  border: none;
  border-left: 3px solid black;
  white-space: nowrap;
}

/* Settings */
.settings {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.4rem;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  border: 3px solid black;
  padding: 0.6rem 0.8rem;
  background: #f5f5f5;
}
.settings label { display: flex; align-items: center; gap: 0.45rem; }
.settings input[type="checkbox"] { width: 1.1rem; height: 1.1rem; accent-color: black; }
.settings select {
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  border: 3px solid black;
  background: white;
  padding: 0.2rem 0.3rem;
}
.settings .storage { margin-left: auto; font-weight: 400; color: var(--muted); }
.hint { font-size: 0.75rem; color: var(--muted); margin-top: -0.6rem; max-width: 80ch; }

/* Cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 0.9rem;
}

.card {
  border: 3px solid black;
  background: white;
  display: flex;
  flex-direction: column;
  min-height: 140px;
  min-width: 0;
}
.card.pinned { background: var(--highlight); }

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0.65rem;
  border-bottom: 2px solid black;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  background: #f0f0f0;
}
.card.pinned .card-top { background: black; color: white; }

.card-content {
  padding: 0.8rem 0.85rem;
  font-size: 0.88rem;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 150px;
  overflow-y: auto;
  flex: 1;
  line-height: 1.35;
}
.card-content img { max-width: 100%; max-height: 130px; display: block; }
.card-content .file-row { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; white-space: normal; }
.card-content .file-size { font-weight: 400; color: var(--muted); }
.card-content .more { color: var(--muted); }

.card-actions { display: flex; border-top: 2px solid black; }

.card-actions button {
  flex: 1;
  border: none;
  border-right: 2px solid black;
  padding: 0.5rem 0.3rem;
  font-size: 0.75rem;
}
.card-actions button:last-child { border-right: none; }
.card-actions .copy { background: black; color: white; }
.card-actions .copy:hover { background: #333; }
.card-actions .copy.copied { background: #166534; }
.card-actions .dl { background: #1e40af; color: white; }
.card-actions .dl:hover { background: #1e3a8a; }
.card-actions .view { background: #854d0e; color: white; }
.card-actions .view:hover { background: #713f12; }

/* Empty + drop */
.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2.5rem 1rem;
  border: 3px dashed black;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.95rem;
}

.drop-active { outline: 4px dashed black; outline-offset: -8px; background: #ffffcc; }

/* Toast */
.toast {
  position: fixed;
  bottom: 1.4rem;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: black;
  color: white;
  padding: 0.55rem 1.15rem;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  border: 3px solid white;
  outline: 3px solid black;
  transition: transform 0.2s, visibility 0s 0.2s;
  visibility: hidden;
  z-index: 300;
  display: flex;
  gap: 0.9rem;
  align-items: center;
  max-width: calc(100vw - 2rem);
}
.toast.show { transform: translateX(-50%) translateY(0); visibility: visible; transition: transform 0.2s; }
.toast button { background: var(--highlight); border-color: var(--highlight); padding: 0.2rem 0.6rem; }
.toast button:hover { background: white; color: black; }
.toast button[hidden] { display: none; }

footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  border-top: 3px solid black;
  color: var(--muted);
}
footer .links { display: block; margin-top: 0.4rem; font-size: 0.7rem; }
footer a { margin: 0 0.35rem; }

/* Content sections (home page + content pages) */
.content { max-width: 920px; margin: 0 auto; padding: 0 1.15rem 2.5rem; }
.content h2 {
  font-size: 1.15rem;
  font-weight: 900;
  text-transform: uppercase;
  border-bottom: 3px solid black;
  padding-bottom: 0.35rem;
  margin: 2rem 0 1rem;
}
.content h3 { font-size: 0.95rem; text-transform: uppercase; margin: 1.2rem 0 0.4rem; }
.content p { font-size: 0.9rem; line-height: 1.55; margin-bottom: 0.9rem; max-width: 68ch; }
.content ol, .content ul { padding-left: 1.4rem; margin-bottom: 1rem; }
.content li { margin-bottom: 0.4rem; font-size: 0.9rem; line-height: 1.5; max-width: 68ch; }
.content kbd {
  border: 2px solid black;
  padding: 0 0.3rem;
  font-family: inherit;
  font-weight: 700;
  background: #f0f0f0;
}
.content .callout {
  border: 4px solid black;
  background: var(--highlight);
  padding: 0.9rem 1rem;
  margin: 1.2rem 0;
  font-size: 0.9rem;
  line-height: 1.5;
  max-width: 68ch;
}
.content .callout a { text-decoration: underline; }
.content .meta { font-size: 0.78rem; font-weight: 700; color: var(--muted); margin-bottom: 1.2rem; }

.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 1.15rem 3rem;
}
.page h1 {
  font-size: 1.6rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 0.5rem;
}
.page .lead { font-size: 0.98rem; line-height: 1.5; margin: 0.6rem 0 1rem; max-width: 62ch; }
.page .content { padding: 0; }

.faq-item { border: 3px solid black; margin-bottom: 0.75rem; }
.faq-item summary {
  padding: 0.7rem 0.9rem;
  font-weight: 700;
  cursor: pointer;
  background: #f5f5f5;
  list-style: none;
  text-transform: uppercase;
  font-size: 0.85rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item[open] summary { background: var(--highlight); border-bottom: 2px solid black; }
.faq-item p { padding: 0.85rem 0.9rem; font-size: 0.88rem; line-height: 1.5; margin: 0; max-width: none; }

.noscript { border: 4px solid black; background: var(--highlight); padding: 0.9rem 1rem; font-weight: 700; }

/* View modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s, visibility 0s 0.15s; /* hide after fade-out */
}
.modal-overlay.open { opacity: 1; visibility: visible; transition: opacity 0.15s; } /* visible at once so focus can move in */
.modal {
  background: white;
  border: 4px solid black;
  width: 100%;
  max-width: 720px;
  max-height: 85dvh;
  display: flex;
  flex-direction: column;
  box-shadow: 8px 8px 0 black;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.9rem;
  background: black;
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  gap: 0.5rem;
}
.modal-header span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-header button { border-color: white; color: white; background: transparent; }
.modal-header button:hover { background: white; color: black; }
.modal-body { overflow: auto; flex: 1; background: #fafafa; min-height: 200px; }
.modal-body pre {
  margin: 0;
  padding: 1rem;
  font-family: inherit;
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
}
.modal-body .binary-note {
  padding: 1rem;
  background: #ffffcc;
  border-bottom: 2px solid black;
  font-size: 0.8rem;
  font-weight: 700;
}
.modal-body .loading { padding: 2rem; text-align: center; font-weight: 700; text-transform: uppercase; }
.modal-body embed { width: 100%; height: 70dvh; border: none; display: block; }
.modal-body .pdf-link { padding: 0.75rem; font-size: 0.8rem; text-align: center; }
.modal-body img.preview { max-width: 100%; display: block; margin: 0 auto; padding: 1rem; }
.modal-body .sheet-wrap { overflow: auto; max-height: 70dvh; }
.modal-body .sheet-table { border-collapse: collapse; width: 100%; font-size: 0.8rem; }
.modal-body .sheet-table th,
.modal-body .sheet-table td { border: 1px solid #999; padding: 0.35rem 0.5rem; text-align: left; white-space: nowrap; }
.modal-body .sheet-table tr:nth-child(even) { background: #f5f5f5; }
.modal-body .docx-html {
  padding: 1.25rem;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 0.95rem;
  line-height: 1.6;
}
.modal-body .docx-html img { max-width: 100%; }
.modal-body .docx-html table { border-collapse: collapse; }
.modal-body .docx-html td, .modal-body .docx-html th { border: 1px solid #999; padding: 0.3rem 0.5rem; }
.modal-footer { display: flex; border-top: 3px solid black; }
.modal-footer button { flex: 1; border: none; border-right: 3px solid black; padding: 0.7rem; }
.modal-footer button:last-child { border-right: none; }

@media (max-width: 560px) {
  body { border-width: 4px; }
  .cards { grid-template-columns: 1fr; }
  header { padding: 0.7rem 0.9rem; }
  main { padding: 1rem 0.85rem 2.5rem; }
  .settings .storage { margin-left: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
