* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: #111418;
  color: #e6e9ee;
  font: 14px/1.5 ui-sans-serif, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "Noto Sans SC", sans-serif;
  overscroll-behavior: none;
}

#app {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100dvh;
  max-width: 1080px;
  margin: 0 auto;
  padding: calc(8px + env(safe-area-inset-top)) calc(10px + env(safe-area-inset-right))
    calc(8px + env(safe-area-inset-bottom)) calc(10px + env(safe-area-inset-left));
}

header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.grow {
  flex: 1;
}

.chip {
  padding: 3px 8px;
  border-radius: 999px;
  background: #1b2027;
  color: #8b97a8;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}

.chip.warn {
  background: #3a2418;
  color: #f0a860;
}

.chip.live {
  background: #173024;
  color: #6ecf9a;
}

.btn {
  padding: 5px 12px;
  border: 1px solid #2c333d;
  border-radius: 8px;
  background: #1b2027;
  color: #dfe4ea;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.btn:hover {
  background: #232a33;
}

.btn:active {
  transform: translateY(1px);
}

#text {
  flex: 1;
  width: 100%;
  min-height: 0;
  padding: 12px;
  border: 1px solid #252c35;
  border-radius: 10px;
  background: #0d1014;
  color: #e6e9ee;
  font: 14px/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  resize: none;
  outline: none;
  tab-size: 4;
}

#text:focus {
  border-color: #3d6ef2;
}

#files {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 8px;
}

.card {
  border: 1px solid #252c35;
  border-radius: 10px;
  background: #0d1014;
  overflow: hidden;
  flex: 0 0 auto;
}

.card .hd {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid #1c222a;
}

.card .hd a {
  color: #cdd6e1;
  text-decoration: none;
  word-break: break-all;
}

.card .hd a:hover {
  text-decoration: underline;
}

.card .sz {
  margin-left: auto;
  color: #7c8797;
  font-size: 12px;
  white-space: nowrap;
}

.card img,
.card video {
  display: block;
  max-width: 100%;
  max-height: 78dvh;
  margin: 0 auto;
  background: #1a1f27;
}

.card audio {
  display: block;
  width: 100%;
  padding: 10px;
}

.card iframe {
  display: block;
  width: 100%;
  height: 74dvh;
  border: 0;
  background: #fff;
}

.card pre {
  margin: 0;
  padding: 10px 12px;
  max-height: 74dvh;
  overflow: auto;
  color: #d5dbe4;
  font: 12.5px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

#bar {
  flex: 0 0 auto;
  height: 3px;
  border-radius: 3px;
  background: #1c222a;
  overflow: hidden;
}

#bar i {
  display: block;
  height: 100%;
  width: 0;
  background: #3d6ef2;
  transition: width 0.15s linear;
}

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  padding: 6px 12px;
  border-radius: 8px;
  background: #2a1f14;
  color: #f0b76a;
  font-size: 13px;
  pointer-events: none;
}
