/* Layer list, individual text grid, text advanced controls, and switch controls. */
.td-stamp-picker.is-revealed {
  animation: td-stamp-picker-reveal 1.1s ease-out;
}

@keyframes td-stamp-picker-reveal {
  0% {
    border-color: #7bbcff;
    background: #f3f9ff;
  }
  100% {
    border-color: #d8dce3;
    background: #fff;
  }
}

.td-layer-panel {
  max-height: 0;
  margin: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: max-height .24s cubic-bezier(.2, .8, .2, 1), opacity .18s ease, margin .18s ease, visibility 0s linear .24s;
}

.td-layer-panel.is-open {
  max-height: 290px;
  margin: 0 0 12px;
  opacity: 1;
  visibility: visible;
  transition: max-height .24s cubic-bezier(.2, .8, .2, 1), opacity .18s ease, margin .18s ease, visibility 0s;
}

.td-layer-panel-standalone,
.td-layer-panel-standalone.is-open {
  display: flex;
  max-height: none;
  height: 100%;
  margin: 0;
  overflow: visible;
  padding: 18px 14px 18px 18px;
  box-sizing: border-box;
  opacity: 1;
  visibility: visible;
  transition: none;
}

.td-layer-panel-inner {
  min-height: 0;
  overflow: hidden;
  border: 1px solid #d8dce3;
  border-radius: 8px;
  background: #fbfbfc;
  padding: 12px;
}

.td-layer-panel-standalone .td-layer-panel-inner {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  border: 1px solid #d8dce3;
  border-radius: 8px;
  background: #fbfbfc;
  padding: 12px;
}

.td-layer-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: #6d6669;
  font-size: 12px;
  font-weight: 900;
}

.td-layer-list {
  display: grid;
  gap: 8px;
  max-height: 210px;
  overflow-y: auto;
  padding-right: 2px;
}

.td-layer-panel-standalone .td-layer-list {
  align-content: start;
  flex: 1 1 auto;
  max-height: none;
  min-height: 0;
}

.td-layer-row {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto 30px 30px 30px;
  gap: 6px;
  align-items: center;
  border: 1px solid #e0d9d6;
  border-radius: 7px;
  background: #fff;
  padding: 6px;
  cursor: grab;
  transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.td-layer-row:active {
  cursor: grabbing;
}

.td-layer-row.is-active {
  border-color: #8fc5ff;
  background: #f3f9ff;
  box-shadow: 0 0 0 2px rgba(91, 182, 255, .12);
}

.td-layer-row.is-child {
  margin-left: 28px;
  border-color: #ebe5e2;
  background: #fff;
}

.td-layer-group-row {
  border-color: #8b4dff;
  background: #f7f2ff;
}

.td-layer-group-row.is-active {
  border-color: #8b4dff;
  background: #f3ecff;
  box-shadow: 0 0 0 2px rgba(139, 77, 255, .18);
}

.td-layer-group-toggle {
  color: #241f20;
  font-size: 18px;
  font-weight: 900;
}

.td-layer-group-row .td-layer-label {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.td-layer-row.is-dragging {
  opacity: .55;
}

.td-layer-row.is-hidden .td-layer-name {
  opacity: .48;
}

.td-layer-row.is-locked .td-layer-name {
  opacity: .82;
}

.td-layer-grip {
  position: relative;
  width: 24px;
  height: 30px;
}

.td-layer-grip::before {
  position: absolute;
  top: 8px;
  left: 7px;
  width: 3px;
  height: 3px;
  border-radius: 999px;
  background: #9aa2af;
  box-shadow:
    0 7px 0 #9aa2af,
    0 14px 0 #9aa2af,
    7px 0 0 #9aa2af,
    7px 7px 0 #9aa2af,
    7px 14px 0 #9aa2af;
  content: "";
}

.td-layer-name {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
  border: 0;
  background: transparent;
  color: #241f20;
  cursor: pointer;
  padding: 4px;
  text-align: left;
}

.td-layer-type {
  border-radius: 999px;
  background: #f1ece9;
  color: #6d6669;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 900;
}

.td-layer-label {
  display: -webkit-box;
  overflow: hidden;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.td-layer-media {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.td-layer-thumb {
  display: grid;
  width: 26px;
  height: 26px;
  overflow: hidden;
  border: 1px solid #e2ddda;
  border-radius: 6px;
  background: #fff;
  color: #9f315b;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  place-items: center;
}

.td-layer-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.td-layer-media-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.td-layer-move-controls {
  display: inline-grid;
  grid-template-columns: repeat(2, 24px);
  gap: 2px;
}

.td-layer-move {
  display: grid;
  width: 24px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #5b5558;
  cursor: pointer;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
  padding: 0;
  place-items: center;
}

.td-layer-move:hover,
.td-layer-move:focus-visible {
  background: #f1ece9;
  color: #241f20;
}

.td-layer-move:focus-visible {
  outline: 2px solid #0b84ff;
  outline-offset: 2px;
}

.td-layer-move:disabled {
  color: #c6c0c3;
  cursor: not-allowed;
}

.td-layer-move:disabled:hover {
  background: transparent;
  color: #c6c0c3;
}

.td-layer-lock,
.td-layer-visibility,
.td-layer-delete {
  display: grid;
  width: 30px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #5b5558;
  cursor: pointer;
  padding: 0;
  place-items: center;
}

.td-layer-lock:hover,
.td-layer-lock:focus-visible,
.td-layer-visibility:hover,
.td-layer-visibility:focus-visible,
.td-layer-delete:hover,
.td-layer-delete:focus-visible {
  background: #f1ece9;
  color: #241f20;
}

.td-layer-lock:focus-visible,
.td-layer-visibility:focus-visible,
.td-layer-delete:focus-visible {
  outline: 2px solid #0b84ff;
  outline-offset: 2px;
}

.td-layer-visibility.is-hidden {
  color: #9a9296;
}

.td-layer-lock.is-locked {
  color: #9f315b;
}

.td-layer-delete:hover,
.td-layer-delete:focus-visible {
  color: #b5364d;
}

.td-layer-delete:disabled,
.td-layer-delete.is-disabled {
  color: #c6c0c3;
  cursor: not-allowed;
}

.td-layer-delete:disabled:hover,
.td-layer-delete.is-disabled:hover {
  background: transparent;
  color: #c6c0c3;
}

.td-layer-lock-svg,
.td-layer-visibility-svg,
.td-layer-delete-svg {
  display: block;
  width: 21px;
  height: 21px;
  fill: currentColor;
}

.td-grid-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  padding: 3px 2px 2px;
}

.td-cell-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -4px 0 14px;
}

.td-cell-toolbar .td-button {
  min-height: 36px;
  padding: 8px 11px;
  font-size: 13px;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, opacity .18s ease;
}

.td-grid {
  display: grid;
  gap: 8px;
  width: max-content;
  min-width: 100%;
}

.td-grid-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 56px;
  gap: 8px;
  align-items: center;
}

.td-grid-header-row {
  margin-bottom: 2px;
}

.td-grid-corner,
.td-column-label,
.td-row-label,
.td-cell {
  width: 56px;
  height: 56px;
}

.td-grid-corner {
  pointer-events: none;
}

.td-grid-header-row .td-grid-corner {
  height: 38px;
}

.td-column-label,
.td-row-label {
  appearance: none;
  display: grid;
  border: 1px solid #d3d9e1;
  border-radius: 6px;
  background: #f3f6f9;
  color: #55606b;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  place-items: center;
  transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease, color .18s ease;
}

.td-column-label {
  height: 38px;
}

.td-column-label:disabled {
  cursor: default;
  opacity: .48;
}

.td-column-label:disabled:hover {
  border-color: #d3d9e1;
  background: #f3f6f9;
}

.td-column-label:focus-visible,
.td-row-label:focus-visible {
  outline: 2px solid #0b84ff;
  outline-offset: 2px;
}

.td-column-label:hover,
.td-row-label:hover {
  border-color: #a8c8e8;
  background: #f8fbff;
}

.td-column-label.is-selected,
.td-row-label.is-selected {
  border-color: #5bb6ff;
  background: #e8f5ff;
  box-shadow: 0 0 0 2px rgba(91, 182, 255, .18);
  color: #2b5f91;
}

.td-cell {
  position: relative;
  border: 1px solid #dce3ea;
  border-radius: 8px;
  background: #fbfdff;
  color: #2b3440;
  cursor: pointer;
  font-weight: 900;
  transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease, color .18s ease, transform .18s ease;
}

.td-cell:hover {
  border-color: #a8c8e8;
  transform: translateY(-1px);
}

.td-cell.is-selected {
  border-color: #5bb6ff;
  background: #e8f5ff;
  box-shadow: 0 0 0 2px rgba(91, 182, 255, .18);
}

.td-cell.is-whitespace .td-cell-char {
  color: #9ba6b2;
  font-size: 12px;
}

.td-cell-char {
  display: block;
  font-size: 25px;
  line-height: 1;
}

.td-cell-asset {
  display: block;
  width: 38px;
  height: 38px;
  margin: auto;
  object-fit: contain;
  pointer-events: none;
}

.td-cell-icon {
  display: block;
  width: 32px;
  height: 32px;
  margin: auto;
  fill: currentColor;
  pointer-events: none;
}

.td-cell-badge {
  position: absolute;
  right: 8px;
  bottom: 7px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #b94778;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .9);
  pointer-events: none;
}

.td-selected-count {
  min-width: 72px;
  border-radius: 999px;
  background: #eef6ff;
  color: #2d5d91;
  padding: 6px 10px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
}

.td-field {
  margin-bottom: 14px;
}

.td-depth-controls {
  margin: 0 0 16px;
}

.td-depth-button-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.td-depth-button {
  min-width: 0;
  min-height: 40px;
  border: 1px solid #e1d9dd;
  border-radius: 7px;
  background: #fff;
  color: #332d2f;
  cursor: pointer;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
  white-space: nowrap;
}

.td-depth-button:hover:not(:disabled),
.td-depth-button:focus-visible {
  border-color: #d56f98;
  background: #fff7fa;
  color: #9f315b;
}

.td-depth-button:focus-visible {
  outline: 2px solid #0b84ff;
  outline-offset: 2px;
}

.td-depth-button:disabled {
  background: #f5f2f3;
  color: #b9afb4;
  cursor: not-allowed;
}

.td-text-advanced {
  margin-top: 12px;
  overflow: visible;
  border: 1px solid #e2dcd9;
  border-radius: 8px;
  background: #fff;
}

.td-text-advanced-body {
  border-top: 0;
  padding: 12px;
}

.td-text-style-field {
  margin-bottom: 16px;
}

.td-text-style-toggle-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.td-text-style-toggle {
  display: grid;
  min-width: 0;
  min-height: 38px;
  border: 1px solid #ded6d2;
  border-radius: 7px;
  background: #fff;
  color: #3f383b;
  cursor: pointer;
  place-items: center;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease;
}

.td-text-style-toggle:hover {
  border-color: #cbbfba;
  background: #fbfbfc;
}

.td-text-style-toggle.is-active {
  border-color: #9f315b;
  background: #fff4f8;
  color: #9f315b;
  box-shadow: inset 0 0 0 1px rgba(159, 49, 91, .16);
}

.td-text-style-toggle:focus-visible {
  outline: 2px solid #0b84ff;
  outline-offset: 2px;
}

.td-text-style-toggle-mark {
  display: inline-grid;
  min-width: 1.2em;
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
  place-items: center;
}

.td-text-style-toggle:nth-child(2) .td-text-style-toggle-mark {
  font-style: italic;
}

.td-text-style-toggle:nth-child(3) .td-text-style-toggle-mark {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.td-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 10px;
  border-radius: 7px;
  background: #f1ece9;
  padding: 4px;
}

.td-mode-tab {
  min-height: 38px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #5c5356;
  cursor: pointer;
  font-weight: 900;
  transition: background-color .2s ease, color .2s ease, box-shadow .2s ease;
}

.td-mode-tab.is-active {
  background: #fff;
  color: #241f20;
  box-shadow: 0 1px 2px rgba(36, 31, 32, .08);
}

.td-mode-status {
  margin: 0 0 14px;
  color: #6d6669;
  font-size: 12px;
  font-weight: 700;
}

.td-global-note {
  margin: 0 0 14px;
  border-radius: 6px;
  background: #f3f6f9;
  color: #55606b;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 700;
}

.td-checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  color: #332d2f;
  cursor: pointer;
  font-size: 14px;
  font-weight: 900;
}

.td-checkbox-row input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #9f315b;
}

.td-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  margin: 0 0 16px;
  border: 1px solid #e0d9d6;
  border-radius: 8px;
  background: #fbfbfc;
  color: #332d2f;
  cursor: pointer;
  padding: 13px 14px;
  text-align: left;
  transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.td-switch-row:hover {
  border-color: #d0c5c1;
  background: #fff;
}

.td-switch-title {
  min-width: 0;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.4;
}

.td-switch-control {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 10px;
}

.td-switch-state {
  min-width: 28px;
  color: #6c7481;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  text-align: right;
}

.td-switch-track {
  position: relative;
  display: block;
  width: 50px;
  height: 28px;
  border-radius: 999px;
  background: #d5dae2;
  transition: background-color .2s ease;
}

.td-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 5px rgba(36, 31, 32, .22);
  transition: transform .2s cubic-bezier(.2, .8, .2, 1);
}

.td-switch-row.is-on .td-switch-track {
  background: #9f6b93;
}

.td-shadow-card.is-on .td-switch-track {
  background: #9f6b93;
}

.td-switch-row.is-on .td-switch-thumb {
  transform: translateX(22px);
}

.td-shadow-card.is-on .td-switch-thumb {
  transform: translateX(22px);
}

.td-switch-row:focus-visible {
  outline: 2px solid #0b84ff;
  outline-offset: 2px;
}

.td-switch-row.is-locked {
  cursor: default;
}

.td-switch-row.is-locked .td-switch-title::after {
  content: "（比率固定）";
  margin-left: 6px;
  color: #8a7f84;
  font-size: 11px;
  font-weight: 800;
}
