/* Tile Studio & Artisanal Themes */
:root {
  --tile-radius: 9px;
  --tile-bevel: 1px solid rgba(255, 255, 255, 0.4);
}

/* Studio Modal */
.studio-modal {
  position: fixed;
  inset: 0;
  background: rgba(12, 22, 18, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  opacity: 1;
  transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.studio-modal.hidden {
  display: none !important;
  opacity: 0;
}

.studio-dialog {
  background: #fffdf9;
  border: 1px solid #e7dfd1;
  border-radius: 28px;
  max-width: 760px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 32px 90px rgba(8, 20, 15, 0.38), 0 2px 10px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
}

.studio-header {
  padding: 22px 28px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.studio-header h2 {
  font: 700 24px/1.1 'Playfair Display', Georgia, serif;
  margin: 0;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.studio-header p {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.studio-close {
  background: #f4efe4;
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  font-size: 18px;
  cursor: pointer;
  color: var(--ink);
  transition: transform 0.15s, background 0.15s;
}

.studio-close:hover {
  background: #e9e2d3;
  transform: scale(1.05);
}

.studio-body {
  padding: 24px 28px;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 28px;
}

@media (max-width: 720px) {
  .studio-body {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 16px 18px;
  }
}

/* 3D Specimen Showcase */
.specimen-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  perspective: 900px;
  background: radial-gradient(circle at 50% 30%, #f6f1e5 0%, #ece5d4 100%);
  border: 1px solid #dfd8c8;
  border-radius: 20px;
  padding: 28px 16px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.04);
}

.specimen-tile-wrap {
  transform-style: preserve-3d;
  transition: transform 0.1s ease-out;
}

.specimen-tile {
  width: 96px;
  height: 128px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  box-shadow: 6px 12px 28px rgba(18, 35, 28, 0.22), 0 2px 4px rgba(0,0,0,0.08);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  user-select: none;
  background-size: cover;
  background-position: center;
}

.specimen-tile .specimen-glyph {
  font-size: 52px;
  line-height: 1;
  font-family: serif;
  margin: auto;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.6);
}

.specimen-tile .specimen-corner {
  position: absolute;
  top: 8px;
  left: 10px;
  font-weight: 700;
  font-size: 14px;
}

.specimen-tile .specimen-suit {
  position: absolute;
  bottom: 8px;
  right: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.specimen-hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 14px;
  text-align: center;
}

/* Studio Controls */
.studio-section {
  margin-bottom: 22px;
}

.studio-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8a7057;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Material Swatches */
.material-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 9px;
}

.material-card {
  border: 1.5px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.16s ease;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}

.material-card:hover {
  transform: translateY(-1.5px);
  border-color: #c99a45;
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.06);
}

.material-card.active {
  border-color: var(--jade-2);
  background: #f0f7f4;
  box-shadow: 0 0 0 2px var(--jade-2);
}

.material-preview-dot {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Photo Tile Uploader */
.photo-upload-dropzone {
  border: 2px dashed #d5ccbe;
  border-radius: 14px;
  padding: 18px;
  text-align: center;
  background: #faf7ef;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.photo-upload-dropzone:hover {
  background: #f4eee2;
  border-color: var(--gold);
}

.photo-upload-dropzone input {
  display: none;
}

.photo-upload-dropzone .upload-icon {
  font-size: 24px;
  margin-bottom: 6px;
  color: var(--gold);
}

.photo-upload-dropzone strong {
  display: block;
  font-size: 13px;
  color: var(--ink);
}

.photo-upload-dropzone span {
  font-size: 11px;
  color: var(--muted);
}

/* Filter Pills */
.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.filter-pill {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink);
  transition: all 0.14s;
}

.filter-pill:hover {
  background: #f8f4ec;
}

.filter-pill.active {
  background: var(--jade);
  color: #fff;
  border-color: var(--jade);
}

/* Apply Modes */
.target-options {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.target-option {
  flex: 1;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 11px;
  cursor: pointer;
  text-align: center;
  font-weight: 600;
  transition: all 0.14s;
}

.target-option.active {
  border-color: var(--jade-2);
  background: #f1f8f4;
  color: var(--jade);
}

/* Studio Footer */
.studio-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #faf7ef;
  border-radius: 0 0 28px 28px;
}

.studio-reset-btn {
  background: transparent;
  border: 0;
  color: #8b3a3a;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 8px;
}

.studio-reset-btn:hover {
  text-decoration: underline;
}

.studio-apply-btn {
  background: var(--jade);
  color: #fff;
  border: 0;
  border-radius: 12px;
  padding: 11px 24px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(21, 61, 50, 0.25);
  transition: transform 0.15s;
}

.studio-apply-btn:hover {
  transform: translateY(-1px);
}

/* Custom Photo Applied to Racks & Tiles */
.has-custom-back .mini-tile-back {
  background-image: var(--custom-tile-back) !important;
  background-size: cover !important;
  background-position: center !important;
}

.has-custom-face .tile,
.has-custom-face .american-tile,
.has-custom-face .chinese-tile {
  background-image: var(--custom-tile-face) !important;
  background-size: cover !important;
  background-blend-mode: overlay;
}
