* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  min-height: 100vh;
  background-color: #123f4d;
  font-family: "Ubuntu", "Segoe UI", system-ui, sans-serif;
  color: #eef3f4;
  overflow-x: hidden;
}
.bg {
  position: fixed;
  inset: 0;
  background-size: cover;
  background-position: center;
  z-index: -1;
}

/* ---- login ---- */
.login-card {
  position: fixed;
  top: 44px;
  right: 44px;
  width: 300px;
  animation: card-in .45s cubic-bezier(.2, .9, .3, 1) both;
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(-14px) scale(.98); }
}
.pw-field {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 4px 4px 16px;
  border-radius: 14px;
  background: rgba(14, 18, 24, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.pw-field:focus-within {
  background: rgba(14, 18, 24, 0.6);
  border-color: rgba(120, 180, 255, 0.8);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35),
              0 0 0 4px rgba(90, 150, 255, 0.20);
}
.pw-field input {
  flex: 1;
  min-width: 0;
  padding: 11px 0;
  border: none;
  background: none;
  color: #eef3f4;
  font-size: 15.5px;
  letter-spacing: .6px;
  outline: none;
}
.pw-field input::placeholder { color: rgba(233, 240, 244, 0.5); letter-spacing: normal; }

#pw-toggle, .pw-go {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  border: none;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease, color .15s ease;
}
#pw-toggle svg, .pw-go svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#pw-toggle {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: none;
  color: rgba(233, 240, 244, 0.55);
}
#pw-toggle:hover { background: rgba(255, 255, 255, 0.10); color: #eef3f4; }
#pw-toggle.on { color: #7fb2ff; }
.pw-go {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #4d94ff, #2563c9);
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 201, 0.45);
}
.pw-go:hover { transform: scale(1.06); }
.pw-go:active { transform: scale(0.97); }

.login-error {
  margin-top: 10px;
  font-size: 13px;
  color: #ff9aa9;
  text-align: center;
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.6);
}
.shake { animation: card-in .45s cubic-bezier(.2,.9,.3,1) both, shake .4s .05s; }
@keyframes shake {
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(2px); }
}

/* ---- left dock: full-height Ubuntu-style rail ---- */
.dock {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 18px 0;
  width: 72px;
  overflow-y: auto;
  scrollbar-width: none;
  background: rgba(12, 15, 20, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 2px 0 24px rgba(0, 0, 0, 0.35);
  z-index: 10;
}
.dock::-webkit-scrollbar { display: none; }
.dock-item {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.dock-item img {
  width: 46px;
  height: 46px;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.4));
}
.dock-item:hover { transform: scale(1.12); }
.dock-item.active { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.55); }
/* Not-yet-built entries look the same as live ones; only the tooltip differs. */
.dock-spacer { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, 0.18); width: 36px; padding-top: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- layout ---- */
main {
  padding: 110px 40px 64px 116px;
  max-width: 1980px;
  margin: 0 auto;
}

/* ---- filter pill ---- */
.filter-pill {
  position: fixed;
  top: 26px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 22px;
  border-radius: 20px;
  background: rgba(16, 20, 26, 0.65);
  backdrop-filter: blur(10px);
  font-size: 16px;
  letter-spacing: 1px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  z-index: 20;
}

/* ---- 5-wide grid of bare screenshots ---- */
.grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 18px;
}
.tile {
  display: block;
  text-decoration: none;
  color: inherit;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.40);
  transition: transform .16s ease, box-shadow .16s ease;
}
.tile:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55);
}
.tile.hidden { display: none; }
.thumb {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top;
  background: #10141a;
}
.fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 10;
  font-size: 44px;
  font-weight: 600;
  color: #fff;
}

/* ---- edit mode ---- */
.tile { position: relative; }
.tile-tools {
  display: none;
  position: absolute;
  top: 6px;
  right: 6px;
  gap: 6px;
  opacity: 0;
  pointer-events: none;
  /* fade out 1.5s after the cursor leaves the tile */
  transition: opacity .25s ease 1.5s;
}
.editing .tile-tools { display: flex; }
.editing .tile:hover .tile-tools {
  opacity: 1;
  pointer-events: auto;
  transition-delay: 0s;
}
.tool {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 9px;
  background: rgba(12, 15, 20, 0.75);
  color: #fff;
  cursor: pointer;
}
.tool svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.tool:hover { background: rgba(12, 15, 20, 0.95); }
.no-cap {
  display: none;
  position: absolute;
  bottom: 6px;
  left: 6px;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: rgba(12, 15, 20, 0.75);
  color: #e8b04b;
}
.editing .no-cap { display: flex; }
.no-cap svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.editing .tile { cursor: grab; }
.tile.dragging { opacity: 0.4; }
.tile.awaiting-paste::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(12, 15, 20, 0.65);
  border: 2px dashed rgba(255, 255, 255, 0.6);
  border-radius: 14px;
}
.tile.awaiting-paste::after {
  content: "Ctrl+V to paste screenshot";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 500;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}
.tile.busy::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(12, 15, 20, 0.5);
}
.tile.busy::after {
  content: "";
  position: absolute;
  top: calc(50% - 17px);
  left: calc(50% - 17px);
  width: 34px;
  height: 34px;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21 12a9 9 0 1 1-2.64-6.36" fill="none" stroke="white" stroke-width="2.4" stroke-linecap="round"/></svg>') center / contain no-repeat;
  animation: spin 1s linear infinite;
}
.add-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 10;
  border: 2px dashed rgba(255, 255, 255, 0.5);
  border-radius: 14px;
  background: rgba(12, 15, 20, 0.30);
  color: rgba(255, 255, 255, 0.8);
  font-size: 52px;
  font-weight: 300;
  cursor: pointer;
  box-shadow: none;
}
.add-tile:hover { background: rgba(12, 15, 20, 0.5); transform: none; }

/* ---- edit dialog ---- */
dialog {
  margin: auto;
  border: none;
  border-radius: 16px;
  padding: 24px 28px;
  min-width: 380px;
  background: rgba(18, 22, 28, 0.92);
  backdrop-filter: blur(16px);
  color: #eef3f4;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
dialog h3 { margin-bottom: 16px; font-weight: 500; }
dialog label { display: block; margin-bottom: 12px; font-size: 14px; color: #b9c4cb; }
dialog input[type="text"], dialog input[type="url"], dialog input:not([type]) {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 12px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.07);
  color: #eef3f4;
  font-size: 15px;
  outline: none;
}
dialog input:focus { border-color: #3d8bfd; }
dialog input[type="file"] {
  display: block;
  width: 100%;
  margin-top: 6px;
  font-size: 13px;
  color: #b9c4cb;
}
dialog input[type="file"]::file-selector-button {
  padding: 6px 14px;
  margin-right: 10px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #eef3f4;
  cursor: pointer;
}
dialog .check { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
.dialog-buttons { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.dialog-buttons button {
  padding: 8px 18px;
  border: none;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.12);
  color: #eef3f4;
  font-size: 14px;
  cursor: pointer;
}
.dialog-buttons button.primary { background: #2563c9; }
.dialog-buttons button:hover { filter: brightness(1.15); }

@media (max-width: 1100px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px)  { .grid { grid-template-columns: repeat(2, 1fr); } }
