:root {
  --ink: #1c2430;
  --muted: #5c6b7a;
  --line: #d5dde6;
  --paper: #f7f4ef;
  --panel: #ffffff;
  --accent: #0b6e4f;
  --accent-soft: #e4f3ec;
  --audio: #1f4b99;
  --video: #9a3412;
  --shadow: 0 10px 30px rgba(28, 36, 48, 0.12);
  --dock-h: auto;
  --font: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(11, 110, 79, 0.08), transparent 40%),
    linear-gradient(180deg, #efe8dc 0%, var(--paper) 35%, #eef2f5 100%);
}

.page {
  width: min(960px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 10rem;
}

.top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1.5rem;
}

.eyebrow {
  margin: 0 0 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--accent);
  font-family: var(--mono);
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.hint {
  margin: 0;
  color: var(--muted);
  max-width: 16rem;
  text-align: right;
  font-size: 0.95rem;
  line-height: 1.35;
}

.top-actions {
  display: flex;
  flex-direction: column;
  align-items: end;
  gap: 0.65rem;
}

.logout-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
}

.logout-btn:hover {
  color: var(--ink);
  border-color: #b7c2cd;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 2rem 1.6rem 1.6rem;
}

.login-card h1 {
  margin-bottom: 0.4rem;
}

.login-lead {
  margin: 0 0 1.4rem;
  color: var(--muted);
  line-height: 1.4;
}

.login-form {
  display: grid;
  gap: 0.9rem;
}

.field {
  display: grid;
  gap: 0.4rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.field input {
  appearance: none;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.85rem 0.9rem;
  font: inherit;
  font-size: 1rem;
  text-transform: none;
  letter-spacing: normal;
  color: var(--ink);
  background: #fbfcfd;
}

.field input:focus {
  outline: 2px solid rgba(11, 110, 79, 0.35);
  outline-offset: 1px;
  border-color: var(--accent);
}

.login-error {
  margin: 0;
  color: #9a3412;
  font-size: 0.92rem;
}

.login-submit {
  appearance: none;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.85rem 1rem;
  cursor: pointer;
}

.login-submit:hover {
  background: #095c42;
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-family: var(--mono);
  font-size: 0.85rem;
}

.crumbs a {
  color: var(--accent);
  text-decoration: none;
}

.crumbs a:hover {
  text-decoration: underline;
}

.crumbs .sep {
  color: #9aa8b5;
}

.crumbs .current {
  color: var(--ink);
  font-weight: 600;
}

.listing {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.listing-head,
.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 5.5rem 5.5rem;
  gap: 0.75rem;
  align-items: center;
  padding: 0.85rem 1rem;
  width: 100%;
}

.listing-head {
  background: #f3f6f8;
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.row {
  appearance: none;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.row:first-of-type {
  border-top: 0;
}

a.row:hover,
button.row:hover {
  background: #f8fafb;
}

.row.media[data-kind="audio"]:hover {
  background: #eef3fb;
}

.row.media[data-kind="video"]:hover {
  background: #fbf1ec;
}

.row.active {
  background: var(--accent-soft);
}

.name {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon {
  display: inline-grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 7px;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  flex: 0 0 auto;
}

.dir .icon,
.up .icon {
  background: #e8eef3;
  color: #3d5366;
}

.media[data-kind="audio"] .icon {
  background: #e5eefc;
  color: var(--audio);
}

.media[data-kind="video"] .icon {
  background: #fce8df;
  color: var(--video);
}

.type,
.size {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
}

.size {
  text-align: right;
}

.empty {
  margin: 0;
  padding: 2rem 1rem;
  color: var(--muted);
  text-align: center;
}

.player-dock {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  width: min(960px, calc(100% - 1.5rem));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem 1rem;
  align-items: center;
  padding: 0.9rem 1rem 1rem;
  background: rgba(28, 36, 48, 0.96);
  color: #f5f7fa;
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(16, 24, 32, 0.28);
  backdrop-filter: blur(8px);
  z-index: 20;
}

.player-dock[hidden] {
  display: none !important;
}

.player-dock.mode-audio {
  grid-template-areas:
    "meta close"
    "audio audio";
}

.player-dock.mode-video {
  grid-template-areas:
    "meta close"
    "video video";
}

.player-meta {
  grid-area: meta;
  min-width: 0;
}

.now-label {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #9db0c2;
}

.now-title {
  margin: 0.15rem 0 0;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#audio-player,
#video-player {
  width: 100%;
  display: none;
}

.player-dock.mode-audio #audio-player {
  display: block;
  grid-area: audio;
}

.player-dock.mode-video #video-player {
  display: block;
  grid-area: video;
  max-height: min(50vh, 360px);
  background: #000;
  border-radius: 10px;
}

.close-player {
  grid-area: close;
  justify-self: end;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.close-player:hover {
  background: rgba(255, 255, 255, 0.22);
}

@media (max-width: 640px) {
  .top {
    flex-direction: column;
    align-items: start;
  }

  .top-actions {
    align-items: start;
  }

  .hint {
    text-align: left;
    max-width: none;
  }

  .listing-head,
  .row {
    grid-template-columns: minmax(0, 1fr) 4.2rem;
  }

  .listing-head span:nth-child(2),
  .row .type {
    display: none;
  }
}
