:root {
  --bg: #f1eee6;
  --ink: #161512;
  --muted: #686156;
  --line: #d6cdbf;
  --panel: #fffaf0;
  --panel-2: #ebe5d7;
  --accent: #0b6e69;
  --accent-2: #b6412d;
  --good: #26865f;
  --shadow: 0 24px 70px rgba(46, 34, 22, 0.16);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--ink);
  font-family: ui-serif, Georgia, "Times New Roman", serif;
  background:
    linear-gradient(90deg, rgba(22, 21, 18, 0.045) 1px, transparent 1px),
    linear-gradient(180deg, rgba(22, 21, 18, 0.04) 1px, transparent 1px),
    var(--bg);
  background-size: 34px 34px;
}

button,
textarea {
  font: inherit;
}

.shell {
  width: min(1120px, calc(100vw - 28px));
  margin: 20px auto;
  min-height: calc(100vh - 40px);
  display: grid;
}

.board {
  display: grid;
  grid-template-rows: auto auto 1fr;
  min-height: calc(100vh - 40px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.93);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fffaf0, #f2ebde);
}

.label {
  margin: 0 0 3px;
  color: var(--accent-2);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1;
  font-weight: 700;
}

.status {
  display: inline-grid;
  grid-template-columns: auto auto auto auto auto;
  gap: 8px;
  align-items: center;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  background: var(--panel);
}

.mini-button {
  width: 28px;
  height: 26px;
  min-width: 28px;
  border-radius: 6px;
}

.mini-button span {
  font-size: 15px;
}

.mini-button.copied {
  border-color: var(--accent);
  color: #fffaf0;
  background: var(--accent);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #9b8f7d;
}

.dot.online {
  background: var(--good);
  box-shadow: 0 0 0 5px rgba(38, 134, 95, 0.13);
}

.drop-zone {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #e9e0cf;
}

.drop-zone.dragging {
  background: #d8ebdf;
  outline: 2px solid var(--accent);
  outline-offset: -5px;
}

.composer {
  display: grid;
  grid-template-columns: 1fr 46px 46px;
  gap: 8px;
  align-items: end;
}

textarea {
  width: 100%;
  min-height: 46px;
  max-height: 170px;
  padding: 12px 14px;
  border: 1px solid #bdb2a2;
  border-radius: 8px;
  color: var(--ink);
  resize: none;
  outline: none;
  background: #fffdf7;
  line-height: 1.42;
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(11, 110, 105, 0.13);
}

button {
  height: 46px;
  border: 1px solid #a99f91;
  border-radius: 8px;
  color: #fffaf0;
  background: var(--ink);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 120ms ease, background 120ms ease;
}

button:hover {
  transform: translateY(-1px);
  background: var(--accent);
}

button span {
  display: block;
  font-size: 22px;
  line-height: 1;
}

.upload-queue {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.upload-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid #c8bdad;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  background: rgba(255, 250, 240, 0.72);
}

.bar {
  height: 6px;
  margin-top: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: #d2c6b5;
}

.bar > span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
}

.content {
  position: relative;
  overflow: auto;
  min-height: 420px;
  padding: 18px 16px 26px;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.item {
  width: min(920px, 100%);
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.item.own {
  margin-left: auto;
  border-color: rgba(11, 110, 105, 0.4);
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.item-tools {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.item-tools button {
  width: 28px;
  height: 26px;
  min-width: 28px;
  border-radius: 6px;
  color: var(--ink);
  background: transparent;
}

.item-tools button.copied {
  color: #fffaf0;
  background: var(--accent);
}

.item-tools button:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: transparent;
}

.item-tools button span {
  font-size: 14px;
}

.text-body {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  font-size: 18px;
  line-height: 1.55;
  text-wrap: pretty;
}

.file-card {
  display: grid;
  grid-template-columns: 68px 1fr auto;
  gap: 14px;
  align-items: center;
}

.thumb {
  width: 68px;
  height: 68px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  object-fit: cover;
  display: grid;
  place-items: center;
  color: var(--accent-2);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.file-name {
  margin: 0 0 5px;
  font-size: 17px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.file-meta {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.file-actions {
  display: flex;
  gap: 8px;
}

.file-actions button {
  width: 42px;
  height: 38px;
}

.empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 18px;
  text-align: center;
  color: var(--muted);
  pointer-events: none;
}

.empty.hidden {
  display: none;
}

.preview-dialog {
  width: min(1040px, calc(100vw - 28px));
  height: min(820px, calc(100vh - 28px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.preview-dialog::backdrop {
  background: rgba(22, 21, 18, 0.45);
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 10px 12px 10px 16px;
  border-bottom: 1px solid var(--line);
  background: #f2ebde;
}

.preview-header h2 {
  margin: 0;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.preview-header button {
  width: 38px;
  height: 38px;
}

.preview-body {
  height: calc(100% - 58px);
  overflow: auto;
  padding: 16px;
}

.preview-frame,
.preview-image {
  width: 100%;
  height: 100%;
  border: 0;
}

.preview-image {
  object-fit: contain;
  background: #171613;
}

.preview-code {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 14px;
  line-height: 1.55;
}

.preview-doc {
  max-width: 820px;
  margin: 0 auto;
  line-height: 1.65;
}

.preview-table {
  width: 100%;
  border-collapse: collapse;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
}

.preview-table td {
  max-width: 300px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.preview-note {
  max-width: 620px;
  margin: 80px auto;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
  text-align: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 20;
  max-width: calc(100vw - 32px);
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #fffaf0;
  background: var(--ink);
  box-shadow: 0 12px 34px rgba(22, 21, 18, 0.24);
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 140ms ease, transform 140ms ease;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.pulse {
  width: 84px;
  height: 84px;
  margin: 0 auto;
  border: 1px solid #bdb2a2;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(182, 65, 45, 0.2), transparent 62%);
  animation: breathe 2.6s ease-in-out infinite;
}

@keyframes breathe {
  0%,
  100% {
    transform: scale(0.94);
    opacity: 0.62;
  }
  50% {
    transform: scale(1.05);
    opacity: 1;
  }
}

@media (max-width: 680px) {
  .shell {
    width: 100vw;
    min-height: 100vh;
    margin: 0;
  }

  .board {
    min-height: 100vh;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  h1 {
    font-size: 25px;
  }

  .composer {
    grid-template-columns: 1fr 44px 44px;
  }

  .file-card {
    grid-template-columns: 54px 1fr;
  }

  .thumb {
    width: 54px;
    height: 54px;
  }

  .file-actions {
    grid-column: 1 / -1;
  }
}
