@font-face {
  font-family: 'DreamLife';
  src: url('DreamLife-V1.0.0_by_MaxiGamer.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: 'W95';
  src: url('w95font-bold.woff') format('woff');
  font-weight: normal;
  font-style: normal;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'W95', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0f0f0f;
  color: #d8dae8;
  min-height: 100vh;
}

/* ── Header ── */
.header {
  background: #1a1c24;
  border-bottom: 1px solid #282c3a;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  font-family: 'DreamLife', sans-serif;
  font-size: 1.3rem;
  font-weight: normal;
  color: #a899e0;
  text-decoration: none;
}

.bl { display: inline; position: relative; transition: top 0.08s linear, left 0.08s linear; }


.nav {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav a, .nav button {
  color: #8890a8;
  text-decoration: none;
  font-size: 0.9rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.nav a:hover, .nav button:hover { color: #a899e0; }

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

/* ── Controls ── */
.controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px 0;
  border-bottom: 1px solid #282c3a;
  margin-bottom: 24px;
}

.controls-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.controls-row .search-input {
  margin-left: auto;
}

@media (max-width: 600px) {
  .controls-row .search-input {
    margin-left: 0;
    width: 100%;
  }
}

.controls-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.controls-label {
  font-size: 0.8rem;
  color: #7a7d9a;
  margin-right: 4px;
}

.filter-btn, .sort-btn {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid #282c3a;
  background: #1e2029;
  color: #666880;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.12s;
  font-family: inherit;
}

.filter-btn.active, .sort-btn.active {
  background: #a899e0;
  border-color: #a899e0;
  color: #13141a;
}

.filter-btn:hover:not(.active), .sort-btn:hover:not(.active) {
  border-color: #a899e0;
  color: #a899e0;
}

/* ── Search ── */
.search-input {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid #282c3a;
  background: #1a1c24;
  color: #d8dae8;
  font-size: 0.82rem;
  font-family: inherit;
  width: 200px;
}

.search-input:focus {
  outline: none;
  border-color: #a899e0;
}

.search-input::placeholder { color: #7a7d9a; }

/* ── Grid ── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  padding-bottom: 48px;
}

/* ── Card ── */
.card {
  background: #1a1c24;
  border: 1px solid #282c3a;
  border-radius: 12px;
  overflow: hidden;
}

.card-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  display: block;
  background: #22252f;
  image-rendering: pixelated;
}

.card-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #d8dae8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: #7a7d9a;
}

.card-uploader {
  color: #a899e0;
  text-decoration: none;
}

.card-uploader:hover { text-decoration: underline; }

/* ── Badge ── */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 500;
  background: rgba(168, 153, 224, 0.15);
  color: #a899e0;
}

/* ── Buttons ── */
.btn {
  display: inline-block;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 0.88rem;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: opacity 0.12s;
  text-align: center;
  text-decoration: none;
}

.btn:hover { opacity: 0.85; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn:focus-visible,
.filter-btn:focus-visible,
.sort-btn:focus-visible,
.tab-btn:focus-visible,
.nav a:focus-visible,
.nav button:focus-visible {
  outline: 2px solid #a899e0;
  outline-offset: 2px;
}

.btn-primary   { background: #a899e0; color: #13141a; }
.btn-secondary { background: transparent; color: #a899e0; border: 1px solid #a899e0; }
.btn-danger    { background: #9e4a5a; color: #fff; }
.btn-sm        { padding: 5px 12px; font-size: 0.8rem; }
.btn-full      { width: 100%; }

/* ── Forms ── */
.form-page {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 24px;
}

.form-card {
  background: #1a1c24;
  border: 1px solid #282c3a;
  border-radius: 12px;
  padding: 32px;
  width: 100%;
  max-width: 420px;
}

.form-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: #d8dae8;
  margin-bottom: 24px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-label {
  font-size: 0.83rem;
  font-weight: 500;
  color: #9092a8;
}

.form-input, .form-select, textarea.form-input {
  padding: 10px 14px;
  border: 1px solid #282c3a;
  border-radius: 8px;
  font-size: 0.92rem;
  font-family: inherit;
  color: #d8dae8;
  background: #0f0f0f;
  width: 100%;
}

textarea.form-input { resize: vertical; min-height: 80px; }

.input-wrap { position: relative; }
.input-wrap .form-input { padding-right: 52px; }
.show-pw {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #7a7d9a;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: inherit;
  padding: 0;
}
.show-pw:hover { color: #a899e0; }

.form-input:focus, .form-select:focus {
  outline: none;
  border-color: #a899e0;
}

/* ── Messages ── */
.msg {
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 0.88rem;
  margin-bottom: 16px;
  display: none;
}

.msg-error   { background: rgba(158, 74, 90, 0.2); color: #e08090; border: 1px solid #6e3040; }
.msg-success { background: rgba(80, 160, 120, 0.15); color: #6bbf99; border: 1px solid #2e5e44; }
.msg.show { display: block; }

/* ── Tabs ── */
.tabs {
  display: flex;
  border-bottom: 1px solid #282c3a;
  margin-bottom: 24px;
}

.tab-btn {
  padding: 10px 20px;
  cursor: pointer;
  font-size: 0.92rem;
  color: #666880;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  font-family: inherit;
  transition: color 0.12s;
}

.tab-btn.active { color: #a899e0; border-bottom-color: #a899e0; }

/* ── Upload area ── */
.upload-area {
  border: 2px dashed #282c3a;
  border-radius: 12px;
  padding: 28px;
  text-align: center;
  cursor: pointer;
  background: #0f0f0f;
  transition: border-color 0.12s;
}

.upload-area:hover:not(.upload-locked) { border-color: #a899e0; }

.upload-locked {
  opacity: 0.45;
  cursor: not-allowed;
}

.upload-area p { color: #7a7d9a; font-size: 0.88rem; }

.upload-preview {
  width: 128px;
  height: 128px;
  object-fit: contain;
  border-radius: 8px;
  margin: 0 auto 12px;
  display: block;
  image-rendering: pixelated;
}

/* ── Profile ── */
.profile-header {
  padding: 32px 0 20px;
  border-bottom: 1px solid #282c3a;
  margin-bottom: 24px;
}

.profile-username {
  font-size: 1.4rem;
  font-weight: 600;
  color: #d8dae8;
}

.profile-joined {
  color: #7a7d9a;
  font-size: 0.82rem;
  margin-top: 4px;
}

/* ── Dimension hint ── */
.dimension-hint {
  font-size: 0.82rem;
  color: #7a7d9a;
  margin-bottom: 6px;
}

/* ── Loading state ── */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 60px 0;
  color: #7a7d9a;
  font-size: 0.92rem;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #282c3a;
  border-top-color: #a899e0;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty state ── */
.empty {
  text-align: center;
  padding: 60px 0;
  color: #7a7d9a;
  font-size: 0.95rem;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: #1a1c24;
  border: 1px solid #282c3a;
  border-radius: 12px;
  padding: 28px;
  max-width: 380px;
  width: calc(100% - 48px);
  transform: scale(0.95);
  transition: transform 0.15s;
}

.modal-overlay.show .modal { transform: scale(1); }

.modal-msg {
  color: #d8dae8;
  font-size: 0.92rem;
  line-height: 1.5;
  margin-bottom: 22px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1a1c24;
  border: 1px solid #282c3a;
  color: #d8dae8;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 999;
  white-space: nowrap;
}

.toast.toast-error { border-color: #6e3040; color: #e08090; }
.toast.toast-success { border-color: #2e5e44; color: #6bbf99; }

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
