:root {
  --bg: #0b1220;
  --panel: #131c2e;
  --panel-2: #1b2740;
  --line: #263449;
  --text: #e7ecf5;
  --muted: #93a2bb;
  --accent: #4f9cf9;
  --accent-2: #2f7fe0;
  --ok: #3fb47a;
  --warn: #e0a838;
  --bad: #e06060;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

h1 {
  font-size: 1.5rem;
  margin: 0 0 0.6rem;
}
h2 {
  font-size: 1.15rem;
  margin: 0 0 0.6rem;
}
code {
  background: var(--panel-2);
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
  font-size: 0.9em;
}

.top {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.7rem 1.25rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.brand .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--accent), var(--ok));
  display: inline-block;
}

.nav {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  flex-wrap: wrap;
  margin-left: auto;
}
.nav a.on {
  color: var(--text);
  font-weight: 600;
}
.badge {
  background: var(--bad);
  color: #fff;
  border-radius: 999px;
  padding: 0 0.45rem;
  font-size: 0.75rem;
}
.who {
  color: var(--muted);
  font-size: 0.9rem;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem;
}
.wrap.dropping {
  outline: 2px dashed var(--accent);
  outline-offset: -12px;
  background: rgba(79, 156, 249, 0.06);
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
}
.card.narrow {
  max-width: 520px;
  margin: 8vh auto;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.herostats {
  display: flex;
  gap: 1.25rem;
}
.herostats strong {
  display: block;
  font-size: 1.1rem;
}
.herostats span {
  color: var(--muted);
  font-size: 0.8rem;
}

.muted {
  color: var(--muted);
}
.small {
  font-size: 0.85rem;
}
.right {
  text-align: right;
}
.hidden {
  display: none !important;
}

label {
  display: block;
  margin: 0.7rem 0;
  font-size: 0.9rem;
  color: var(--muted);
}
label.inline-label {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin: 0;
}
label.checkbox {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
input,
button,
select {
  font: inherit;
}
input[type='text'],
input[type='password'],
input[name],
input:not([type]) {
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
}
input[type='checkbox'] {
  margin: 0;
}
input.tiny {
  width: 5.5rem;
  margin-top: 0;
}

button,
.button {
  display: inline-block;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
}
button:hover,
.button:hover {
  background: #22304a;
  text-decoration: none;
}
button.primary,
.button.primary {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: #fff;
}
button.danger {
  background: #7a2b2b;
  border-color: #914040;
  color: #ffdede;
}
button.link {
  background: none;
  border: none;
  color: var(--accent);
  padding: 0;
}
button.mini {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
}
form.inline {
  display: inline;
}
.row {
  display: flex;
  gap: 0.6rem;
  align-items: flex-end;
  flex-wrap: wrap;
}
.row.tight {
  gap: 0.4rem;
  align-items: center;
}
.alert {
  display: flex;
  gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  margin-bottom: 0.8rem;
  font-size: 0.9rem;
  border: 1px solid var(--line);
}
.alert .ico {
  font-weight: 700;
}
.alert.ok {
  background: rgba(63, 180, 122, 0.12);
  border-color: rgba(63, 180, 122, 0.4);
}
.alert.error {
  background: rgba(224, 96, 96, 0.12);
  border-color: rgba(224, 96, 96, 0.4);
}
.alert.warn {
  background: rgba(224, 168, 56, 0.12);
  border-color: rgba(224, 168, 56, 0.4);
}
.alert.info {
  background: rgba(79, 156, 249, 0.12);
  border-color: rgba(79, 156, 249, 0.4);
}

.bigcode {
  font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace;
  font-size: 2.4rem;
  letter-spacing: 0.15em;
  text-align: center;
  padding: 1rem;
  background: var(--panel-2);
  border-radius: var(--radius);
  margin: 1rem 0;
}
.bigcode.smallcode {
  font-size: 1rem;
  letter-spacing: 0.05em;
  word-break: break-all;
}
.inline-code {
  display: inline-block;
  font-size: 1.1rem;
  padding: 0.2rem 0.5rem;
}

.quota .bar {
  height: 10px;
  background: var(--panel-2);
  border-radius: 999px;
  overflow: hidden;
}
.quota .bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--ok));
}
.quota .qmeta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.4rem;
}

.crumbs {
  margin-bottom: 0.8rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.toolbar {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
label.upload {
  cursor: pointer;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.7rem;
}
.grid.small {
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
}
.tile {
  display: block;
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
}
.tile:hover {
  border-color: var(--accent);
  text-decoration: none;
}
.thumbwrap {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  background: #0e1729;
  overflow: hidden;
}
.thumbwrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.play {
  position: absolute;
  right: 6px;
  bottom: 6px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 50%;
  width: 26px;
  height: 26px;
  line-height: 26px;
  text-align: center;
  font-size: 0.75rem;
}
.fileicon {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}
.tname {
  display: block;
  padding: 0.4rem 0.5rem 0;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tmeta {
  display: block;
  padding: 0 0.5rem 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
}
.tag {
  display: inline-block;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 0.5rem;
  font-size: 0.7rem;
  color: var(--muted);
}
.thumbwrap .tag {
  position: absolute;
  left: 6px;
  top: 6px;
  background: rgba(0, 0, 0, 0.65);
}
.tag.warnsmall {
  color: var(--warn);
  border-color: rgba(224, 168, 56, 0.5);
}

.dirlist {
  margin-bottom: 0.8rem;
}
.dirrow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--line);
}
.dirname {
  font-weight: 500;
}

table.files {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
table.files th,
table.files td {
  text-align: left;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.shares {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.7rem;
}
.share {
  display: block;
  padding: 0.7rem 0.9rem;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
}
.share span {
  display: block;
}

.req {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
}

.kv {
  display: grid;
  grid-template-columns: 12rem 1fr;
  gap: 0.3rem 1rem;
  margin: 0 0 1rem;
  font-size: 0.9rem;
}
.kv dt {
  color: var(--muted);
}

.viewer {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(240px, 1fr);
  gap: 1rem;
  align-items: start;
}
.bigmedia {
  width: 100%;
  max-height: 74vh;
  background: #000;
  border-radius: var(--radius);
  object-fit: contain;
}
.notplayable {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.viewermeta h1 {
  font-size: 1.1rem;
  word-break: break-word;
}

.upload-row {
  margin-bottom: 0.6rem;
}
.upload-row .uname {
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.upload-row .bar {
  height: 8px;
  background: var(--panel-2);
  border-radius: 999px;
  overflow: hidden;
  margin: 0.25rem 0;
}
.upload-row .bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.2s;
}
.upload-row.ok .bar span {
  background: var(--ok);
}
.upload-row.bad .bar span {
  background: var(--bad);
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 15, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.lightbox img {
  max-width: 92vw;
  max-height: 88vh;
  object-fit: contain;
}
.lightbox button {
  position: absolute;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #fff;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 1.4rem;
  cursor: pointer;
}
.lbclose {
  top: 16px;
  right: 16px;
}
.lbprev {
  left: 16px;
  top: 50%;
}
.lbnext {
  right: 16px;
  top: 50%;
}
.lbname {
  position: absolute;
  bottom: 16px;
  color: #cbd5e1;
  font-size: 0.9rem;
}

.foot {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem 2rem;
  color: var(--muted);
  font-size: 0.8rem;
  max-width: 1100px;
  margin: 0 auto;
}

@media (max-width: 720px) {
  .viewer {
    grid-template-columns: 1fr;
  }
  .kv {
    grid-template-columns: 1fr;
  }
  .kv dt {
    margin-top: 0.4rem;
  }
  .nav {
    width: 100%;
    margin-left: 0;
  }
}
