:root {
  --try-bg: #090a09;
  --try-surface: #10120f;
  --try-surface-2: #151713;
  --try-border: #303229;
  --try-gold: #d9ad55;
  --try-gold-soft: #f0ce86;
  --try-teal: #57b7ac;
  --try-text: #f6f3ec;
  --try-muted: #aaa79f;
  --try-danger: #d96d6d;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body.try-on-page {
  min-height: 100vh;
  margin: 0;
  color: var(--try-text);
  background: var(--try-bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.try-on-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 10px max(20px, calc((100vw - 1320px) / 2));
  border-bottom: 1px solid var(--try-border);
  background: rgba(9, 10, 9, 0.96);
  backdrop-filter: blur(14px);
}

.try-on-brand,
.try-on-nav,
.try-on-nav a {
  display: flex;
  align-items: center;
}

.try-on-brand {
  gap: 12px;
  color: var(--try-text);
  text-decoration: none;
  font-weight: 800;
}

.try-on-brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.try-on-nav {
  gap: 8px;
}

.try-on-nav a {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--try-border);
  border-radius: 6px;
  color: var(--try-text);
  text-decoration: none;
  font-weight: 700;
}

.try-on-main {
  width: min(1320px, calc(100% - 40px));
  margin: 0 auto;
  padding: 54px 0 80px;
}

.try-on-intro,
.library-heading,
.try-on-auth-gate {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
}

.try-on-intro h1 {
  max-width: 760px;
  margin: 8px 0 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(36px, 5vw, 64px);
  line-height: 1.02;
  letter-spacing: 0;
}

.try-on-kicker,
.stage-heading p {
  margin: 0;
  color: var(--try-gold);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.try-on-intro-copy,
.try-on-auth-gate p,
.library-heading p,
.focus-result p {
  max-width: 700px;
  margin: 0;
  color: var(--try-muted);
  font-size: 16px;
  line-height: 1.65;
}

.try-on-quota {
  flex: 0 0 auto;
  min-width: 220px;
  padding: 14px 18px;
  border: 1px solid #38645f;
  border-radius: 6px;
  background: #10201d;
  color: #c6f0e8;
  font-weight: 800;
  text-align: center;
}

.try-on-notice {
  min-height: 24px;
  margin: 28px 0 18px;
  color: var(--try-muted);
  font-size: 14px;
}

.try-on-notice.is-error {
  color: #ff9b9b;
}

.try-on-notice.is-success {
  color: #8ad8c8;
}

.try-on-auth-gate {
  align-items: center;
  padding: 30px;
  border: 1px solid #665224;
  border-radius: 6px;
  background: var(--try-surface);
}

.try-on-auth-gate h2,
.library-heading h2,
.stage-heading h2 {
  margin: 5px 0 8px;
  font-size: 24px;
  line-height: 1.16;
  letter-spacing: 0;
}

.try-on-auth-actions,
.library-controls,
.library-scope,
.library-pagination {
  display: flex;
  align-items: center;
  gap: 10px;
}

.try-on-button,
.library-scope button,
.try-on-page-form button {
  appearance: none;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 6px;
  font: inherit;
  font-weight: 800;
  letter-spacing: 0;
  text-decoration: none;
  cursor: pointer;
}

.try-on-button.primary {
  background: var(--try-gold);
  color: #17130c;
}

.try-on-button.secondary,
.library-scope button {
  border-color: var(--try-border);
  background: var(--try-surface-2);
  color: var(--try-text);
}

.try-on-button.danger {
  border-color: rgba(226, 107, 92, 0.55);
  background: rgba(92, 25, 20, 0.22);
  color: #f1b0a6;
}

.try-on-button.danger:hover {
  border-color: rgba(241, 176, 166, 0.85);
  background: rgba(122, 35, 28, 0.34);
}

.try-on-button.compact {
  min-height: 40px;
  padding: 0 14px;
}

.try-on-button.full {
  width: 100%;
}

.try-on-button:disabled,
.library-scope button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.try-on-workspace {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 14px;
  align-items: stretch;
}

.try-on-stage {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--try-border);
  border-radius: 6px;
  background: var(--try-surface);
}

.stage-heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 70px;
}

.stage-heading > span {
  display: grid;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid #665224;
  border-radius: 50%;
  color: var(--try-gold-soft);
  font-weight: 900;
}

.stage-heading h2 {
  font-size: 18px;
}

.selected-watch-media,
.upload-drop,
.focus-result {
  position: relative;
  display: grid;
  width: 100%;
  aspect-ratio: 4 / 3;
  place-items: center;
  overflow: hidden;
  border: 1px solid #292b25;
  border-radius: 4px;
  background: #050605;
}

.selected-watch-media img,
.upload-drop img,
.focus-result img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.selected-watch-meta {
  display: grid;
  gap: 5px;
  padding-top: 14px;
}

.selected-watch-meta strong {
  color: var(--try-gold-soft);
  text-transform: uppercase;
}

.selected-watch-meta span {
  color: var(--try-muted);
}

.selected-watch-meta a {
  width: max-content;
  margin-top: 5px;
  color: var(--try-teal);
}

.try-on-page-form {
  display: grid;
  gap: 14px;
}

.try-on-page-form > input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.upload-drop {
  cursor: pointer;
  border-style: dashed;
  border-color: #665224;
  background: #0c0d0b;
}

.upload-drop:focus-within,
.upload-drop:hover {
  border-color: var(--try-gold);
}

#uploadPrompt {
  display: grid;
  gap: 8px;
  padding: 24px;
  text-align: center;
}

#uploadPrompt strong {
  color: var(--try-gold-soft);
}

#uploadPrompt small {
  color: var(--try-muted);
}

.try-on-page-consent {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 10px;
  color: var(--try-muted);
  font-size: 13px;
  line-height: 1.5;
}

.try-on-page-consent input {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: var(--try-gold);
}

.try-on-page-consent a {
  color: var(--try-teal);
}

.focus-result {
  align-content: center;
  min-height: 260px;
}

.focus-result p {
  padding: 28px;
  text-align: center;
}

.focus-result-output {
  position: relative;
  width: 100%;
  height: 100%;
}

.focus-result-badge,
.library-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid #38645f;
  border-radius: 999px;
  background: #10201d;
  color: #bde6df;
  font-size: 12px;
  font-weight: 800;
}

.try-on-library {
  margin-top: 54px;
  padding-top: 30px;
  border-top: 1px solid var(--try-border);
}

.library-heading {
  align-items: center;
  margin-bottom: 22px;
}

.library-heading h2 {
  margin-top: 7px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 34px;
}

.library-scope {
  padding: 3px;
  border: 1px solid var(--try-border);
  border-radius: 6px;
  background: #0b0c0a;
}

.library-scope button {
  min-height: 36px;
  padding: 0 12px;
  border: 0;
}

.library-scope button.is-active {
  background: var(--try-gold);
  color: #17130c;
}

.try-on-library-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.library-card {
  display: grid;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--try-border);
  border-radius: 6px;
  background: var(--try-surface);
}

.library-card-media {
  display: grid;
  min-height: 220px;
  aspect-ratio: 4 / 3;
  place-items: center;
  overflow: hidden;
  background: #050605;
}

.library-card-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.library-card-media.empty {
  padding: 24px;
  color: var(--try-muted);
  text-align: center;
}

.library-card-body {
  display: grid;
  gap: 9px;
  padding: 16px;
}

.library-card-body h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
  letter-spacing: 0;
}

.library-card-body p,
.library-card-body time {
  margin: 0;
  color: var(--try-muted);
  font-size: 13px;
}

.library-card-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

.library-card-actions a,
.library-card-actions button {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--try-border);
  border-radius: 4px;
  background: #151713;
  color: var(--try-text);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.library-card-actions button {
  color: #ffabab;
}

.library-empty {
  grid-column: 1 / -1;
  padding: 42px 20px;
  border: 1px solid var(--try-border);
  border-radius: 6px;
  color: var(--try-muted);
  text-align: center;
}

.library-pagination {
  justify-content: center;
  margin-top: 24px;
}

.library-pagination span {
  min-width: 100px;
  text-align: center;
  font-weight: 800;
}

.try-on-footer {
  display: flex;
  justify-content: center;
  gap: 18px;
  padding: 28px 20px calc(28px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--try-border);
  color: var(--try-muted);
  font-size: 13px;
}

.try-on-footer a {
  color: var(--try-text);
}

@media (max-width: 980px) {
  .try-on-workspace {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-stage {
    grid-column: 1 / -1;
  }

  .focus-result {
    aspect-ratio: 16 / 9;
  }

  .try-on-library-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .try-on-header {
    min-height: 64px;
    padding: 8px 14px;
  }

  .try-on-brand img {
    width: 42px;
    height: 42px;
  }

  .try-on-nav a {
    min-height: 40px;
    padding: 0 11px;
    font-size: 13px;
  }

  .try-on-main {
    width: min(100% - 28px, 1320px);
    padding: 34px 0 54px;
  }

  .try-on-intro,
  .try-on-auth-gate,
  .library-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .try-on-intro h1 {
    font-size: 40px;
  }

  .try-on-quota {
    width: 100%;
  }

  .try-on-auth-actions,
  .library-controls {
    width: 100%;
  }

  .try-on-auth-actions .try-on-button {
    flex: 1 1 0;
    text-align: center;
  }

  .try-on-workspace,
  .try-on-library-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .result-stage {
    grid-column: auto;
  }

  .try-on-stage {
    padding: 16px;
  }

  .selected-watch-media,
  .upload-drop,
  .focus-result {
    aspect-ratio: 1 / 1;
  }

  .library-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .library-scope {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .try-on-footer {
    flex-wrap: wrap;
  }
}
