/* ===== pixel-share theme ===== */
/* palette: #272D2D dark, #9FD8CB mint, #E08D79 coral */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323&display=swap');

:root {
  --bg:    #272D2D;
  --mint:  #9FD8CB;
  --coral: #E08D79;
  --ink:   #E6F0EC;
  --shadow: #0f1313;
  --panel: #1c2121;
  --panel-2: #313939;
  --border: #0a0d0d;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'VT323', ui-monospace, monospace;
  font-size: 20px;
  line-height: 1.35;
  min-height: 100vh;
  image-rendering: pixelated;
  -webkit-font-smoothing: none;
  font-smooth: never;
}

body {
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(159,216,203,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(159,216,203,0.04) 1px, transparent 1px);
  background-size: 16px 16px;
}

.scanlines {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0) 0px,
    rgba(0,0,0,0) 2px,
    rgba(0,0,0,0.10) 3px,
    rgba(0,0,0,0) 4px
  );
  mix-blend-mode: multiply;
}

a { color: var(--mint); text-decoration: none; }
a:hover { color: var(--coral); }

h1, h2, h3, .title, .logo, .btn, .chip, .nav button, .field span {
  font-family: 'Press Start 2P', 'VT323', monospace;
  letter-spacing: 0.5px;
}

h1, .title { font-size: 14px; line-height: 1.6; margin: 0 0 16px; color: var(--mint); }
h2 { font-size: 12px; line-height: 1.6; margin: 24px 0 12px; color: var(--coral); }

/* ===== layout ===== */
.container { max-width: 1100px; margin: 0 auto; padding: 24px; }

.pub-header, .app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--panel);
  border-bottom: 4px solid var(--border);
  box-shadow: 0 4px 0 rgba(0,0,0,0.3);
}

.logo {
  font-size: 16px;
  color: var(--mint);
  text-shadow: 2px 2px 0 var(--shadow);
}
.logo:hover { color: var(--coral); }

.pub-footer {
  text-align: center;
  padding: 24px;
  font-size: 14px;
  color: rgba(230,240,236,0.4);
}

/* ===== panel / card ===== */
.card, .panel {
  background: var(--panel);
  border: 4px solid var(--border);
  box-shadow: 6px 6px 0 var(--shadow);
  padding: 20px;
  margin: 16px 0;
  position: relative;
}

.card::before, .panel::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 1px solid rgba(159,216,203,0.10);
}

/* ===== forms ===== */
.field {
  display: flex;
  flex-direction: column;
  margin: 12px 0;
  gap: 6px;
}
.field span { font-size: 9px; color: var(--mint); text-transform: uppercase; }

input[type="text"],
input[type="password"],
input[type="number"],
input[type="file"],
select {
  font-family: 'VT323', monospace;
  font-size: 18px;
  padding: 10px 12px;
  background-color: #0f1313;
  color: var(--ink);
  border: 3px solid var(--mint);
  outline: none;
  box-shadow: inset 2px 2px 0 rgba(0,0,0,0.5);
}
input:focus, select:focus { border-color: var(--coral); }

/* ===== buttons ===== */
.btn, button.btn {
  display: inline-block;
  font-size: 10px;
  padding: 12px 16px;
  background: var(--mint);
  color: var(--bg);
  border: 3px solid var(--border);
  box-shadow: 4px 4px 0 var(--shadow);
  cursor: pointer;
  text-transform: uppercase;
  transition: transform 50ms steps(2), box-shadow 50ms steps(2);
  margin: 6px 6px 6px 0;
  user-select: none;
}
.btn:hover { color: var(--bg); background: #b9e8dd; }
.btn:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--shadow);
}
.btn-coral { background: var(--coral); color: #2a1410; }
.btn-coral:hover { background: #ec9f8c; }
.btn-dark { background: var(--panel-2); color: var(--ink); }
.btn-ghost {
  background: transparent;
  color: var(--mint);
  border-color: var(--mint);
  box-shadow: 4px 4px 0 var(--shadow);
}

/* ===== chips ===== */
.chip {
  display: inline-block;
  font-size: 8px;
  padding: 6px 8px;
  background: var(--panel-2);
  color: var(--mint);
  border: 2px solid var(--border);
  margin: 2px 4px 2px 0;
  text-transform: uppercase;
}
.chip-coral { color: var(--coral); border-color: var(--coral); }
.chip-mint  { color: var(--mint);  border-color: var(--mint);  }

.meta { margin: 4px 0 16px; }

/* ===== dropzone ===== */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 3px dashed var(--mint);
  background: rgba(159,216,203,0.04);
  padding: 28px;
  margin: 16px 0;
  cursor: pointer;
  text-align: center;
}
.dropzone:hover, .dropzone.drag { border-color: var(--coral); background: rgba(224,141,121,0.08); }
.dropzone input[type="file"] { display: none; }
.dz-text { font-family: 'Press Start 2P', monospace; font-size: 10px; color: var(--mint); }
.dz-sub  { font-size: 16px; color: rgba(230,240,236,0.7); }

/* Static dropzone (no longer a click target — buttons handle picking) */
.dropzone-static { cursor: default; }

/* Picker buttons row */
.picker-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}
.picker-row .btn { flex: 1 1 auto; min-width: 140px; text-align: center; margin: 0; }

/* ===== preview area on share view ===== */
.preview {
  margin: 16px 0;
  background: #0f1313;
  border: 3px solid var(--border);
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
}
.preview img, .preview video {
  max-width: 100%;
  max-height: 60vh;
  display: block;
  image-rendering: auto;
}
.preview audio { width: 100%; }
.file-glyph { font-family: 'Press Start 2P', monospace; font-size: 22px; color: var(--coral); padding: 32px; }

/* ===== status / messages ===== */
.status { margin-top: 12px; font-size: 16px; min-height: 24px; }
.status .ok { color: var(--mint); }
.status .err { color: var(--coral); }

/* ===== dashboard layout ===== */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.app-header h1 { margin: 0; font-size: 12px; }
.tabs {
  display: flex;
  gap: 0;
  margin: 0;
  padding: 0 24px;
  background: var(--panel);
  border-bottom: 4px solid var(--border);
}
.tab {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  padding: 14px 16px;
  background: transparent;
  color: var(--ink);
  border: none;
  border-bottom: 4px solid transparent;
  cursor: pointer;
  text-transform: uppercase;
  margin-bottom: -4px;
}
.tab.active { color: var(--coral); border-bottom-color: var(--coral); }
.tab:hover { color: var(--mint); }

/* ===== tables / rows ===== */
.row-list { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  background: var(--panel-2);
  border: 3px solid var(--border);
  padding: 10px 14px;
}
.row .row-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.row .row-main .name { font-size: 18px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .row-main .sub  { font-size: 13px; color: rgba(230,240,236,0.6); display: flex; gap: 8px; flex-wrap: wrap; }
.row .row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* Image-row variant: thumbnail | content | actions */
.row.row-img { grid-template-columns: 84px 1fr auto; }
.thumb-link {
  display: block;
  width: 80px; height: 80px;
  background: #0f1313;
  border: 2px solid var(--border);
  overflow: hidden;
  cursor: zoom-in;
}
.thumb {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  image-rendering: auto;
  transition: transform 120ms steps(3);
}
.thumb-link:hover .thumb { transform: scale(1.08); }

/* Lightbox overlay */
.lightbox {
  position: fixed; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  background: rgba(0,0,0,0.92);
  z-index: 2000;
  padding: 20px;
  cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border: 4px solid var(--border);
  box-shadow: 8px 8px 0 var(--shadow);
  image-rendering: auto;
}
.lightbox-close {
  position: fixed;
  top: 16px; right: 16px;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  background: var(--coral);
  color: #2a1410;
  border: 3px solid var(--border);
  padding: 10px 14px;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--shadow);
}
.lightbox-caption {
  position: fixed;
  bottom: 16px; left: 0; right: 0;
  text-align: center;
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: var(--mint);
  text-shadow: 2px 2px 0 #000;
  pointer-events: none;
  padding: 0 20px;
  word-break: break-all;
}

@media (max-width: 720px) {
  .row.row-img { grid-template-columns: 64px 1fr; }
  .thumb-link { width: 64px; height: 64px; }
  .row.row-img .row-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

/* ===== Gallery (Google-Photos-style) ===== */
.gallery-root { position: relative; }

.gallery-sec-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  color: var(--coral);
  margin: 20px 0 8px;
  text-transform: uppercase;
}
.docs-section .file-glyph-inline {
  color: var(--coral);
  font-size: 18px;
  margin-right: 4px;
  font-family: 'Press Start 2P', monospace;
}

/* Sticky selection toolbar */
.gallery-toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: none;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border: 3px solid var(--coral);
  box-shadow: 4px 4px 0 var(--shadow);
  padding: 8px 12px;
  margin-bottom: 12px;
}
.gallery-toolbar.open { display: flex; }
.gallery-toolbar .gtb-cancel {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  background: var(--panel-2);
  color: var(--ink);
  border: 2px solid var(--border);
  padding: 6px 8px;
  cursor: pointer;
}
.gallery-toolbar .gtb-count {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: var(--mint);
}
.gallery-toolbar .gtb-spacer { flex: 1; }
.gallery-toolbar .btn { margin: 0; }

/* Grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.tile {
  position: relative;
  aspect-ratio: 1 / 1;
  background: #0f1313;
  border: 3px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}
.tile img, .tile video {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  image-rendering: auto;
  pointer-events: none;
}
.tile .play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--mint);
  text-shadow: 2px 2px 0 #000;
  pointer-events: none;
  background: linear-gradient(transparent 55%, rgba(0,0,0,0.55));
}
.tile .check {
  position: absolute;
  top: 6px; left: 6px;
  width: 24px; height: 24px;
  background: rgba(15,19,19,0.85);
  border: 2px solid var(--mint);
  display: none;
  align-items: center;
  justify-content: center;
  color: transparent;
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  pointer-events: none;
  box-shadow: 2px 2px 0 var(--shadow);
}
.gallery-root.selecting .tile .check { display: flex; }
.tile.selected {
  outline: 4px solid var(--mint);
  outline-offset: -3px;
}
.tile.selected .check { background: var(--mint); color: var(--bg); }

/* Lightbox extra: nav arrows + bottom action toolbar */
.lightbox .lb-content {
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox .lb-content img,
.lightbox .lb-content video {
  max-width: 95vw;
  max-height: calc(100vh - 160px);
  border: 4px solid var(--border);
  box-shadow: 8px 8px 0 var(--shadow);
  image-rendering: auto;
  background: #000;
}
.lb-prev, .lb-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 48px; height: 64px;
  background: var(--panel);
  border: 3px solid var(--border);
  color: var(--mint);
  font-family: 'Press Start 2P', monospace;
  font-size: 22px;
  cursor: pointer;
  z-index: 2;
  box-shadow: 4px 4px 0 var(--shadow);
}
.lb-prev:hover, .lb-next:hover { color: var(--coral); }
.lb-prev { left: 16px; }
.lb-next { right: 16px; }
.lb-actions {
  position: fixed;
  bottom: 16px;
  left: 0; right: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  z-index: 2;
}
.lb-actions .btn { margin: 0; }
.lightbox .lightbox-caption {
  bottom: 64px;
}

@media (max-width: 720px) {
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 4px; }
  .lb-prev, .lb-next { width: 36px; height: 48px; font-size: 16px; }
  .gallery-toolbar { padding: 6px 8px; gap: 6px; }
}

/* Inline link copy */
.linkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #0f1313;
  border: 2px solid var(--mint);
  padding: 4px 8px;
  font-size: 14px;
  color: var(--mint);
  word-break: break-all;
}
.linkbox input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--mint);
  font-family: 'VT323', monospace;
  font-size: 14px;
  padding: 2px 0;
  min-width: 100px;
}
.linkbox input:focus { outline: none; }

/* ===== modal-ish inline area ===== */
.section { display: none; }
.section.active { display: block; }

.empty {
  text-align: center;
  padding: 48px 16px;
  color: rgba(230,240,236,0.5);
  font-size: 16px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 720px) {
  .grid-2 { grid-template-columns: 1fr; }
  .row { grid-template-columns: 1fr; }
  .row .row-actions { justify-content: flex-start; }
}

/* ===== blinking caret ===== */
.caret::after {
  content: '_';
  animation: blink 1s steps(2, end) infinite;
  margin-left: 4px;
}
@keyframes blink { 50% { opacity: 0; } }

/* ===== utility ===== */
.muted { color: rgba(230,240,236,0.55); }
.right { text-align: right; }
.spacer { height: 16px; }
hr.div { border: none; border-top: 2px dashed rgba(159,216,203,0.25); margin: 18px 0; }

/* progress bar */
.progress {
  height: 14px;
  background: #0f1313;
  border: 2px solid var(--border);
  margin: 12px 0;
  overflow: hidden;
}
.progress > div {
  height: 100%;
  background: var(--mint);
  width: 0%;
  transition: width 100ms linear;
}
