:root {
  --black: #000;
  --ink: #111;
  --white: #fff;
  --paper: #f1f1f1;
  --gold: #c6a75e;
  --bronze: #6c5c38;
  --panel: #171717;
  --line: #2a2a2a;
  --muted: #aaa;
  --danger: #d66;
  --success: #7fb77e;
}

* {
  box-sizing: border-box;
}

html {
  background: #000;
  color: #fff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 85% 0, #282113 0, transparent 30%),
    linear-gradient(135deg, #000, #111 60%, #080808);
}

a {
  color: var(--gold);
  text-decoration: none;
}

.topbar {
  height: 76px;
  padding: 14px clamp(18px, 4vw, 60px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #252525;
  background: rgba(0, 0, 0, 0.88);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
}

.brand img {
  width: 210px;
  max-height: 48px;
  object-fit: contain;
  object-position: left center;
}

.topnav {
  display: flex;
  gap: 22px;
  align-items: center;
}

.topnav a {
  color: #f1f1f1;
  font-size: 14px;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 38px auto 70px;
}

.footer {
  text-align: center;
  color: #999;
  border-top: 1px solid #222;
  padding: 24px;
}

.flash {
  width: min(900px, calc(100% - 32px));
  margin: 16px auto 0;
  padding: 13px 16px;
  border-radius: 10px;
}

.flash.error {
  background: #3b1717;
  color: #ffdede;
}

.flash.success {
  background: #173b21;
  color: #dcffe5;
}

.card,
.panel {
  background: linear-gradient(
    180deg,
    rgba(27, 27, 27, 0.97),
    rgba(14, 14, 14, 0.97)
  );
  border: 1px solid #2c2c2c;
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.auth-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  min-height: 620px;
  overflow: hidden;
}

.hero {
  padding: 70px 55px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0.35)),
    url("../images/guitar-bg.jpg");
  background-size: cover;
  background-position: center;
}

.hero-logo {
  width: 255px;
}

.hero h1 {
  font-size: clamp(42px, 6vw, 72px);
  line-height: 1.02;
  margin: 85px 0 20px;
}

.gold {
  color: var(--gold);
}

.hero p {
  font-size: 19px;
  color: #d7d7d7;
  max-width: 480px;
}

.auth-panel {
  padding: 60px 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-panel h2,
.page-head h1 {
  font-size: 34px;
  margin: 0 0 8px;
}

.muted {
  color: var(--muted);
}

label {
  display: block;
  font-size: 13px;
  color: #ddd;
  margin: 16px 0 7px;
}

input,
select,
textarea {
  width: 100%;
  background: #101010;
  border: 1px solid #343434;
  color: #fff;
  border-radius: 9px;
  padding: 13px 14px;
  font: inherit;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(198, 167, 94, 0.45);
  border-color: var(--gold);
}

.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 9px;
  padding: 13px 18px;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, #d9bb6b, #b69343);
  color: #090909;
}

.btn.secondary {
  background: #1c1c1c;
  color: #fff;
  border: 1px solid #3a3a3a;
}

.btn.danger {
  background: #4a1d1d;
  color: #fff;
}

.btn.small {
  padding: 8px 11px;
  font-size: 13px;
}

.btn.full {
  width: 100%;
  margin-top: 22px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-help {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 13px;
}

.divider {
  text-align: center;
  color: #888;
  margin: 25px 0;
  position: relative;
}

.divider::before,
.divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 42%;
  height: 1px;
  background: #333;
}

.divider::before {
  left: 0;
}

.divider::after {
  right: 0;
}

.scan-note {
  padding: 16px;
  border: 1px solid #333;
  background: #181818;
  border-radius: 10px;
  text-align: center;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 24px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat {
  padding: 20px;
}

.stat strong {
  font-size: 34px;
  color: var(--gold);
  display: block;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.guitar-card {
  overflow: hidden;
}

.guitar-card > img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center;
  background: #111;
}

.guitar-card .body {
  padding: 15px;
}

.guitar-card h3 {
  margin: 0 0 3px;
}

.meta {
  font-size: 13px;
  color: #bbb;
  display: grid;
  gap: 6px;
  margin: 14px 0;
}

.meta span {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid #262626;
  padding-bottom: 5px;
}

.panel {
  padding: 24px;
  margin-bottom: 22px;
}

.dashboard-lower {
  display: grid;
  grid-template-columns: 1.4fr 0.6fr;
  gap: 20px;
  margin-top: 22px;
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid #292929;
}

.badge {
  display: inline-block;
  padding: 5px 9px;
  border-radius: 999px;
  background: #23452a;
  color: #bdf0c5;
  font-size: 12px;
}

.activation-number {
  text-align: center;
  padding: 25px;
  border: 1px solid #363636;
  border-radius: 12px;
  margin: 20px 0;
}

.activation-number strong {
  font-size: 28px;
  color: var(--gold);
  letter-spacing: 3px;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 18px;
}

.tabs a {
  padding: 13px;
  text-align: center;
  border: 1px solid #383838;
}

.tabs a.active {
  background: var(--gold);
  color: #000;
}

.upload-preview {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.upload-preview img {
  width: 110px;
  height: 90px;
  object-fit: cover;
  border-radius: 8px;
}

.empty {
  text-align: center;
  padding: 60px;
  color: #aaa;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid #2b2b2b;
  font-size: 14px;
}

.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--gold);
}

/* Public GuitarCard collection */

.collection-grid {
  align-items: start;
}

.public-guitar-card {
  position: relative;
}

/* Dashboard and public collection covers are visually cropped to a square. */
.guitar-card > img,
.guitar-card-open img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center;
  background: #111;
}

.guitar-card-open {
  display: block;
  position: relative;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 17px 17px 0 0;
  overflow: hidden;
  background: #111;
  color: inherit;
  cursor: pointer;
}

.guitar-card-open img {
  border-radius: 17px 17px 0 0;
}

.guitar-card-open .guitar-placeholder,
.guitar-gallery-main .guitar-placeholder {
  object-fit: cover;
  object-position: center;
  padding: 0;
  background: #171717;
}

.photo-count {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 12px;
  backdrop-filter: blur(8px);
}

.collection-view-button {
  margin-top: 12px;
}

.modal-open {
  overflow: hidden;
}

.guitar-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  padding: 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.guitar-modal[hidden],
.guitar-gallery-main .gallery-slide[hidden] {
  display: none !important;
}

.guitar-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.84);
  backdrop-filter: blur(10px);
}

.guitar-modal-dialog {
  position: relative;
  width: min(1120px, 100%);
  margin: 24px auto;
  overflow: hidden;
  background: linear-gradient(180deg, #191919, #0d0d0d);
  border: 1px solid #353535;
  border-radius: 22px;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.7);
}

.guitar-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 5;
  width: 42px;
  height: 42px;
  border: 1px solid #444;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.76);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.guitar-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
}

.guitar-gallery {
  min-width: 0;
  padding: 24px;
  background: #080808;
  border-right: 1px solid #292929;
}

/* The main detail photo keeps its true aspect ratio. */
.guitar-gallery-main {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 320px;
  max-height: 78vh;
  overflow: hidden;
  border-radius: 16px;
  background: #080808;
}

.guitar-gallery-main img.gallery-slide {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  object-position: center;
  background: transparent;
  transform: none;
  animation: galleryFade 0.2s ease;
}

.guitar-gallery-thumbs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.gallery-thumb {
  aspect-ratio: 1 / 1;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 10px;
  background: #161616;
  cursor: pointer;
}

.gallery-thumb.active {
  border-color: var(--gold);
}

.gallery-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  background: #111;
}

.guitar-detail-content {
  max-height: 86vh;
  padding: 38px 34px 40px;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.guitar-detail-heading {
  padding-right: 50px;
}

.guitar-detail-kicker {
  margin: 0 0 7px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.guitar-detail-heading h2 {
  margin: 0;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.05;
}

.guitar-detail-subtitle {
  margin: 8px 0 0;
  font-size: 17px;
}

.public-spec-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin: 28px 0;
  overflow: hidden;
  background: #2b2b2b;
  border: 1px solid #2b2b2b;
  border-radius: 13px;
}

.public-spec {
  padding: 14px;
  background: #141414;
}

.public-spec span {
  display: block;
  margin-bottom: 5px;
  color: #999;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.public-spec strong {
  display: block;
  color: #f4f4f4;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.public-detail-section {
  padding-top: 22px;
  margin-top: 22px;
  border-top: 1px solid #2b2b2b;
}

.public-detail-section h3 {
  margin: 0 0 9px;
  color: var(--gold);
  font-size: 17px;
}

.public-detail-section p {
  margin: 0;
  color: #d6d6d6;
  line-height: 1.65;
}

@keyframes galleryFade {
  from { opacity: 0.45; }
  to { opacity: 1; }
}

@media (max-width: 900px) {
  .auth-grid { grid-template-columns: 1fr; }
  .hero { min-height: 420px; padding: 45px 30px; }
  .hero h1 { margin-top: 55px; }
  .auth-panel { padding: 38px 28px; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-lower { grid-template-columns: 1fr; }
  .topnav { display: none; }
  .stats { grid-template-columns: 1fr 1fr 1fr; }

  .guitar-detail-layout { grid-template-columns: 1fr; }
  .guitar-gallery {
    border-right: 0;
    border-bottom: 1px solid #292929;
  }
  .guitar-detail-content { max-height: none; }
  .guitar-modal-dialog { margin: 0 auto; }
  .guitar-gallery-main,
  .guitar-gallery-main img.gallery-slide { max-height: 72vh; }
}

@media (max-width: 560px) {
  .shell { width: min(100% - 20px, 1180px); margin-top: 18px; }
  .grid,
  .form-row,
  .stats { grid-template-columns: 1fr; }
  .hero { min-height: 350px; }
  .hero h1 { font-size: 42px; }
  .brand img { width: 175px; }
  .page-head {
    align-items: flex-start;
    gap: 16px;
    flex-direction: column;
  }
  .auth-panel { padding: 28px 20px; }

  .guitar-modal { padding: 8px; }
  .guitar-modal-dialog { border-radius: 16px; }
  .guitar-gallery { padding: 12px; }
  .guitar-detail-content { padding: 28px 18px; }
  .guitar-gallery-thumbs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .public-spec-grid { grid-template-columns: 1fr; }
  .guitar-modal-close { top: 10px; right: 10px; }
  .guitar-gallery-main { min-height: 240px; }
  .guitar-gallery-main,
  .guitar-gallery-main img.gallery-slide { max-height: 68vh; }
}


/* Likes and owner statistics */
.collection-card-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
  margin-top: 12px;
}

.collection-card-actions .collection-view-button {
  width: 100%;
  margin-top: 0;
}

.guitar-like-button {
  min-width: 58px;
  min-height: 44px;
  padding: 9px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid #3a3a3a;
  border-radius: 9px;
  background: #1c1c1c;
  color: #d8d8d8;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, color .18s ease, transform .18s ease;
}

.guitar-like-button:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.guitar-like-button.liked {
  border-color: var(--gold);
  background: rgba(198, 167, 94, .14);
  color: var(--gold);
}

.guitar-like-button.is-working {
  opacity: .6;
  cursor: wait;
}

.guitar-like-button:active {
  transform: scale(.96);
}

.heart-icon {
  width: 20px;
  height: 20px;
  display: inline-block;
  background-color: currentColor;
  -webkit-mask: url('../images/heart.svg') center / contain no-repeat;
  mask: url('../images/heart.svg') center / contain no-repeat;
}

.modal-like-button {
  margin-top: 20px;
  padding: 11px 15px;
}

.stats-five {
  grid-template-columns: repeat(5, 1fr);
}

.stats-table-wrap {
  overflow-x: auto;
}

.stats-guitar {
  min-width: 260px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.stats-guitar img {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  border-radius: 10px;
  object-fit: cover;
  background: #111;
}

@media (max-width: 1000px) {
  .stats-five { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 560px) {
  .stats-five { grid-template-columns: 1fr 1fr; }
  .collection-card-actions { grid-template-columns: minmax(0, 1fr) 58px; }
  .like-label { display: none; }
}

/* 100-guitar collection limit */
.collection-limit-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0 0;
  padding: 6px 10px;
  border: 1px solid #333;
  border-radius: 999px;
  background: rgba(255, 255, 255, .035);
  color: #bbb;
  font-size: 12px;
  font-weight: 700;
}

.collection-limit-count.is-full {
  border-color: rgba(198, 167, 94, .55);
  background: rgba(198, 167, 94, .12);
  color: var(--gold);
}

.dashboard-add-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.btn.disabled,
.btn[aria-disabled="true"] {
  opacity: .48;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(.35);
}

@media (max-width: 560px) {
  .dashboard-add-wrap {
    width: 100%;
    justify-content: space-between;
  }
}
