/* Moda — mobile-first multi-page app */

:root {
  --bg: #fffdf7;
  --primary: #1f1f1f;
  --accent: #c9b37e;
  --accent-deep: #8f6e47;
  --accent-soft: #efe4ca;
  --white: #ffffff;
  --shadow: 0 16px 40px rgba(31, 31, 31, 0.08);
  --shadow-item: 0 12px 28px rgba(31, 31, 31, 0.14);
  --radius: 12px;
  --radius-sm: 8px;
  --font: "DM Sans", system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tab-bar-h: 60px;
  --layout-max: 1200px;
}

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

html,
body {
  height: 100%;
  margin: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font);
  background:
    radial-gradient(circle at top left, rgba(201, 179, 126, 0.16), transparent 26%),
    radial-gradient(circle at top right, rgba(31, 31, 31, 0.05), transparent 20%),
    linear-gradient(180deg, #fffdf7 0%, #f8f2e7 62%, #f3ebdd 100%);
  color: var(--primary);
  font-size: 15px;
  line-height: 1.4;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0)),
    radial-gradient(circle at 18% 8%, rgba(201, 179, 126, 0.08), transparent 22%);
  z-index: 0;
}

.lang-switcher {
  position: fixed;
  top: calc(12px + var(--safe-top));
  right: 12px;
  z-index: 210000;
  display: inline-flex;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(31, 31, 31, 0.08);
  box-shadow: 0 8px 24px rgba(31, 31, 31, 0.12);
  backdrop-filter: blur(12px);
}

.lang-switcher__btn {
  border: none;
  background: transparent;
  color: rgba(31, 31, 31, 0.62);
  min-width: 46px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.lang-switcher__btn.is-active {
  background: var(--primary);
  color: var(--bg);
}

.app {
  width: 100%;
  max-width: min(100%, 390px);
  min-height: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: calc(12px + var(--safe-top)) 16px calc(12px + var(--safe-bottom));
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: auto;
  height: 34px;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(94, 61, 43, 0.14));
}

.app--with-tabs {
  padding-bottom: calc(var(--tab-bar-h) + 16px + var(--safe-bottom));
  min-height: 100vh;
}

.app--scroll {
  min-height: 100vh;
}

/* Studio: mobile stack, desktop grid (see media query) */
.studio-workspace {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 0;
}

.studio-canvas-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.studio-closet-col {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.closet-heading {
  display: none;
  margin: 0 0 10px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(31, 31, 31, 0.45);
}

/* Top bar (studio) */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  padding: 12px 14px;
  margin-bottom: 14px;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.54);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(250, 246, 239, 0.82));
  box-shadow: 0 16px 34px rgba(31, 31, 31, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(16px);
}

.brand--text {
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: 0.22em;
  color: var(--accent);
  text-decoration: none;
}

.btn-save {
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 10px 20px;
  border: 1px solid var(--primary);
  border-radius: 999px;
  background: linear-gradient(135deg, #1f1f1f, #4d463c);
  color: var(--bg);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.btn-save:active {
  transform: scale(0.97);
}

.btn-save:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Canvas — mobile ~65–70vh */
.canvas-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  margin-bottom: 16px;
}

.canvas {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 65vh;
  max-height: 70vh;
  background:
    radial-gradient(circle at top, rgba(201, 179, 126, 0.12), transparent 40%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 243, 234, 0.94));
  border-radius: 22px;
  border: 1px solid rgba(31, 31, 31, 0.08);
  box-shadow: 0 18px 44px rgba(31, 31, 31, 0.08);
  overflow: hidden;
  touch-action: none;
}

.canvas-hint {
  position: absolute;
  inset: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  font-size: 0.9rem;
  font-weight: 500;
  color: rgba(31, 31, 31, 0.35);
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.canvas.has-items .canvas-hint {
  opacity: 0;
}

.canvas-item {
  position: absolute;
  transform-origin: center center;
  cursor: grab;
  filter: drop-shadow(var(--shadow-item));
  transition: box-shadow 0.15s ease;
  touch-action: none;
}

.canvas-item:active {
  cursor: grabbing;
}

.canvas-item.is-selected {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
  z-index: 9999 !important;
}

.canvas-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.resize-handle,
.rotate-handle {
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--white);
  border: 2px solid var(--accent);
  box-shadow: 0 2px 8px rgba(31, 31, 31, 0.12);
  z-index: 2;
  touch-action: none;
}

.resize-handle {
  right: -8px;
  bottom: -8px;
  cursor: nwse-resize;
}

.rotate-handle {
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  cursor: grab;
}

.rotate-handle:active {
  cursor: grabbing;
}

.canvas-item:not(.is-selected) .resize-handle,
.canvas-item:not(.is-selected) .rotate-handle {
  display: none;
}

.closet-panel {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 4px;
}

.closet-scroll {
  flex: 1;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 2px 10px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.closet-scroll::-webkit-scrollbar {
  height: 4px;
}

.closet-scroll::-webkit-scrollbar-thumb {
  background: rgba(31, 31, 31, 0.15);
  border-radius: 4px;
}

.closet-thumb {
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  background:
    radial-gradient(circle at top, rgba(201, 179, 126, 0.12), transparent 40%),
    var(--white);
  box-shadow: 0 10px 22px rgba(31, 31, 31, 0.08);
  overflow: hidden;
  cursor: grab;
  scroll-snap-align: start;
  touch-action: none;
  border: 1px solid rgba(31, 31, 31, 0.06);
}

.closet-thumb:active {
  cursor: grabbing;
  transform: scale(0.98);
}

.closet-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.upload-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  padding: 14px 18px;
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(31, 31, 31, 0.12);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.upload-btn:hover,
.upload-btn:focus-within {
  border-color: var(--accent);
  background: rgba(201, 179, 126, 0.08);
}

.upload-btn:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.drag-ghost {
  position: fixed;
  width: 100px;
  height: 100px;
  pointer-events: none;
  z-index: 100000;
  opacity: 0.92;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-item);
  transform: translate(-50%, -50%);
}

.drag-ghost img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Secondary pages */
.page-header {
  margin-bottom: 20px;
  padding: 18px 18px 0;
  border: 1px solid rgba(255, 255, 255, 0.56);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(249, 244, 235, 0.76));
  box-shadow: 0 18px 38px rgba(31, 31, 31, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(16px);
}

.page-header .brand--text {
  display: inline-block;
  margin-bottom: 12px;
}

.page-header .brand-logo,
.wardrobe-header .brand-logo {
  height: 38px;
}

.page-title {
  margin: 0 0 6px;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.page-sub {
  margin: 0;
  font-size: 0.88rem;
  color: rgba(31, 31, 31, 0.5);
}

/* Outfits grid */
.outfits-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding-bottom: 8px;
}

.outfit-card {
  background: rgba(255, 255, 255, 0.84);
  border-radius: 18px;
  box-shadow: 0 16px 36px rgba(31, 31, 31, 0.08);
  overflow: hidden;
  border: 1px solid rgba(31, 31, 31, 0.06);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  padding: 0;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.outfit-card:active {
  transform: scale(0.98);
}

.outfit-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 22px 44px rgba(31, 31, 31, 0.1);
  border-color: rgba(201, 179, 126, 0.24);
}

.outfit-card__thumb {
  aspect-ratio: 3 / 4;
  background: #f5f3ef;
  display: flex;
  align-items: center;
  justify-content: center;
}

.outfit-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.outfit-card__body {
  padding: 10px 12px 12px;
}

.outfit-card__name {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.3;
}

.outfit-card__date {
  margin: 4px 0 0;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(31, 31, 31, 0.45);
}

.empty-state {
  text-align: center;
  padding: 32px 16px;
  font-size: 0.9rem;
  color: rgba(31, 31, 31, 0.45);
  margin: 0;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.modal[hidden] {
  display: none !important;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 31, 31, 0.45);
}

.modal__panel {
  position: relative;
  width: 100%;
  max-width: 390px;
  max-height: 92vh;
  overflow: auto;
  background: linear-gradient(180deg, rgba(255, 253, 247, 0.98), rgba(249, 243, 233, 0.98));
  border-radius: 24px 24px 0 0;
  padding: 20px 20px calc(24px + var(--safe-bottom));
  box-shadow: 0 -8px 32px rgba(31, 31, 31, 0.12);
}

.modal__panel--compact {
  max-width: 390px;
}

.modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  font-size: 1.75rem;
  line-height: 1;
  color: var(--primary);
  cursor: pointer;
  border-radius: 50%;
}

.modal__title {
  margin: 0 40px 4px 0;
  font-size: 1.15rem;
  font-weight: 600;
}

.modal__meta {
  margin: 0 0 16px;
  font-size: 0.8rem;
  color: rgba(31, 31, 31, 0.5);
}

.modal__image-wrap {
  background: var(--white);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.modal__image {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
}

.btn-danger {
  width: 100%;
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 14px;
  border: 1px solid rgba(31, 31, 31, 0.2);
  border-radius: var(--radius-sm);
  background: transparent;
  color: #8b2942;
  cursor: pointer;
}

.btn-danger:active {
  background: rgba(139, 41, 66, 0.06);
}

.btn-primary {
  width: 100%;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #1f1f1f, var(--accent-deep));
  color: var(--bg);
  cursor: pointer;
  margin-top: 8px;
  box-shadow: 0 12px 24px rgba(79, 60, 42, 0.2);
}

.btn-primary:active {
  opacity: 0.92;
}

/* Profile */
.profile-layout {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.profile-sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.danger-zone--plain {
  border-top: none;
  padding-top: 0;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field__label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(31, 31, 31, 0.55);
}

.field__hint {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: rgba(31, 31, 31, 0.35);
}

.field__input {
  font-family: var(--font);
  font-size: 1rem;
  padding: 12px 14px;
  border: 1px solid rgba(31, 31, 31, 0.12);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--primary);
}

.field__input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: transparent;
}

.danger-zone {
  padding-top: 8px;
  border-top: 1px solid rgba(31, 31, 31, 0.08);
}

.danger-zone__title {
  margin: 0 0 8px;
  font-size: 0.85rem;
  font-weight: 600;
}

.danger-zone__text {
  margin: 0 0 14px;
  font-size: 0.85rem;
  color: rgba(31, 31, 31, 0.5);
}

/* Bottom tab bar (mobile) */
.tab-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 150000;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  width: 100%;
  max-width: min(100%, 390px);
  margin: 0 auto;
  min-height: var(--tab-bar-h);
  padding-bottom: var(--safe-bottom);
  background: rgba(255, 255, 255, 0.78);
  border-top: 1px solid rgba(255, 255, 255, 0.68);
  box-shadow: 0 -8px 28px rgba(31, 31, 31, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(18px);
}

.tab-bar__link {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 4px;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(31, 31, 31, 0.4);
  text-decoration: none;
}

.tab-bar__link.is-active {
  color: var(--primary);
  background: rgba(201, 179, 126, 0.12);
}

.tab-bar__link.is-active .tab-bar__icon {
  color: var(--accent);
}

.tab-bar__icon {
  display: flex;
  color: rgba(31, 31, 31, 0.45);
}

.tab-bar__link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-bar-h) + 20px + var(--safe-bottom));
  transform: translateX(-50%) translateY(120%);
  max-width: min(90vw, 360px);
  padding: 12px 18px;
  font-size: 0.85rem;
  text-align: center;
  background: var(--primary);
  color: var(--bg);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  opacity: 0;
  transition: transform 0.35s ease, opacity 0.35s ease;
  z-index: 100001;
  pointer-events: none;
}

.page-profile .toast,
.page-outfits .toast {
  bottom: calc(var(--tab-bar-h) + 20px + var(--safe-bottom));
}

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

/* Login & splash */
.page-login {
  min-height: 100%;
}

.splash {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at top, rgba(201, 179, 126, 0.24), transparent 34%),
    linear-gradient(180deg, #fffdf7 0%, #f5efe2 100%);
  transition: opacity 0.55s ease;
}

.splash--done {
  opacity: 0;
  pointer-events: none;
}

.splash__logo {
  width: min(78vw, 420px);
  filter: drop-shadow(0 24px 34px rgba(94, 61, 43, 0.16));
}

.auth-panel {
  position: relative;
  z-index: 3;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(24px + var(--safe-top)) 20px calc(32px + var(--safe-bottom));
}

.auth-panel__inner {
  width: 100%;
  max-width: 360px;
  padding: 28px 24px;
  border: 1px solid rgba(31, 31, 31, 0.08);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 22px 50px rgba(31, 31, 31, 0.08);
  backdrop-filter: blur(14px);
}

.auth-panel__logo {
  display: block;
  width: min(72vw, 320px);
  margin: 0 auto 20px;
  filter: drop-shadow(0 12px 18px rgba(94, 61, 43, 0.12));
}

.auth-panel__lede {
  margin: 0 0 22px;
  text-align: center;
  font-size: 0.95rem;
  color: rgba(31, 31, 31, 0.55);
}

.auth-form .field {
  margin-bottom: 4px;
}

.auth-switch {
  margin: 20px 0 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.link-btn {
  border: none;
  background: none;
  font: inherit;
  font-size: 0.88rem;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

/* Home dashboard */
.page-home {
  background:
    radial-gradient(circle at top left, rgba(201, 179, 126, 0.22), transparent 28%),
    radial-gradient(circle at top right, rgba(31, 31, 31, 0.06), transparent 26%),
    linear-gradient(180deg, #fffdf7 0%, #f5f0e4 100%);
}

.page-home .app {
  gap: 24px;
}

.home-hero {
  position: relative;
  display: grid;
  gap: 18px;
  padding: 24px;
  border-radius: 28px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(248, 242, 230, 0.88)),
    var(--white);
  box-shadow: 0 24px 56px rgba(31, 31, 31, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.88);
  overflow: hidden;
}

.home-hero::before,
.home-hero::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
}

.home-hero::before {
  width: 220px;
  height: 220px;
  top: -120px;
  right: -56px;
  background: radial-gradient(circle, rgba(201, 179, 126, 0.28), transparent 68%);
}

.home-hero::after {
  width: 180px;
  height: 180px;
  bottom: -96px;
  left: -56px;
  background: radial-gradient(circle, rgba(31, 31, 31, 0.08), transparent 70%);
}

.home-hero__copy,
.home-reco-card {
  position: relative;
  z-index: 1;
}

.home-hero__logo {
  display: block;
  width: min(58vw, 330px);
  margin-bottom: 10px;
  filter: drop-shadow(0 16px 26px rgba(94, 61, 43, 0.14));
}

.home-hero__eyebrow {
  margin: 12px 0 8px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(31, 31, 31, 0.52);
}

.home-hero__title {
  margin: 0;
  font-size: clamp(2rem, 10vw, 3.2rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
}

.home-hero__sub {
  max-width: 34ch;
  margin: 14px 0 0;
  font-size: 0.98rem;
  color: rgba(31, 31, 31, 0.64);
}

.home-hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.home-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(31, 31, 31, 0.08);
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(31, 31, 31, 0.78);
}

.home-reco-card {
  display: grid;
  gap: 16px;
  padding: 14px;
  border-radius: 24px;
  background:
    radial-gradient(circle at top left, rgba(201, 179, 126, 0.14), transparent 32%),
    linear-gradient(180deg, rgba(34, 33, 31, 0.98), rgba(19, 18, 17, 0.98));
  color: #fffdf7;
  box-shadow: 0 22px 48px rgba(31, 31, 31, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.home-reco-card__media {
  position: relative;
  min-height: 240px;
  border-radius: 18px;
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(201, 179, 126, 0.32), transparent 38%),
    linear-gradient(180deg, #3a3834 0%, #181816 100%);
}

.home-reco-card__media img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.home-reco-card__media img[hidden] {
  display: none !important;
}

.home-reco-card__placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: end;
  justify-items: start;
  padding: 22px 18px 20px;
  gap: 8px;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.44) 100%);
  overflow: hidden;
}

.home-reco-card__placeholder-logo {
  position: absolute;
  top: 18px;
  left: 18px;
  width: min(42vw, 168px);
  max-width: 58%;
  opacity: 0.2;
  transform: none;
  filter: saturate(1) brightness(1.02);
  pointer-events: none;
}

.home-reco-card__placeholder-line {
  max-width: 20ch;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.26;
  position: relative;
  z-index: 1;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
  text-wrap: balance;
}

.home-reco-card__body {
  display: grid;
  gap: 10px;
  padding: 4px 4px 2px;
}

.home-reco-card__label,
.home-story-card__label,
.home-section__sub,
.dash-card__badge {
  margin: 0;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.home-reco-card__label {
  color: rgba(255, 253, 247, 0.64);
}

.dash-card__badge {
  color: rgba(31, 31, 31, 0.46);
}

.home-reco-card__title {
  margin: 0;
  font-size: 1.45rem;
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.home-reco-card__text {
  margin: 0;
  color: rgba(255, 253, 247, 0.72);
}

.home-reco-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.home-cta {
  width: auto;
  min-width: 140px;
  margin-top: 0;
}

.home-section {
  display: grid;
  gap: 16px;
}

.home-section__head {
  display: grid;
  gap: 6px;
}

.home-section__title {
  margin: 0;
  font-size: 1.2rem;
  letter-spacing: -0.03em;
}

.home-section__sub {
  color: rgba(31, 31, 31, 0.48);
}

.brand--static {
  display: inline-block;
  margin-bottom: 12px;
  cursor: default;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.dash-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 18px 16px;
  min-height: 120px;
  background: rgba(255, 255, 255, 0.74);
  border-radius: 18px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.54);
  text-decoration: none;
  color: inherit;
  transition: transform 0.18s ease, border-color 0.2s ease, box-shadow 0.18s ease;
  backdrop-filter: blur(16px);
  position: relative;
  overflow: hidden;
}

.dash-card:active {
  transform: scale(0.98);
}

.dash-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 44px rgba(31, 31, 31, 0.11);
}

.dash-card::after {
  content: "";
  position: absolute;
  right: -18px;
  bottom: -26px;
  width: 108px;
  height: 108px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 179, 126, 0.16), transparent 68%);
  pointer-events: none;
}

.dash-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.dash-card__icon {
  color: var(--accent);
  display: flex;
  margin-top: 2px;
}

.dash-card__title {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.dash-card__hint {
  font-size: 0.72rem;
  color: rgba(31, 31, 31, 0.45);
  line-height: 1.35;
}

.home-section--insights {
  grid-template-columns: 1fr;
}

.home-story-card,
.home-metric {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.56);
  border-radius: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.home-story-card {
  position: relative;
  padding: 24px;
  overflow: hidden;
}

.home-story-card::after {
  content: "";
  position: absolute;
  width: 160px;
  height: 160px;
  right: -40px;
  bottom: -48px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 179, 126, 0.24), transparent 70%);
}

.home-story-card__label {
  color: rgba(31, 31, 31, 0.44);
}

.home-story-card__title {
  position: relative;
  z-index: 1;
  margin: 10px 0 8px;
  font-size: 1.55rem;
  line-height: 1.04;
  letter-spacing: -0.04em;
}

.home-story-card__text {
  position: relative;
  z-index: 1;
  max-width: 42ch;
  margin: 0;
  color: rgba(31, 31, 31, 0.6);
}

.home-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.home-metric {
  padding: 18px;
}

.home-metric:last-child {
  grid-column: 1 / -1;
}

.home-metric__label {
  margin: 0;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(31, 31, 31, 0.44);
}

.home-metric__value {
  margin: 12px 0 4px;
  font-size: 2rem;
  line-height: 1;
  letter-spacing: -0.05em;
}

.home-metric__value--small {
  font-size: 1.35rem;
}

.home-metric__text {
  margin: 0;
  font-size: 0.82rem;
  color: rgba(31, 31, 31, 0.52);
}

/* Wardrobe */
.page-title--tight {
  margin-bottom: 2px;
}

.wardrobe-header__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.wardrobe-header {
  padding: 18px 18px 20px;
  margin-bottom: 20px;
  border: 1px solid rgba(255, 255, 255, 0.56);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(249, 244, 235, 0.76));
  box-shadow: 0 18px 38px rgba(31, 31, 31, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(16px);
}

.btn-add-piece {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--bg);
  background: linear-gradient(135deg, #1f1f1f, #4d463c);
  border-radius: 999px;
  cursor: pointer;
  border: none;
  box-shadow: var(--shadow);
}

.btn-add-piece:active {
  transform: scale(0.97);
}

.wardrobe-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding-bottom: 8px;
}

.wardrobe-card {
  background: rgba(255, 255, 255, 0.84);
  border-radius: 18px;
  box-shadow: 0 16px 36px rgba(31, 31, 31, 0.08);
  overflow: hidden;
  border: 1px solid rgba(31, 31, 31, 0.06);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  padding: 0;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.wardrobe-card:active {
  transform: scale(0.98);
}

.wardrobe-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 22px 44px rgba(31, 31, 31, 0.1);
  border-color: rgba(201, 179, 126, 0.24);
}

.wardrobe-card__thumb {
  aspect-ratio: 1;
  background: #f5f3ef;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wardrobe-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.wardrobe-card__body {
  padding: 10px 12px 12px;
}

.wardrobe-card__name {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-primary--link {
  display: block;
  text-align: center;
  text-decoration: none;
  margin-bottom: 10px;
  color: var(--bg);
}

.btn-secondary {
  width: 100%;
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 14px;
  border: 1px solid rgba(31, 31, 31, 0.2);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--primary);
  cursor: pointer;
}

.btn-secondary:active {
  background: rgba(31, 31, 31, 0.04);
}

.profile-link-card {
  display: block;
  width: 100%;
  padding: 16px 18px;
  border: 1px solid rgba(31, 31, 31, 0.12);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--primary);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 0.16s ease, border-color 0.2s ease;
}

.profile-link-card:hover,
.profile-link-card:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(201, 179, 126, 0.5);
}

.profile-link-card__title {
  display: block;
  margin-bottom: 4px;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.profile-link-card__text {
  display: block;
  font-size: 0.82rem;
  color: rgba(31, 31, 31, 0.52);
}

.source-options {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.source-option {
  margin-top: 0;
}

/* Five-tab bar */
.tab-bar--five .tab-bar__link {
  padding: 6px 2px;
  gap: 2px;
}

.tab-bar--five .tab-bar__label {
  font-size: 0.5rem;
  letter-spacing: 0.04em;
  line-height: 1.1;
  text-align: center;
  max-width: 100%;
}

.page-home .toast {
  bottom: calc(var(--tab-bar-h) + 20px + var(--safe-bottom));
}

/* ——— Tablet & desktop ——— */
@media (min-width: 768px) {
  :root {
    --tab-bar-h: 64px;
  }

  body {
    font-size: 16px;
  }

  .app {
    max-width: var(--layout-max);
    padding-left: clamp(20px, 4vw, 40px);
    padding-right: clamp(20px, 4vw, 40px);
    padding-bottom: calc(28px + var(--safe-bottom));
  }

  .app--with-tabs {
    padding-top: calc(var(--tab-bar-h) + 20px + var(--safe-top));
    padding-bottom: calc(32px + var(--safe-bottom));
  }

  /* Top navigation */
  .tab-bar {
    top: 0;
    bottom: auto;
    max-width: none;
    width: 100%;
    min-height: var(--tab-bar-h);
    padding: 12px clamp(16px, 3vw, 40px);
    padding-top: calc(12px + var(--safe-top));
    padding-bottom: 12px;
    border-top: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 10px 28px rgba(31, 31, 31, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.82);
    justify-content: center;
    gap: 4px;
  }

  .tab-bar__link {
    flex-direction: row;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
  }

  .tab-bar--five .tab-bar__label {
    font-size: 0.78rem;
    letter-spacing: 0.05em;
    line-height: 1.2;
    max-width: none;
  }

  .tab-bar__link.is-active {
    background: rgba(201, 179, 126, 0.15);
  }

  .toast {
    top: calc(var(--tab-bar-h) + 16px + var(--safe-top));
    bottom: auto;
    transform: translateX(-50%) translateY(-130%);
    font-size: 0.9rem;
    padding: 14px 22px;
  }

  .toast.is-visible {
    transform: translateX(-50%) translateY(0);
  }

  .page-title {
    font-size: clamp(1.5rem, 2.5vw, 2rem);
  }

  .btn-save,
  .btn-primary,
  .btn-secondary,
  .btn-danger {
    padding: 14px 20px;
    font-size: 0.92rem;
  }

  /* Studio: two columns */
  .page-studio .studio-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
    gap: clamp(20px, 3vw, 32px);
    align-items: stretch;
    flex: 1;
    min-height: min(72vh, 760px);
  }

  .page-studio .studio-canvas-col {
    min-height: 0;
  }

  .page-studio .canvas-wrap {
    margin-bottom: 0;
    flex: 1;
    min-height: 500px;
  }

  .page-studio .canvas {
    min-height: 500px;
    max-height: min(75vh, 800px);
  }

  .page-studio .studio-closet-col {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 16px;
    min-height: 500px;
    max-height: min(75vh, 800px);
  }

  .page-studio .closet-heading {
    display: block;
  }

  .page-studio .closet-panel {
    flex-direction: column;
    align-items: stretch;
    flex: 1;
    min-height: 0;
    gap: 16px;
    padding-top: 0;
  }

  .page-studio .closet-scroll {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    overflow-x: hidden;
    overflow-y: auto;
    flex: 1;
    padding: 4px 2px 12px;
    scroll-snap-type: none;
  }

  .page-studio .closet-thumb {
    flex: none;
    width: 100%;
    aspect-ratio: 1;
    height: auto;
    scroll-snap-align: unset;
  }

  .page-studio .upload-btn {
    width: 100%;
    min-width: unset;
  }

  /* Home dashboard */
  .dashboard-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: clamp(16px, 2vw, 24px);
  }

  .home-hero {
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 420px);
    align-items: stretch;
    gap: 22px;
    padding: 30px;
  }

  .home-reco-card__media {
    min-height: 100%;
  }

  .home-section--insights {
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
    gap: 20px;
    align-items: stretch;
  }

  .home-metrics {
    grid-template-columns: 1fr;
  }

  .home-metric:last-child {
    grid-column: auto;
  }

  .dash-card {
    min-height: 140px;
    padding: 22px 20px;
  }

  .dash-card__title {
    font-size: 1rem;
  }

  .dash-card__hint {
    font-size: 0.8rem;
  }

  /* Wardrobe & outfits grids */
  .wardrobe-grid,
  .outfits-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: clamp(14px, 2vw, 20px);
  }

  .wardrobe-card__name,
  .outfit-card__name {
    font-size: 0.9rem;
  }

  /* Profile */
  .profile-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 400px);
    gap: clamp(24px, 4vw, 48px);
    align-items: start;
  }

  .profile-form .btn-primary {
    max-width: 280px;
  }

  /* Modals */
  .modal {
    align-items: center;
    padding: 24px;
  }

  .modal__panel {
    border-radius: var(--radius);
    max-width: min(520px, 92vw);
    max-height: 90vh;
    padding: 28px;
  }

  .wardrobe-header__row {
    align-items: center;
  }

  .btn-add-piece {
    padding: 12px 22px;
    font-size: 0.85rem;
  }
}

@media (min-width: 1200px) {
  .wardrobe-grid,
  .outfits-grid {
    grid-template-columns: repeat(5, 1fr);
  }

  .page-studio .closet-scroll {
    grid-template-columns: repeat(4, 1fr);
  }

  .tab-bar__link {
    padding: 10px 20px;
  }
}

@media (max-width: 767px) {
  .canvas {
    min-height: clamp(280px, 65vh, 70vh);
    max-height: 70vh;
  }
}
