:root {
  color-scheme: dark;
  --bg: #0b1020;
  --panel: #141b2d;
  --panel-border: #24304a;
  --text: #eef2ff;
  --muted: #9aa7c7;
  --accent: #6ea8fe;
  --accent-soft: rgba(110, 168, 254, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, sans-serif;
  background:
    radial-gradient(circle at top, rgba(110, 168, 254, 0.18), transparent 35%),
    linear-gradient(180deg, #0b1020 0%, #090d18 100%);
  color: var(--text);
}

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

.hero {
  margin-bottom: 2rem;
}

.eyebrow {
  margin: 0 0 0.5rem;
  color: var(--accent);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2.5rem, 6vw, 4rem);
  line-height: 1;
}

.subtitle,
.status {
  color: var(--muted);
}

.subtitle {
  margin: 0.75rem 0 0;
  font-size: 1.1rem;
}

.status {
  margin: 1rem 0 0;
  font-size: 0.95rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.25rem;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent), var(--panel);
  color: inherit;
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: linear-gradient(180deg, var(--accent-soft), transparent), var(--panel);
}

.card-label {
  color: var(--accent);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card strong {
  font-size: 1.2rem;
}

.card-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.card-meta-ts {
  opacity: 0;
  transition: opacity 0.15s ease;
}

.card:hover .card-meta-ts {
  opacity: 1;
}

.home-page .project-grid {
  max-width: 760px;
}

.project-card strong {
  font-size: 1.35rem;
}

.login-body {
  margin: 0;
  min-height: 100vh;
}

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  padding: 2rem 1rem;
  box-sizing: border-box;
}

.login-shell {
  position: relative;
  width: min(420px, 100%);
  padding-top: 4rem;
}

.login-mascot {
  position: absolute;
  top: 0;
  left: 4px;
  z-index: 2;
  pointer-events: none;
  transform: translateY(-79%);
}

.login-mascot img {
  display: block;
  width: 118px;
  height: auto;
  opacity: 1;
  filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.35));
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 2rem;
  padding-top: 2rem;
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent), var(--panel);
  overflow: visible;
}

.login-card h1 {
  font-size: 2rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 1.5rem;
  width: 100%;
}

.login-form .field {
  display: block;
  width: 100%;
}

.login-form label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.login-form input {
  display: block;
  width: 100%;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font: inherit;
  box-sizing: border-box;
}

.login-form input:focus {
  outline: 2px solid rgba(110, 168, 254, 0.35);
  border-color: var(--accent);
}

.login-form .button {
  width: 100%;
  margin-top: 0.25rem;
}

.button {
  padding: 0.85rem 1rem;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #08111f;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.button:hover {
  filter: brightness(1.05);
}

.button-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--panel-border);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  filter: none;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1rem;
}

.logout-form {
  margin-top: 0;
}

a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.upload-panel {
  padding: 1.5rem;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent), var(--panel);
}

.upload-panel .status {
  margin-top: 0.85rem;
}

.upload-method-help {
  margin: 0.25rem 0 1.25rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.upload-method-help p {
  margin: 0 0 0.65rem;
  color: var(--text);
}

.upload-method-help ul {
  margin: 0;
  padding-left: 1.2rem;
}

.upload-method-help li + li {
  margin-top: 0.35rem;
}

.upload-method-help code {
  font-size: 0.88em;
  word-break: break-all;
}

.upload-panel .button:not(.button-secondary) {
  background: linear-gradient(180deg, #b8f0eb 0%, #7dd9d2 45%, #5cbdb6 100%);
  color: #0a2e2b;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.45) inset,
    0 -2px 0 rgba(0, 0, 0, 0.1) inset,
    0 5px 0 #3d9d96,
    0 7px 10px rgba(0, 0, 0, 0.3);
  transform: translateY(0);
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    filter 0.12s ease;
}

.upload-panel .button:not(.button-secondary):hover:not(:disabled) {
  filter: brightness(1.04);
  transform: translateY(-1px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.45) inset,
    0 -2px 0 rgba(0, 0, 0, 0.1) inset,
    0 6px 0 #3d9d96,
    0 9px 14px rgba(0, 0, 0, 0.32);
}

.upload-panel .button:not(.button-secondary):active:not(:disabled) {
  transform: translateY(3px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.25) inset,
    0 2px 0 rgba(0, 0, 0, 0.12) inset,
    0 2px 0 #3d9d96,
    0 3px 5px rgba(0, 0, 0, 0.25);
}

.upload-panel .progress-fill {
  background: #5cbdb6;
}

.file-list {
  list-style: none;
  margin: 1rem 0 1.25rem;
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  overflow: hidden;
}

.file-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--panel-border);
}

.file-list-item:first-child {
  border-top: 0;
}

.file-list-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-list-meta {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.progress-wrap {
  margin-top: 1rem;
}

.progress-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--panel-border);
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.2s ease;
}

.success {
  margin: 1rem 0 0;
  color: #8ee0b0;
  font-size: 0.95rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.error {
  margin: 0;
  color: #ff8e8e;
  font-size: 0.95rem;
}

.wtf-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  margin: 0;
  padding: 2rem;
}

.wtf-button {
  display: inline-block;
  padding: 1rem 1.75rem;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, #8bbcff 0%, #6ea8fe 45%, #4d8fe8 100%);
  color: #08111f;
  font: inherit;
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.35) inset,
    0 -2px 0 rgba(0, 0, 0, 0.12) inset,
    0 6px 0 #3a6fbf,
    0 8px 12px rgba(0, 0, 0, 0.35);
  transform: translateY(0);
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    filter 0.12s ease;
}

.wtf-button:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.35) inset,
    0 -2px 0 rgba(0, 0, 0, 0.12) inset,
    0 7px 0 #3a6fbf,
    0 10px 16px rgba(0, 0, 0, 0.38);
}

.wtf-button:active {
  transform: translateY(4px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.2) inset,
    0 2px 0 rgba(0, 0, 0, 0.15) inset,
    0 2px 0 #3a6fbf,
    0 3px 6px rgba(0, 0, 0, 0.3);
}

.section-title {
  margin: 0 0 1rem;
  font-size: 1.35rem;
}

.products-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 1.5rem;
  align-items: start;
}

.products-section,
.cart-panel,
.admin-panel {
  min-width: 0;
}

.product-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.product-card {
  text-decoration: none;
}

.product-card:hover {
  transform: translateY(-2px);
}

.product-add-btn {
  margin-top: 0.75rem;
  width: 100%;
}

.cart-panel {
  position: sticky;
  top: 1rem;
  padding: 1.25rem;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent), var(--panel);
}

.cart-list,
.admin-product-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cart-item,
.admin-product-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--panel-border);
}

.cart-item:first-child,
.admin-product-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.cart-item-info,
.admin-product-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.cart-item-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.cart-qty-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.qty-btn {
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font: inherit;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.qty-btn:hover {
  border-color: var(--accent);
}

.cart-qty {
  min-width: 1.5rem;
  text-align: center;
  font-weight: 600;
}

.cart-footer {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--panel-border);
}

.cart-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 1rem;
  font-size: 1.1rem;
}

.cart-total strong {
  font-size: 1.35rem;
  color: var(--accent);
}

.cart-note {
  margin-top: 0.75rem;
  font-size: 0.85rem;
}

.admin-panel {
  margin-top: 2rem;
}

.admin-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.admin-form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.field label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.field input,
.field textarea {
  display: block;
  width: 100%;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font: inherit;
  box-sizing: border-box;
}

.field input:focus,
.field textarea:focus {
  outline: 2px solid rgba(110, 168, 254, 0.35);
  border-color: var(--accent);
}

.field textarea {
  resize: vertical;
  min-height: 5rem;
}

.admin-subtitle {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
}

.admin-remove-btn {
  flex-shrink: 0;
}

.product-media-grid,
.media-grid {
  display: grid;
  gap: 0.75rem;
}

.product-media-grid {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-height: 220px;
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.product-card .product-media-item {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 220px;
  object-fit: contain;
  object-position: center;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.03);
}

.media-grid {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.media-tile {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.media-tile .product-media-item {
  max-height: 140px;
}

.media-remove-btn {
  width: 100%;
}

.admin-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.admin-product-item {
  align-items: flex-start;
}

.admin-product-preview {
  flex-shrink: 0;
  width: 72px;
}

.admin-product-preview .product-media-item {
  width: 72px;
  height: 72px;
  max-height: 72px;
  object-fit: cover;
}

.admin-product-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  flex-shrink: 0;
}

.admin-action-btn,
.admin-delete-btn {
  min-width: 5.5rem;
}

.admin-delete-btn:hover {
  border-color: #ff8e8e;
  color: #ff8e8e;
}

.field input[type="file"] {
  padding: 0.65rem 0.75rem;
}

.field select {
  display: block;
  width: 100%;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font: inherit;
  box-sizing: border-box;
}

.field select:focus {
  outline: 2px solid rgba(110, 168, 254, 0.35);
  border-color: var(--accent);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(4, 8, 18, 0.72);
  backdrop-filter: blur(6px);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  width: min(520px, 100%);
  padding: 1.5rem;
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent), var(--panel);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.modal-copy {
  margin: 0 0 1.25rem;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.share-link-result {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.share-link-result label {
  color: var(--muted);
  font-size: 0.95rem;
}

.share-link-row {
  display: flex;
  gap: 0.75rem;
}

.share-link-row input {
  flex: 1;
  min-width: 0;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font: inherit;
}

.share-link-row input:focus {
  outline: 2px solid rgba(110, 168, 254, 0.35);
  border-color: var(--accent);
}

.expire-link-btn {
  align-self: flex-start;
}

.expire-link-btn:hover:not(:disabled) {
  border-color: #ff8e8e;
  color: #ff8e8e;
}

@media (max-width: 860px) {
  .products-layout {
    grid-template-columns: 1fr;
  }

  .cart-panel {
    position: static;
  }
}
