.tile-studio {
  position: fixed;
  z-index: 2147483647 !important;
  left: 16px;
  bottom: 16px;
  width: min(880px, calc(100vw - 32px));
  border: 1px solid #b5a98f;
  border-radius: 14px;
  background: #f5efdf;
  color: #292720;
  font: 500 13px/1.45 Inter, sans-serif;
  box-shadow: 0 12px 34px rgba(24, 21, 15, .38);
  max-height: min(84vh, 760px);
  overflow: auto;
  transition: width .2s ease;
  color-scheme: light;
}
.tile-studio.is-collapsed {
  width: 46px;
  max-height: 46px;
  left: 20px;
  right: auto;
  top: auto;
  bottom: 22px;
  overflow: visible;
  border: 0;
  border-radius: 7px;
  background: #f5efdf;
  box-shadow: none;
}
body[data-tile-interaction-enabled="false"] #stage1 .mosaic-coordinate-grid { display: none; }
body.tile-grid-hidden #stage1 .mosaic-coordinate > span,
body:not([data-tile-studio-admin="true"]) #stage1 .mosaic-coordinate > span { visibility: hidden; }
body:not([data-tile-studio-admin="true"]) #stage1 .home-mosaic-surface[data-mosaic-shape="shape-1"] > .mosaic-block,
body:not([data-tile-studio-admin="true"]) #stage1 .home-mosaic-surface[data-mosaic-shape="shape-1"] .mosaic-top-extension > .mosaic-block { box-shadow: none; }
.tile-grid-hidden .home-mosaic-surface[data-mosaic-shape="shape-1"] > .mosaic-block,
.tile-grid-hidden .home-mosaic-surface[data-mosaic-shape="shape-1"] .mosaic-top-extension > .mosaic-block { box-shadow: none; }
.tile-studio-frame-catcher { position: absolute; z-index: 4; top: -33.333333%; left: 0; width: 100%; height: 133.333333%; display: none; cursor: grab; touch-action: none; }
.tile-studio-frame-catcher:active { cursor: grabbing; }
body.tile-studio-frame-dragging #stage1 .tile-studio-frame-catcher { display: block; }
body.tile-studio-frame-dragging #stage1 .mosaic-coordinate-grid { pointer-events: none; }
body.tile-studio-frame-dragging #stage1 .home-mosaic-surface .mosaic-block { pointer-events: none !important; }
.tile-studio-header {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 9px 12px 9px 16px;
  border-bottom: 1px solid #d5cbb7;
  background: #eee5d2;
  cursor: move;
  touch-action: none;
  user-select: none;
}
.tile-studio.is-collapsed .tile-studio-header {
  width: 46px;
  min-height: 46px;
  height: 46px;
  justify-content: center;
  padding: 0;
  border: 0;
  background: #f5efdf;
  cursor: grab;
}
.tile-studio.is-collapsed .tile-studio-header strong,
.tile-studio.is-collapsed .tile-studio-header output { display: none; }
.tile-studio-header strong { flex: 1; font-size: 15px; font-weight: 750; letter-spacing: .01em; }
.tile-studio .globe-video-time {
  padding: 5px 9px;
  border: 1px solid #d3c7b1;
  border-radius: 7px;
  background: #fffaf0;
  color: #4a453b;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.tile-studio-collapse {
  width: 26px;
  height: 26px;
  border: 1px solid #b7aa91;
  border-radius: 6px;
  background: #fffaf0;
  color: #292720;
  cursor: pointer;
  font-size: 17px;
}
.tile-studio.is-collapsed .tile-studio-collapse {
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid #FFD21A;
  border-radius: 7px;
  background: #FFC400;
  color: #171219;
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  cursor: grab;
  touch-action: none;
}
.tile-studio.is-collapsed .tile-studio-collapse:active { cursor: grabbing; }
.tile-studio-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 10px;
  padding: 12px;
}
.tile-studio.is-collapsed .tile-studio-body { display: none; }
.tile-studio-control,
.tile-studio-device-options {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid #d4c9b4;
  border-radius: 9px;
  background: #fffaf0;
  color: #312e27;
}
.tile-studio-skin-strength {
  grid-column: 1 / -1;
  display: grid;
  gap: 5px;
  padding: 8px 10px;
  border: 1px solid #d4c9b4;
  border-radius: 9px;
  background: #fffaf0;
  color: #312e27;
}
.tile-studio-skin-strength-heading,
.tile-studio-skin-strength-scale {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.tile-studio-skin-strength-heading { font-weight: 650; }
.tile-studio-skin-strength-value,
.tile-studio-heading-width-value,
.tile-studio-subheading-width-value { font-variant-numeric: tabular-nums; }
.tile-studio-skin-strength-slider,
.tile-studio-heading-width-slider,
.tile-studio-subheading-width-slider { width: 100%; margin: 3px 0 0; accent-color: #7a4c80; }
.tile-studio-skin-strength-scale { color: #665e50; font-size: 11px; }
.tile-studio-skin-strength-slider:disabled,
.tile-studio-heading-width-slider:disabled,
.tile-studio-subheading-width-slider:disabled { opacity: .5; }
.tile-studio-control select { margin-left: auto; min-width: 145px; }
.tile-studio input[type="checkbox"] { accent-color: #b27b00; }
.tile-studio input[type="number"], .tile-studio select {
  min-height: 36px;
  padding: 6px 9px;
  border: 1px solid #bdb19a;
  border-radius: 7px;
  background: #fffdf8;
  color: #292720;
}
.tile-studio-time-row {
  grid-column: 1 / -1;
  display: grid;
  gap: 9px;
  padding: 11px;
  border: 1px solid #d2c7b1;
  border-radius: 10px;
  background: #eee6d6;
}
.tile-studio-timeline { position: relative; min-height: 28px; }
.tile-studio button:not(.tile-studio-collapse) {
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid #b8ac94;
  border-radius: 7px;
  background: #e8dfce;
  color: #292720;
  cursor: pointer;
}
.tile-studio button:hover { border-color: #a56d00; background: #f4e3b2; }
.tile-studio :focus-visible { outline: 3px solid #8a5d00; outline-offset: 2px; }
.tile-studio-file-label:focus-within { outline: 3px solid #8a5d00; outline-offset: 2px; }
.tile-studio-table-wrap {
  grid-column: 1 / -1;
  max-width: 100%;
  overflow: auto;
  border: 1px solid #c9bda6;
  border-radius: 9px;
  background: #fffaf0;
}
.tile-studio-table { width: 100%; min-width: 660px; border-collapse: collapse; font-size: 12px; }
.tile-studio-table th, .tile-studio-table td { padding: 9px 8px; border-bottom: 1px solid #ded5c4; text-align: left; vertical-align: middle; }
.tile-studio-table th { position: sticky; top: 0; z-index: 1; background: #e9dfcb; color: #403a30; font-weight: 750; }
.tile-studio-table tbody tr { background: #fffaf0; }
.tile-studio-table tbody tr:nth-child(even) { background: #f8f2e7; }
.tile-studio-table tbody tr:last-child td { border-bottom: 0; }
.tile-studio-table input[type="number"] { width: 68px; }
.tile-studio-row-drag-handle { min-width: 30px; margin-right: 4px; padding: 2px !important; border: 0 !important; background: #eee5d2 !important; color: #50483a !important; cursor: grab !important; touch-action: none; font-size: 15px !important; line-height: 1; }
.tile-studio-row-drag-handle:active { cursor: grabbing !important; }
.tile-studio-keyframe.is-row-dragging { outline: 2px solid #b27b00; }
.tile-studio-keyframe.is-drop-target.drop-before td { border-top: 2px solid #FFC400; }
.tile-studio-keyframe.is-drop-target.drop-after td { border-bottom: 2px solid #FFC400; }
.tile-studio-table td:last-child { white-space: normal; }
.tile-studio-table td:last-child button { min-height: 32px; padding: 5px 7px !important; font-size: 11px; }
.tile-studio-table td:nth-child(2) { min-width: 190px; max-width: 340px; }
.tile-studio-source-name { display: block; max-width: 340px; overflow-wrap: anywhere; white-space: normal; font-weight: 650; }
.tile-studio-original-length { display: block; white-space: nowrap; }
.tile-studio-show-duration { display: flex; align-items: center; gap: 3px; margin-top: 4px; white-space: nowrap; }
.tile-studio-show-duration input[type="number"] { width: 52px; padding: 3px 4px; }
.tile-studio-file-label { display: inline-block; margin: 5px 5px 0 0; padding: 4px 7px; border: 1px solid #c2a867; border-radius: 6px; background: #fff1c8; color: #674600; cursor: pointer; font-weight: 650; }
.tile-studio-fallback-label { display: block; }
.tile-studio-file-label input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.tile-studio-media-layer { z-index: 0 !important; object-fit: cover; }
.tile-studio-fallback-layer { z-index: 0 !important; object-fit: cover; }
.tile-studio-source-enter { animation: tile-studio-source-arrive .75s cubic-bezier(.22, 1, .36, 1) var(--source-stagger, 0ms) both; }
@keyframes tile-studio-source-arrive {
  from { opacity: 0; }
  to { opacity: .88; }
}
@media (prefers-reduced-motion: reduce) {
  .tile-studio-source-enter { animation: none; }
}
.tile-studio-frame-editor { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin: 0; padding: 12px; border: 1px solid #c9bda6; border-radius: 10px; background: #fffaf0; }
.tile-studio-frame-editor legend { padding: 0 5px; font-weight: 700; }
.tile-studio-frame-editor legend span { margin-left: 5px; color: #8a5d00; font-weight: 650; }
.tile-studio-frame-editor > label { display: grid; grid-template-columns: 68px 1fr auto; align-items: center; gap: 6px; }
.tile-studio-frame-editor select { width: 100%; }
.tile-studio-frame-editor input[type="range"] { min-width: 0; width: 100%; accent-color: #FFC400; }
.tile-studio-frame-editor output { min-width: 40px; text-align: right; color: #50483a; font-variant-numeric: tabular-nums; }
.tile-studio-frame-actions { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tile-studio-frame-actions label { display: flex; align-items: center; gap: 6px; }
.tile-studio-frame-reset { padding: 4px 7px !important; }
.tile-studio-frame-note { grid-column: 1 / -1; color: #5e574a; }
.tile-studio-playback { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.tile-studio-playback small { margin-left: auto; color: #5e574a; font-size: 11px; }
.tile-studio-markers { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.tile-studio-marker {
  position: absolute;
  top: -2px;
  transform: translateX(-50%);
  padding: 0 !important;
  width: 14px;
  height: 18px;
  border: 0 !important;
  background: #f5e6bf !important;
  color: #765000 !important;
  line-height: 18px;
  font-size: 12px;
  pointer-events: auto;
  text-shadow: none;
}
.tile-studio-marker:hover { color: #292720 !important; }
.tile-studio-options { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 10px; border: 1px solid #d4c9b4; border-radius: 9px; background: #fffaf0; }
.tile-studio-device-options { display: flex; align-items: center; gap: 6px; }
.tile-studio-device-options { grid-column: 1 / -1; }
.tile-studio-device-options span { margin-right: 4px; color: #514a3e; font-weight: 650; }
.tile-studio-device-toggle { padding: 4px 9px !important; }
.tile-studio-device-toggle.is-active { border-color: #a66d00; background: #f2c650; color: #30240c; }
.tile-studio-options label:first-child { display: flex; align-items: center; gap: 6px; }
.tile-studio-duration { width: 82px; }
.tile-studio-status { grid-column: 1 / -1; min-height: 1em; padding: 9px 11px; border: 1px solid #d4c9b4; border-radius: 8px; background: #fffaf0; color: #514a3e; }
.tile-studio-save-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding-top: 10px; border-top: 1px solid #d1c6b1; }
.tile-studio-logout { display: flex; justify-content: flex-end; }
.tile-studio-logout button { min-height: 32px; padding: 4px 8px !important; font-size: 11px; }
.tile-studio-save-actions button.tile-studio-commit { border-color: #8c6000; background: #f2c650; color: #30240c; font-weight: 750; }
.tile-studio button:disabled { border-color: #c9c1b2; background: #e6e0d4; color: #777064; cursor: not-allowed; }
.tile-studio-help { grid-column: 1 / -1; padding: 10px 12px; border: 1px solid #d4c9b4; border-radius: 8px; background: #eee6d6; color: #514a3e; line-height: 1.5; }
.tile-studio .globe-video-seek {
  position: absolute;
  inset: 2px 0 auto;
  min-width: 0;
  width: 100%;
  height: 16px;
  margin: 0;
  z-index: 1;
  accent-color: #FFC400;
  cursor: pointer;
}

@media (max-width: 640px) {
  .tile-studio {
    left: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    width: calc(100vw - 16px);
    max-height: min(84vh, 84dvh);
    border-radius: 12px;
  }
  .tile-studio.is-collapsed {
    left: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    width: 46px;
    max-height: 46px;
  }
  .tile-studio-header { min-height: 48px; padding: 7px 9px 7px 12px; }
  .tile-studio-header strong { font-size: 14px; }
  .tile-studio-body { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 9px; }
  .tile-studio-control,
  .tile-studio-device-options,
  .tile-studio-time-row,
  .tile-studio-table-wrap,
  .tile-studio-frame-editor,
  .tile-studio-options,
  .tile-studio-help,
  .tile-studio-save-actions,
  .tile-studio-status { grid-column: 1; }
  .tile-studio-control { justify-content: flex-start; min-height: 44px; }
  .tile-studio-control select { min-width: 0; max-width: 58%; }
  .tile-studio-device-options { flex-wrap: wrap; }
  .tile-studio-time-row { padding: 9px; }
  .tile-studio-playback small { flex: 1 0 100%; margin: 2px 0 0; }
  .tile-studio-add-keyframe,
  .tile-studio-add-source { width: 100%; }
  .tile-studio-table-wrap { overflow: visible; border: 0; background: #f5efdf; }
  .tile-studio-table { display: block; min-width: 0; font-size: 12px; }
  .tile-studio-table thead { display: none; }
  .tile-studio-table tbody { display: grid; gap: 8px; }
  .tile-studio-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 7px 9px;
    padding: 10px;
    border: 1px solid #cfc3ad;
    border-radius: 9px;
    background: #fffaf0;
  }
  .tile-studio-table tbody tr:nth-child(even) { background: #f8f2e7; }
  .tile-studio-table tbody tr:not(.tile-studio-keyframe) { display: block; }
  .tile-studio-table td {
    min-width: 0;
    padding: 3px 0;
    border: 0;
    overflow-wrap: anywhere;
  }
  .tile-studio-table td::before {
    display: block;
    margin-bottom: 3px;
    color: #655b49;
    font-size: 10px;
    font-weight: 750;
    letter-spacing: .04em;
    text-transform: uppercase;
  }
  .tile-studio-table td:nth-child(1)::before { content: "Timeframe"; }
  .tile-studio-table td:nth-child(2) { grid-column: 1 / -1; max-width: none; }
  .tile-studio-table td:nth-child(2)::before { content: "Content source"; }
  .tile-studio-table td:nth-child(3)::before { content: "Type"; }
  .tile-studio-table td:nth-child(4)::before { content: "Length / show for"; }
  .tile-studio-table td:nth-child(5) { grid-column: 1 / -1; }
  .tile-studio-table td:nth-child(5)::before { content: "Actions"; }
  .tile-studio-table td:last-child { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
  .tile-studio-table td:last-child::before { flex-basis: 100%; }
  .tile-studio-table td:last-child button { font-size: 12px; }
  .tile-studio-frame-editor { grid-template-columns: minmax(0, 1fr); gap: 9px; padding: 10px; }
  .tile-studio-frame-editor > label { grid-template-columns: 68px minmax(0, 1fr) auto; gap: 7px; }
  .tile-studio-frame-actions { align-items: flex-start; flex-wrap: wrap; }
  .tile-studio-frame-note { font-size: 11px; }
  .tile-studio-options { align-items: flex-start; flex-direction: column; }
  .tile-studio-save-actions { justify-content: stretch; }
  .tile-studio-save-actions button { flex: 1 1 42%; }
}
