/* Tablou.md Wall Preview — scoped UI */

#tw-wallpreview { width: 100%; }

.tw-app {
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-family: 'Inter Tight', -apple-system, BlinkMacSystemFont, sans-serif;
  color: #1c1a17;
  width: 100%;
}

.tw-canvas-wrap {
  position: relative;
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, #f5f5f7 0%, #ece9e2 100%);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 6px 24px rgba(28,26,23,.06);
  width: 100%;
}

.tw-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.tw-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .2s, border-color .2s;
  border: 2px dashed transparent;
  border-radius: 16px;
  text-align: center;
  padding: 24px;
  z-index: 2;
}

.tw-empty[data-step="done"] { display: none; }
.tw-empty:hover, .tw-empty.tw-dragover {
  background: rgba(196,90,47,.05);
  border-color: rgba(196,90,47,.35);
}

.tw-empty-ic {
  font-size: 44px;
  opacity: .75;
  line-height: 1;
  margin-bottom: 12px;
}

.tw-empty-title {
  font-family: 'Fraunces', serif;
  font-weight: 400;
  font-size: 24px;
  color: #1c1a17;
  margin: 0 0 6px;
  letter-spacing: -0.015em;
}

.tw-empty-sub {
  font-size: 13px;
  color: #8a8177;
  margin: 0;
}

/* Controls: picker + toolbar (stacked below canvas) */
.tw-controls { display: flex; flex-direction: column; gap: 12px; }

.tw-picker[data-show="false"] { display: none; }

.tw-picker-head {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  margin-bottom: 12px;
}

.tw-picker-title {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #8a8177;
  font-weight: 600;
}

.tw-pick-custom {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px 14px;
  border-radius: 999px;
  border: 0;
  background: linear-gradient(90deg, #3D7BFF 0%, #876BFF 100%);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: .01em;
  box-shadow: 0 6px 16px rgba(89, 108, 255, .28);
  transition: transform .2s, box-shadow .2s;
  font-family: inherit;
}
.tw-pick-custom:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(89, 108, 255, .38);
}

/* Picker search */
.tw-picker-search {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tw-picker-search-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid rgba(28,26,23,.12);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  font-size: 12px;
  color: #1c1a17;
  transition: border-color .2s, box-shadow .2s;
}
.tw-picker-search-input:focus {
  outline: 0;
  border-color: #3D7BFF;
  box-shadow: 0 0 0 3px rgba(61,123,255,.15);
}
.tw-picker-search-input::placeholder { color: #aaa39a; }
.tw-picker-count {
  font-size: 10px;
  color: #8a8177;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 600;
}
.tw-picker-empty {
  padding: 18px 12px;
  font-size: 12px;
  text-align: center;
  color: #8a8177;
  background: #f6f1e8;
  border-radius: 8px;
}
.tw-picker-empty a { color: #3D7BFF; text-decoration: none; font-weight: 600; }
.tw-picker-empty a:hover { text-decoration: underline; }

.tw-picker-grid {
  display: flex;
  flex-direction: row;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 8px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.tw-picker-grid::-webkit-scrollbar { height: 6px; }
.tw-picker-grid::-webkit-scrollbar-thumb { background: rgba(28,26,23,.18); border-radius: 999px; }

.tw-tile {
  position: relative;
  flex: 0 0 90px;
  width: 90px;
  border: 2px solid rgba(28,26,23,.08);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  background: #fff;
  transition: border-color .2s, transform .2s;
  scroll-snap-align: start;
}
.tw-tile:hover { border-color: #c45a2f; transform: translateY(-2px); }
.tw-tile.is-active { border-color: #1c1a17; }
.tw-tile img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.tw-skeleton {
  flex: 0 0 90px;
  width: 90px;
  height: 90px;
  background: linear-gradient(90deg, #f3f3f5 0%, #ebebee 50%, #f3f3f5 100%);
  background-size: 200% 100%;
  animation: tw-shimmer 1.4s infinite;
  border-radius: 10px;
}

@keyframes tw-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.tw-empty-msg {
  grid-column: 1 / -1;
  text-align: center;
  padding: 20px;
  color: #8a8177;
  font-size: 13px;
}

/* Toolbar */
.tw-toolbar[data-show="false"] { display: none; }
.tw-toolbar [data-hidden="true"] { display: none !important; }

/* Delete-selected button — accent style */
.tw-toolbar button[data-action="delete-art"] {
  background: transparent;
  border-color: rgba(196,90,47,.4);
  color: #c45a2f;
}
.tw-toolbar button[data-action="delete-art"]:hover {
  background: #c45a2f;
  border-color: #c45a2f;
  color: #fff;
}

.tw-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid rgba(28,26,23,.1);
}

.tw-toolbar button,
.tw-toolbar a {
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid rgba(28,26,23,.14);
  background: #fff;
  color: #1c1a17;
  text-decoration: none;
  transition: all .2s;
  font-family: inherit;
  line-height: 1;
}
.tw-toolbar button:hover,
.tw-toolbar a:hover {
  border-color: #1c1a17;
}
.tw-toolbar .tw-primary {
  background: #1c1a17;
  color: #f6f1e8;
  border-color: #1c1a17;
  padding: 11px 22px;
}
.tw-toolbar .tw-primary:hover {
  background: #2c2c30;
  transform: translateY(-1px);
}
.tw-toolbar .tw-secondary {
  background: transparent;
  border-color: #c45a2f;
  color: #c45a2f;
}
.tw-toolbar .tw-secondary:hover { background: #c45a2f; color: #fff; }
.tw-toolbar .tw-secondary[data-disabled="true"] {
  opacity: .35;
  pointer-events: none;
}

/* Toast */
.tw-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1c1a17;
  color: #f6f1e8;
  padding: 14px 24px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: all .25s;
  z-index: 99999;
  box-shadow: 0 8px 30px rgba(0,0,0,.25);
}
.tw-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Desktop layout — canvas | vertical picker, toolbar full-width below */
@media (min-width: 769px) {
  .tw-app {
    display: grid;
    grid-template-columns: 1fr 130px;
    grid-template-rows: auto auto;
    gap: 16px;
    align-items: start;
  }
  .tw-canvas-wrap {
    grid-column: 1;
    grid-row: 1;
    aspect-ratio: 16 / 11;
  }
  .tw-controls {
    display: contents;
  }
  .tw-picker {
    grid-column: 2;
    grid-row: 1;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: 100%;
  }
  .tw-picker-head {
    margin-bottom: 10px;
    flex: 0 0 auto;
  }
  .tw-picker-grid {
    flex: 1 1 0;
    min-height: 0;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 2px 4px 2px 2px;
    scroll-snap-type: y mandatory;
    max-height: 70vh;
  }
  .tw-tile, .tw-skeleton {
    flex: 0 0 auto;
    width: 100%;
    scroll-snap-align: start;
  }
  .tw-tile img {
    aspect-ratio: 1;
  }
  .tw-toolbar {
    grid-column: 1 / -1;
    grid-row: 2;
    border-top: 0;
    padding-top: 0;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .tw-canvas-wrap { aspect-ratio: 3 / 4; }
  .tw-toolbar { justify-content: center; }
  .tw-empty-title { font-size: 20px; }
  .tw-tile, .tw-skeleton { flex: 0 0 72px; width: 72px; height: 72px; }
}

@media (max-width: 480px) {
  .tw-toolbar button, .tw-toolbar a { font-size: 12px; padding: 9px 14px; }
  .tw-toolbar .tw-primary { padding: 10px 18px; }
}
