/* GIF workspace only; fixed hero, article and meta remain shared-owned. */
.tn-gif-page {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
}

.tn-gif-page .tn-gif-ad {
  width: min(900px, 100%);
  min-height: 90px;
  margin: 18px auto;
}

.tn-gif-page .tn-gif-ad--top {
  margin: 54px auto 40px;
}

.tn-gif-tool {
  --gif-ink: #1a1208;
  --gif-muted: #5a4a30;
  --gif-line: #b8a888;
  --gif-soft: #ddd4be;
  --gif-paper: #faf6ee;
  --gif-wash: #f5efdf;
  --gif-control: #fffaf1;
  --gif-checker: #e8dfcf;
  --gif-accent: #a43e00;
  --gif-error: #a1251b;
  --gif-primary: #6a3b1f;
  --gif-primary-hover: #824826;
  --gif-primary-text: #f7ead1;
  --gif-secondary: #ede6d4;
  --gif-secondary-hover: #dfd4bb;
  --gif-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans KR", sans-serif;
  --gif-mono: "Courier New", Courier, monospace;
  display: block;
  min-width: 0;
  margin: 0 auto 18px;
  border-top: 2px solid var(--gif-ink);
  border-bottom: 1px solid var(--gif-line);
  background: var(--gif-paper);
  color: var(--gif-ink);
  -webkit-text-fill-color: var(--gif-ink);
  color-scheme: light;
  font-family: var(--gif-sans);
}

.tn-gif-tool,
.tn-gif-tool * {
  box-sizing: border-box;
}

.tn-gif-tool [hidden] {
  display: none !important;
}

.tn-gif-tool :is(code, pre, kbd, samp) {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  -webkit-text-fill-color: inherit;
  box-shadow: none;
}

.tn-gif-tool :is(ul, ol, li) {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tn-gif-tool .tn-gif-drop {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 8px;
  min-height: 120px;
  margin: 14px;
  padding: 14px;
  border: 1px dashed var(--gif-line);
  background: var(--gif-wash);
  text-align: center;
}

.tn-gif-tool .tn-gif-drop.tn-gif-drop-active {
  border-color: var(--gif-accent);
  outline: 2px solid var(--gif-accent);
  outline-offset: 2px;
  background: var(--gif-secondary);
}

.tn-gif-tool .tn-gif-workspace {
  display: grid;
  grid-template-columns: 275px minmax(0, 1fr);
  min-width: 0;
  border-top: 1px solid var(--gif-line);
}

.tn-gif-tool .tn-gif-controls,
.tn-gif-tool .tn-gif-preview,
.tn-gif-tool .tn-gif-timeline {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  margin: 0;
  padding: 14px;
}

.tn-gif-tool .tn-gif-controls {
  border-right: 1px solid var(--gif-line);
  background: var(--gif-wash);
}

.tn-gif-tool .tn-gif-preview {
  align-content: center;
}

.tn-gif-tool .tn-gif-preview > figure {
  display: grid;
  gap: 10px;
  min-width: 0;
  margin: 0;
}

.tn-gif-tool .tn-gif-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.tn-gif-tool .tn-gif-field {
  display: grid;
  align-content: start;
  gap: 5px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.tn-gif-tool .tn-gif-field label {
  display: block;
  margin: 0;
  padding: 0;
  color: var(--gif-muted);
  -webkit-text-fill-color: var(--gif-muted);
  font: 700 12px/1.4 var(--gif-mono);
}

.tn-gif-tool .tn-gif-field input,
.tn-gif-tool .tn-gif-field select {
  display: block;
  width: 100%;
  min-width: 0;
  height: 38px;
  min-height: 38px;
  margin: 0;
  padding: 0 10px;
  border: 1px solid var(--gif-line);
  border-radius: 0;
  background-color: var(--gif-control);
  color: var(--gif-ink);
  -webkit-text-fill-color: var(--gif-ink);
  box-shadow: none;
  font: 600 14px/1.3 var(--gif-sans);
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: normal;
  outline: none;
}

.tn-gif-tool .tn-gif-field select {
  appearance: none;
  padding-right: 28px;
  background-image: linear-gradient(45deg, transparent 50%, var(--gif-muted) 50%), linear-gradient(135deg, var(--gif-muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 16px, calc(100% - 10px) 16px;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.tn-gif-tool .tn-gif-field option {
  background: var(--gif-control);
  color: var(--gif-ink);
  -webkit-text-fill-color: var(--gif-ink);
}

.tn-gif-tool .tn-gif-field input::placeholder {
  color: var(--gif-ink);
  -webkit-text-fill-color: var(--gif-ink);
  opacity: 0.35;
  font-weight: 400;
}

.tn-gif-tool .tn-gif-field [aria-invalid="true"] {
  border-color: var(--gif-error);
}

.tn-gif-tool .tn-gif-hint,
.tn-gif-tool .tn-gif-summary,
.tn-gif-tool .tn-gif-status {
  min-width: 0;
  margin: 0;
  padding: 0;
  color: var(--gif-muted);
  -webkit-text-fill-color: var(--gif-muted);
  overflow-wrap: anywhere;
  font: 400 12px/1.65 var(--gif-sans);
}

.tn-gif-tool .tn-gif-summary {
  color: var(--gif-ink);
  -webkit-text-fill-color: var(--gif-ink);
  font: 800 14px/1.5 var(--gif-sans);
  font-variant-numeric: lining-nums tabular-nums;
  text-align: center;
}

.tn-gif-tool .tn-gif-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin: 0;
}

.tn-gif-tool .tn-gif-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  flex: 0 0 auto;
  width: auto;
  height: 38px;
  min-height: 38px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid var(--gif-line);
  border-radius: 0;
  background: var(--gif-secondary);
  color: var(--gif-ink);
  -webkit-text-fill-color: var(--gif-ink);
  box-shadow: none;
  font: 900 13px/1 var(--gif-mono);
  letter-spacing: normal;
  text-align: center;
  text-transform: none;
  white-space: nowrap;
  outline: none;
  cursor: pointer;
}

.tn-gif-tool .tn-gif-field > .tn-gif-button {
  width: 100%;
}

.tn-gif-tool .tn-gif-button:hover:not(:disabled),
.tn-gif-tool .tn-gif-button:focus-visible {
  background: var(--gif-secondary-hover);
}

.tn-gif-tool .tn-gif-button--primary {
  border-color: var(--gif-primary);
  background: var(--gif-primary);
  color: var(--gif-primary-text);
  -webkit-text-fill-color: var(--gif-primary-text);
}

.tn-gif-tool .tn-gif-button--primary:hover:not(:disabled),
.tn-gif-tool .tn-gif-button--primary:focus-visible {
  border-color: var(--gif-primary-hover);
  background: var(--gif-primary-hover);
}

.tn-gif-tool .tn-gif-button--delete {
  border-color: var(--gif-error);
}

.tn-gif-tool .tn-gif-button:disabled,
.tn-gif-tool .tn-gif-field :is(input, select):disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tn-gif-tool .tn-gif-button:focus-visible,
.tn-gif-tool .tn-gif-frame:focus-visible,
.tn-gif-tool .tn-gif-field :is(input, select):focus-visible {
  outline: 2px solid var(--gif-accent);
  outline-offset: 2px;
}

.tn-gif-tool .tn-gif-playback {
  justify-content: center;
}

.tn-gif-tool .tn-gif-canvas-wrap {
  display: grid;
  place-items: center;
  width: 100%;
  min-width: 0;
  min-height: 260px;
  padding: 14px;
  border: 1px solid var(--gif-line);
  background-color: var(--gif-control);
  background-image: conic-gradient(var(--gif-checker) 25%, transparent 0 50%, var(--gif-checker) 0 75%, transparent 0);
  background-size: 20px 20px;
}

.tn-gif-tool .tn-gif-canvas-wrap canvas {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 420px;
  object-fit: contain;
  margin: 0;
  border: 0;
  background: transparent;
  filter: none;
  mix-blend-mode: normal;
}

.tn-gif-tool .tn-gif-status {
  padding: 10px;
  border: 1px solid var(--gif-soft);
  background: var(--gif-wash);
}

.tn-gif-tool .tn-gif-status[data-state="error"] {
  border-color: var(--gif-error);
  color: var(--gif-error);
  -webkit-text-fill-color: var(--gif-error);
}

.tn-gif-tool .tn-gif-timeline {
  border-top: 1px solid var(--gif-line);
}

.tn-gif-tool .tn-gif-frames {
  display: flex;
  align-items: stretch;
  gap: 10px;
  width: 100%;
  min-width: 0;
  padding: 4px 4px 10px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--gif-line) var(--gif-wash);
}

.tn-gif-tool .tn-gif-frame {
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 5px;
  flex: 0 0 112px;
  width: 112px;
  min-width: 0;
  min-height: 120px;
  height: auto;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--gif-line);
  border-radius: 0;
  background: var(--gif-control);
  color: var(--gif-ink);
  -webkit-text-fill-color: var(--gif-ink);
  box-shadow: none;
  font: 900 13px/1.3 var(--gif-mono);
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: normal;
  text-transform: none;
  text-align: center;
  outline: none;
  cursor: pointer;
}

.tn-gif-tool .tn-gif-frame img {
  display: block;
  width: 94px;
  height: 62px;
  margin: 0;
  border: 0;
  border-radius: 0;
  object-fit: contain;
  background: var(--gif-wash);
}

.tn-gif-tool .tn-gif-frame span {
  display: block;
  width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--gif-ink);
  -webkit-text-fill-color: var(--gif-ink);
  font: 900 13px/1.3 var(--gif-mono);
}

.tn-gif-tool .tn-gif-frame .tn-gif-frame-detail {
  font: 800 12px/1.3 var(--gif-sans);
  font-variant-numeric: lining-nums tabular-nums;
}

.tn-gif-tool .tn-gif-frame:hover:not(:disabled) {
  background: var(--gif-secondary-hover);
}

.tn-gif-tool .tn-gif-frame[aria-pressed="true"] {
  border: 2px solid var(--gif-accent);
  padding: 7px;
  background: var(--gif-secondary);
}

.tn-gif-tool .tn-gif-frame:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tn-gif-tool .tn-gif-frame-edit {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  min-width: 0;
}

.tn-gif-tool .tn-gif-frame-edit > .tn-gif-field {
  flex: 0 1 180px;
}

body[data-scheme="dark"] .tn-gif-tool,
body[data-scheme="inverse"] .tn-gif-tool,
html[data-scheme="dark"] body:not([data-scheme="light"]) .tn-gif-tool {
  --gif-ink: #f7ead1;
  --gif-muted: #c3b492;
  --gif-line: #826744;
  --gif-soft: #574a37;
  --gif-paper: #241d12;
  --gif-wash: #2a2116;
  --gif-control: #322a1a;
  --gif-checker: #453824;
  --gif-accent: #e8823f;
  --gif-error: #ffb0a0;
  --gif-primary: #6a3b1f;
  --gif-primary-hover: #824826;
  --gif-primary-text: #f7ead1;
  --gif-secondary: #2f2115;
  --gif-secondary-hover: #3a2a1b;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  body[data-scheme="auto"]:not([data-d="light"]) .tn-gif-tool {
    --gif-ink: #f7ead1;
    --gif-muted: #c3b492;
    --gif-line: #826744;
    --gif-soft: #574a37;
    --gif-paper: #241d12;
    --gif-wash: #2a2116;
    --gif-control: #322a1a;
    --gif-checker: #453824;
    --gif-accent: #e8823f;
    --gif-error: #ffb0a0;
    --gif-primary: #6a3b1f;
    --gif-primary-hover: #824826;
    --gif-primary-text: #f7ead1;
    --gif-secondary: #2f2115;
    --gif-secondary-hover: #3a2a1b;
    color-scheme: dark;
  }
}

@media (prefers-color-scheme: light) {
  body[data-scheme="auto"]:is([data-l="dark"], [data-l="inverse"]) .tn-gif-tool {
    --gif-ink: #f7ead1;
    --gif-muted: #c3b492;
    --gif-line: #826744;
    --gif-soft: #574a37;
    --gif-paper: #241d12;
    --gif-wash: #2a2116;
    --gif-control: #322a1a;
    --gif-checker: #453824;
    --gif-accent: #e8823f;
    --gif-error: #ffb0a0;
    --gif-secondary: #2f2115;
    --gif-secondary-hover: #3a2a1b;
    color-scheme: dark;
  }
}

@media (max-width: 760px) {
  .tn-gif-page {
    width: calc(100vw - 10px);
    max-width: 100%;
  }

  .tn-gif-page .tn-gif-ad--top {
    margin-top: 48px;
  }

  .tn-gif-tool .tn-gif-workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .tn-gif-tool .tn-gif-controls {
    border-right: 0;
    border-bottom: 1px solid var(--gif-line);
  }

  .tn-gif-tool .tn-gif-preview {
    align-content: start;
  }

  .tn-gif-tool .tn-gif-canvas-wrap {
    min-height: 0;
    padding: 8px;
  }

  .tn-gif-tool .tn-gif-frame-edit > .tn-gif-field {
    flex-basis: 100%;
  }

  .tn-gif-tool .tn-gif-frame-edit > .tn-gif-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }
}
