:root {
  --bg: #0d0d0f;
  --ink: #e9dcc0;
  --card: #17161a;
  --gold: #b79354;
  --gold-soft: #8e7443;
  --deep: #080809;
  --accent: #3b7471;
  --shadow: 0 18px 34px rgba(0, 0, 0, 0.45);
  --shadow-soft: 0 10px 18px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(183, 147, 84, 0.12) 0%, transparent 36%),
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 118px,
      rgba(183, 147, 84, 0.1) 118px,
      rgba(183, 147, 84, 0.1) 120px
    ),
    var(--bg);
  color: var(--ink);
  font-family: "Jost", "Segoe UI", sans-serif;
  overflow-x: hidden;
}

.bg-orb {
  position: fixed;
  border-radius: 2px;
  border: 1px solid rgba(183, 147, 84, 0.28);
  z-index: -1;
  opacity: 0.4;
}

.orb-a {
  width: 300px;
  height: 300px;
  right: -90px;
  top: 10vh;
  transform: rotate(45deg);
  background: linear-gradient(120deg, rgba(183, 147, 84, 0.22), rgba(47, 96, 94, 0.12));
  animation: driftA 14s ease-in-out infinite alternate;
}

.orb-b {
  width: 240px;
  height: 240px;
  left: -80px;
  bottom: 8vh;
  transform: rotate(45deg);
  background: linear-gradient(120deg, rgba(47, 96, 94, 0.16), rgba(183, 147, 84, 0.2));
  animation: driftB 16s ease-in-out infinite alternate;
}

.app-shell {
  width: min(1200px, 100% - 2.25rem);
  margin: 1.4rem auto 2rem;
}

.hero {
  background: linear-gradient(145deg, #201d22, #131217);
  border: 1px solid var(--gold-soft);
  border-radius: 6px;
  padding: 1.3rem 1.3rem 1.5rem;
  box-shadow: var(--shadow-soft);
  animation: settle 500ms ease;
  position: relative;
}

.beta-badge {
  display: inline-block;
  font-family: var(--font-display, serif);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: #1a1a1a;
  background: linear-gradient(135deg, #c9a84c, #e8c96a, #b8932a);
  border: 1px solid #c9a84c;
  border-radius: 3px;
  padding: 0.2em 0.55em;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.hero-logo {
  display: block;
  width: min(100%, 660px);
  height: auto;
  margin: 0;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(183, 147, 84, 0.45);
  pointer-events: none;
}

.kicker {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #b79354;
}

.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;
}

.subtitle {
  margin: 0.9rem 0 0;
  max-width: 64ch;
  font-size: 0.98rem;
  line-height: 1.45;
  color: #ccbe9c;
}

.status {
  margin: 0.6rem 0 0;
  min-height: 1.2rem;
  font-size: 0.85rem;
  color: #b89a67;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.95rem;
}

.button-deco {
  position: relative;
  border: 1px solid var(--gold);
  border-radius: 3px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 55%),
    linear-gradient(130deg, #3a2e18, #17120d 78%);
  color: #f3e6c8;
  font-family: "Cinzel", Georgia, serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 0.78rem 1.35rem 0.72rem;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.button-deco::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(243, 230, 200, 0.16);
  pointer-events: none;
}

.button-deco__label {
  position: relative;
  display: inline-block;
  padding: 0 0.15rem;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}

.button-deco__label::before,
.button-deco__label::after {
  position: absolute;
  top: 50%;
  transform: translateY(-52%);
  font-size: 0.45rem;
  color: rgba(243, 230, 200, 0.75);
}

.button-deco__label::before {
  content: "◆";
  right: calc(100% + 0.45rem);
}

.button-deco__label::after {
  content: "◆";
  left: calc(100% + 0.3rem);
}

#installBtn {
  min-width: 12.5rem;
}

#installBtn:hover {
  transform: translateY(-2px);
  border-color: #d7b57c;
  box-shadow: 0 10px 18px rgba(30, 25, 18, 0.22);
}

#installBtn:active {
  transform: translateY(0);
}

#installBtn[hidden] {
  display: none;
}

.button-deco:hover {
  transform: translateY(-2px);
  border-color: #d7b57c;
  box-shadow: 0 10px 18px rgba(30, 25, 18, 0.22);
}

.button-deco:active {
  transform: translateY(0);
}

.button-deco:disabled {
  opacity: 0.7;
  cursor: wait;
}

.button-deco--sm {
  font-size: 0.8rem;
  padding: 0.5rem 0.9rem 0.46rem;
  letter-spacing: 0.18em;
}

.auth-user {
  font-family: "Jost", sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  color: #b89a67;
  align-self: center;
  max-width: 18rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-user[hidden] {
  display: none;
}

.account-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  border: 1px solid var(--gold);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 55%), linear-gradient(130deg, #3a2e18, #17120d 78%);
  color: #f3e6c8;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: all 200ms ease;
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 2;
  overflow: hidden;
}

.account-icon-btn:hover {
  transform: translateY(-2px);
  border-color: #d7b57c;
  box-shadow: 0 10px 18px rgba(30, 25, 18, 0.22);
}

.account-icon-btn:active {
  transform: translateY(0);
}

.account-icon-btn svg {
  width: 1.1rem;
  height: 1.1rem;
}

.account-icon-btn__avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 999px;
  display: block;
}

.account-icon-btn--has-avatar svg {
  display: none;
}

.account-icon-btn[hidden] {
  display: none;
}

.account-menu {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding-top: 1rem;
  padding-right: 1rem;
}

.account-menu[hidden] {
  display: none;
}

.account-menu__backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: rgba(5, 6, 8, 0.5);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

.account-menu__panel {
  position: relative;
  width: min(320px, 90vw);
  max-height: 90vh;
  background: linear-gradient(145deg, rgba(27, 24, 30, 0.99), rgba(12, 12, 14, 0.99));
  border: 1px solid rgba(183, 147, 84, 0.7);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
}

.account-menu__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.3rem;
  border-bottom: 1px solid rgba(183, 147, 84, 0.2);
}

.account-menu__title {
  margin: 0;
  font-family: "Cinzel", Georgia, serif;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #f3e6c8;
}

.account-menu__close {
  width: 1.8rem;
  height: 1.8rem;
  border: 1px solid rgba(183, 147, 84, 0.32);
  border-radius: 999px;
  background: rgba(15, 14, 17, 0.72);
  color: #d7bc8a;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 150ms ease;
  flex-shrink: 0;
}

.account-menu__close:hover {
  border-color: rgba(183, 147, 84, 0.6);
  background: rgba(25, 24, 30, 0.9);
}

.account-menu__close svg {
  width: 0.9rem;
  height: 0.9rem;
}

.account-menu__content {
  padding: 1.2rem 1.3rem;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.account-menu__section {
  display: grid;
  gap: 0.4rem;
}

.account-avatar-settings {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 0.7rem;
  align-items: start;
}

.account-avatar-settings__preview {
  width: 64px;
  height: 64px;
  border-radius: 6px;
  border: 1px solid rgba(183, 147, 84, 0.32);
  object-fit: cover;
  background: rgba(23, 18, 13, 0.9);
}

.account-avatar-settings__controls {
  display: grid;
  gap: 0.5rem;
}

.account-menu__label {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8e7443;
  font-weight: 600;
}

.account-menu__value {
  font-size: 0.95rem;
  color: #f3e6c8;
  word-break: break-word;
}

.account-menu__divider {
  height: 1px;
  background: rgba(183, 147, 84, 0.15);
  margin: 0.4rem 0;
}

.account-menu__action {
  display: block;
  width: 100%;
  padding: 0.7rem 0.8rem;
  border: 1px solid rgba(183, 147, 84, 0.3);
  border-radius: 4px;
  background: rgba(183, 147, 84, 0.08);
  color: #f3e6c8;
  font-family: "Jost", sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-align: left;
  cursor: pointer;
  transition: all 150ms ease;
  text-decoration: none;
}

.account-menu__action--file {
  margin: 0;
}

.account-menu__action:hover {
  border-color: rgba(183, 147, 84, 0.6);
  background: rgba(183, 147, 84, 0.15);
  transform: translateX(2px);
}

.account-menu__action:active {
  transform: translateX(0);
}

.account-menu__action--logout {
  color: #de988a;
  border-color: rgba(222, 152, 138, 0.3);
  background: rgba(222, 152, 138, 0.05);
}

.account-menu__action--logout:hover {
  border-color: rgba(222, 152, 138, 0.6);
  background: rgba(222, 152, 138, 0.12);
}

/* Username Modal Styling */
#usernameModal .detail-modal__panel {
  grid-template-columns: 1fr !important;
  min-height: auto !important;
  width: min(420px, 100%) !important;
  max-width: 90vw !important;
}

#usernameModal .detail-modal__body {
  grid-column: 1;
  grid-row: 1;
  padding: 1.8rem 1.6rem !important;
}

#usernameModal .detail-modal__title {
  font-size: 1.3rem !important;
  margin-bottom: 0.6rem !important;
  font-weight: 700;
}

#usernameModal .detail-modal__fields {
  margin-top: 0.8rem;
  gap: 0.5rem;
}

#usernameModal .detail-modal__field span {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #a0855c;
}

#usernameModal .detail-modal__field input {
  font-size: 0.95rem;
  padding: 0.5rem 0.6rem;
  background: rgba(11, 11, 13, 0.92);
}

#usernameModal .button-deco {
  font-size: 0.85rem;
  padding: 0.6rem 1rem 0.55rem;
  letter-spacing: 0.15em;
  width: auto;
  margin: 1.2rem auto 0;
  display: block;
}

#usernameModal #usernameError {
  font-size: 0.8rem !important;
  margin-top: 0.8rem !important;
}

.grid-wrap {
  margin-top: 1.1rem;
  border-radius: 6px;
  border: 1px solid var(--gold-soft);
  background: linear-gradient(145deg, #1c1a1f, #111015);
  box-shadow: var(--shadow);
  padding: 0.78rem;
  overflow: hidden;
}

.top-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
  gap: 0.52rem;
}

.cell {
  position: relative;
  background: linear-gradient(145deg, #27232b, #19171d);
  border: 1px solid #8f7342;
  border-radius: 3px;
  padding: 0.44rem;
  min-height: 90px;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  animation: reveal 480ms ease both;
  transition: background 200ms ease, border-color 200ms ease;
}

.cell:not(.cell--add) {
  cursor: pointer;
}

.cell:not(.cell--add):hover {
  border-color: #c9a862;
  background: linear-gradient(145deg, #2d2831, #1d1b21);
}

.cell--dragging {
  opacity: 0.45;
  border-color: #d7b57c;
  cursor: grabbing;
}

.cell--deleting {
  background: linear-gradient(145deg, #5a312d, #402522) !important;
  border-color: #a24f3f !important;
  animation: flash-red 700ms ease forwards;
}

.delete-btn,
.image-btn,
.refresh-btn {
  position: absolute;
  top: 0.3rem;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 160ms ease, background 160ms ease, color 160ms ease;
}

.delete-btn {
  right: 0.3rem;
  color: #d78876;
}

.delete-btn svg {
  width: 0.85rem;
  height: 0.85rem;
  pointer-events: none;
}

.cell:hover .delete-btn {
  opacity: 1;
}

.delete-btn:hover {
  background: rgba(143, 61, 45, 0.16);
}

.image-btn {
  right: 2.1rem;
  color: #76b6dd;
}

.refresh-btn {
  right: 3.9rem;
  color: #d0b27b;
}

.refresh-btn svg {
  width: 0.85rem;
  height: 0.85rem;
  pointer-events: none;
}

.image-btn svg {
  width: 0.85rem;
  height: 0.85rem;
  pointer-events: none;
}

.image-btn__text {
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

.cell:hover .image-btn {
  opacity: 1;
}

.cell:hover .refresh-btn {
  opacity: 1;
}

.image-btn:hover {
  background: rgba(35, 90, 123, 0.14);
}

.refresh-btn:hover {
  background: rgba(123, 101, 51, 0.16);
}

.refresh-btn:disabled {
  opacity: 1;
  color: #6e6550;
  cursor: wait;
}

.cell--image-loading .refresh-btn svg {
  animation: spin 900ms linear infinite;
}

.cell-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  overflow: hidden;
}

.cell-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cell--image-mode .title,
.cell--image-mode .tag {
  visibility: hidden;
}

.cell--add {
  background: linear-gradient(145deg, #252026, #18141a);
  border: 1px dashed #b79354;
  align-items: center;
  justify-content: center;
  cursor: default;
  overflow: hidden;
}

.add-plus {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #7b6533;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: top 220ms ease, left 220ms ease, width 220ms ease, height 220ms ease, transform 220ms ease;
  z-index: 1;
}

.add-plus svg {
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.cell--add.is-editing .add-plus {
  top: 0.3rem;
  left: calc(100% - 1.65rem);
  transform: none;
  width: 1.35rem;
  height: 1.35rem;
}

.cell--add.is-editing .add-plus:hover {
  background: rgba(123, 101, 51, 0.16);
  border-radius: 3px;
}

.add-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease 160ms;
  padding-top: 0.1rem;
}

.cell--add.is-editing .add-form {
  opacity: 1;
  pointer-events: auto;
}

.add-name,
.add-category {
  border: 1px solid #c7a86f;
  border-radius: 2px;
  background: #111015;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.78rem;
  padding: 0.25rem 0.35rem;
  width: 100%;
  outline: none;
  transition: border-color 140ms ease;
}

.add-name {
  font-weight: 700;
}

.add-name:focus,
.add-category:focus {
  border-color: #7b6533;
}

.rank {
  position: absolute;
  bottom: 0.3rem;
  right: 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: #c9ab72;
  letter-spacing: 0.08em;
  z-index: 2;
}

.title {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.25;
  font-weight: 500;
}

.tag {
  margin-top: auto;
  width: fit-content;
  border-radius: 2px;
  font-size: 0.68rem;
  background: #0f0e11;
  color: #f3e6c8;
  padding: 0.16rem 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: text;
  transition: background 160ms ease, transform 160ms ease;
}

.cell:not(.cell--image-mode) .tag:hover {
  background: #4f4331;
  transform: translateY(-1px);
}

.detail-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 1.4rem;
}

.detail-modal[hidden] {
  display: none;
}

.detail-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 6, 8, 0.7);
  backdrop-filter: blur(8px);
}

.detail-modal__panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr);
  width: min(940px, 100%);
  min-height: min(78vh, 560px);
  background: linear-gradient(145deg, rgba(27, 24, 30, 0.98), rgba(12, 12, 14, 0.98));
  border: 1px solid rgba(183, 147, 84, 0.7);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.45);
}

.detail-modal__panel::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(183, 147, 84, 0.2);
  pointer-events: none;
}

.detail-modal__close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  z-index: 2;
  width: 2.1rem;
  height: 2.1rem;
  border: 1px solid rgba(183, 147, 84, 0.32);
  border-radius: 999px;
  background: rgba(15, 14, 17, 0.72);
  color: #d7bc8a;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.detail-modal__close svg {
  width: 1rem;
  height: 1rem;
}

.detail-modal__media {
  position: relative;
  min-height: 320px;
  background:
    radial-gradient(circle at top, rgba(183, 147, 84, 0.22), transparent 45%),
    linear-gradient(160deg, #131217, #09090b);
}

.detail-modal__viewer-nav,
.detail-modal__favorite {
  position: absolute;
  z-index: 3;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  border: 1px solid rgba(183, 147, 84, 0.5);
  background: rgba(10, 10, 12, 0.65);
  color: #e5c98f;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(2px);
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease, color 140ms ease;
}

.detail-modal__viewer-nav:hover,
.detail-modal__favorite:hover {
  background: rgba(27, 24, 18, 0.85);
  border-color: rgba(215, 181, 124, 0.9);
  transform: translateY(-1px);
}

.detail-modal__viewer-nav:disabled,
.detail-modal__favorite:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}

.detail-modal__viewer-nav svg,
.detail-modal__favorite svg {
  width: 1.15rem;
  height: 1.15rem;
}

.detail-modal__viewer-nav--prev {
  left: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
}

.detail-modal__viewer-nav--next {
  right: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
}

.detail-modal__favorite {
  top: 0.7rem;
  right: 0.7rem;
}

.detail-modal__favorite--active {
  color: #f09b8b;
  border-color: rgba(240, 155, 139, 0.85);
  background: rgba(85, 24, 24, 0.42);
}

.detail-modal__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent, rgba(9, 9, 11, 0.22));
  pointer-events: none;
}

.detail-modal__image {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 320px;
  object-fit: contain;
}

.detail-modal__body {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0.9rem;
  padding: 2.4rem 2rem 2rem;
  overflow-y: auto;
}

.detail-modal__rank {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #d0ad6f;
}

.detail-modal__title {
  margin: 0;
  font-family: "Cinzel", Georgia, serif;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  line-height: 1.05;
  color: #f4ead5;
}

.detail-modal__category {
  margin: 0;
  width: fit-content;
  padding: 0.36rem 0.7rem;
  border: 1px solid rgba(183, 147, 84, 0.35);
  border-radius: 999px;
  font-size: 0.76rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #d4bb88;
  background: rgba(9, 9, 11, 0.4);
}

.detail-modal__fields {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.15rem;
}

.detail-modal__field {
  display: grid;
  gap: 0.35rem;
}

.detail-modal__field span {
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #c8ab76;
}

.detail-modal__field input {
  width: 100%;
  border: 1px solid rgba(183, 147, 84, 0.38);
  border-radius: 4px;
  background: rgba(11, 11, 13, 0.86);
  color: #f2e6cf;
  font-family: "Jost", "Segoe UI", sans-serif;
  font-size: 0.96rem;
  padding: 0.48rem 0.58rem;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.detail-modal__field input:focus {
  border-color: #d7b57c;
  box-shadow: 0 0 0 2px rgba(183, 147, 84, 0.2);
}

.detail-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 0.5rem;
}

.detail-action {
  width: 3rem;
  height: 3rem;
  border: 1px solid rgba(183, 147, 84, 0.36);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(18, 18, 20, 0.94));
  color: #e7d0a1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.detail-action svg {
  width: 1.05rem;
  height: 1.05rem;
}

.detail-action:hover {
  transform: translateY(-2px);
  border-color: rgba(215, 181, 124, 0.9);
}

.detail-action:disabled {
  opacity: 0.65;
  cursor: wait;
}

.detail-action--delete {
  color: #de988a;
}

.detail-action--delete:hover {
  background: rgba(117, 45, 35, 0.24);
}

.detail-action--refresh:hover {
  background: rgba(123, 101, 51, 0.16);
}

.detail-action--image:hover {
  background: rgba(35, 90, 123, 0.14);
}

.detail-modal__search-panel {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  border-top: 1px solid rgba(183, 147, 84, 0.14);
  padding-top: 0.75rem;
  margin-top: 0.2rem;
}

.detail-modal__search-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.detail-modal__search-input {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(183, 147, 84, 0.38);
  border-radius: 4px;
  background: rgba(11, 11, 13, 0.86);
  color: #f2e6cf;
  font-family: "Jost", "Segoe UI", sans-serif;
  font-size: 0.88rem;
  padding: 0.38rem 0.52rem;
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.detail-modal__search-input:focus {
  border-color: #d7b57c;
  box-shadow: 0 0 0 2px rgba(183, 147, 84, 0.2);
}

.detail-modal__search-submit {
  flex-shrink: 0;
  width: 2.1rem;
  height: 2.1rem;
  border: 1px solid rgba(183, 147, 84, 0.36);
  border-radius: 4px;
  background: rgba(183, 147, 84, 0.12);
  color: #d7b57c;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}

.detail-modal__search-submit svg {
  width: 0.9rem;
  height: 0.9rem;
}

.detail-modal__search-submit:hover {
  background: rgba(183, 147, 84, 0.26);
  border-color: rgba(215, 181, 124, 0.7);
}

.detail-modal__search-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
  gap: 0.4rem;
  max-height: 172px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(183, 147, 84, 0.3) transparent;
}

.detail-modal__search-status {
  grid-column: 1 / -1;
  margin: 0;
  padding: 0.5rem 0;
  font-size: 0.8rem;
  color: #a0927a;
  text-align: center;
}

.detail-modal__search-thumb {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 4px;
  overflow: hidden;
  background: rgba(20, 18, 22, 0.8);
  cursor: pointer;
  transition: border-color 120ms ease, transform 120ms ease;
}

.detail-modal__search-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-modal__search-thumb:hover {
  border-color: #d7b57c;
  transform: scale(1.05);
  z-index: 1;
}

.detail-modal__search-thumb:disabled {
  opacity: 0.45;
  cursor: wait;
}

.detail-modal__search-thumb--loading {
  .detail-modal__search-label {
    margin: 0 0 0.1rem;
    font-size: 0.68rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #c8ab76;
  }

  border-color: #d7b57c;
  opacity: 0.65;
}

body.modal-open {
  overflow: hidden;
}

@keyframes reveal {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes flash-red {
  0%   { background: linear-gradient(145deg, #5a312d, #402522); border-color: #a24f3f; }
  60%  { background: linear-gradient(145deg, #7a443d, #552f2a); border-color: #7d3123; }
  100% { background: linear-gradient(145deg, #27232b, #19171d); border-color: #8f7342; }
}

@keyframes settle {
  from {
    transform: translateY(-6px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@keyframes driftA {
  0% {
    transform: translateY(-10px) translateX(-6px);
  }
  100% {
    transform: translateY(16px) translateX(18px);
  }
}

@keyframes driftB {
  0% {
    transform: translateY(14px) translateX(12px);
  }
  100% {
    transform: translateY(-16px) translateX(-8px);
  }
}

@media (max-width: 700px) {
  .app-shell {
    width: min(1200px, 100% - 1rem);
    margin-top: 0.9rem;
  }

  .hero {
    padding: 1rem;
    border-radius: 4px;
  }

  .account-icon-btn {
    top: 0.75rem;
    right: 0.75rem;
  }

  .grid-wrap {
    padding: 0.55rem;
    border-radius: 4px;
  }

  .cell {
    min-height: 84px;
  }

  .top-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }

  .detail-modal {
    padding: 0.75rem;
  }

  .detail-modal__panel {
    grid-template-columns: 1fr;
    min-height: unset;
  }

  .detail-modal__media,
  .detail-modal__image {
    min-height: 240px;
  }

  .detail-modal__body {
    padding: 1.2rem 1rem 1rem;
  }
}
