/*
 * Twitch Panel Maker common-design adapter
 * The editor keeps its wide workspace while the surrounding page follows
 * the shared nanacona tools design.
 */

/* Restore the common site tokens after the bundled application stylesheet. */
:root {
  --page-bg: #f7f2eb;
  --main-bg: #fbf7f2;
  --surface: #fffdfa;
  --surface-soft: #f5efe7;
  --header-bg: #eee5db;
  --text: #2f2b29;
  --muted: #6f6760;
  --line: #d2c7bc;
  --line-strong: #b8aa9d;
  --accent: #a3584f;
  --accent-hover: #874740;
  --ok: #4d7865;
  --ok-soft: #e8f2ec;
  --danger: #a34f4b;
  --danger-soft: #f7e9e7;
  --shadow: 0 8px 24px rgba(55, 40, 31, 0.04);
  --radius-large: 14px;
  --content-width: 1120px;
}

html {
  background: var(--page-bg);
}

body.tpm-production-page {
  min-width: 320px;
  min-height: 100vh;
  background: var(--page-bg);
  color: var(--text);
  font: 16px/1.75 "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
}

/* The bundled stylesheet also uses footer-links globally. Restore site footer. */
.site-footer .footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
}

.site-footer .footer-links a {
  color: inherit;
  font-weight: 400;
  text-decoration: none;
}

.site-footer .footer-links a:hover {
  color: inherit;
}

.tpm-page {
  padding: 42px 0 0;
  background: var(--main-bg);
}

.tpm-page-head {
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.tpm-page-head h1 {
  margin: 0 0 10px;
  font-size: clamp(1.8rem, 3.4vw, 2.55rem);
  line-height: 1.35;
}

.tpm-page-lead {
  max-width: 820px;
  margin: 0;
  color: var(--muted);
}

.tpm-page-head .tool-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.tpm-workspace-section {
  width: min(calc(100% - 24px), 1600px);
  margin: 28px auto 42px;
}

.tpm-information-layout {
  padding-bottom: 4px;
}

.tpm-information-main {
  min-width: 0;
}

.tpm-information-main > section + section {
  margin-top: 22px;
}

.tpm-note-section,
.tpm-faq {
  padding: 20px;
}

.tpm-note-section h2,
.tpm-faq h2 {
  margin: 0 0 14px;
  font-size: 1.15rem;
}

.tpm-note-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 1.4em;
  color: var(--muted);
}

.tpm-trademark {
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.86rem;
}

.tpm-faq details {
  border-top: 1px solid var(--line);
}

.tpm-faq details:last-child {
  border-bottom: 1px solid var(--line);
}

.tpm-faq summary {
  padding: 13px 4px;
  font-weight: 700;
  cursor: pointer;
}

.tpm-faq details p {
  margin: 0;
  padding: 0 4px 15px;
  color: var(--muted);
}

/* Application scope */
#root {
  --ink: var(--text);
  --accent-strong: var(--accent-hover);
  --accent-soft: #f0d9d5;
  --radius: 14px;
  color: var(--text);
  font-family: inherit;
}

#root .app-shell {
  min-height: 0;
  background: transparent;
}

#root .app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: 0;
  margin: 0 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 253, 250, 0.96);
  box-shadow: 0 8px 24px rgba(55, 40, 31, 0.07);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

#root .editor-project-heading .eyebrow {
  display: none;
}

#root .editor-title {
  color: var(--text);
  font-size: 1.15rem;
  line-height: 1.35;
}

#root .editor-lead {
  max-width: 620px;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.8rem;
}

#root .header-status {
  border-color: var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

#root .formal-editor-layout {
  grid-template-columns: 236px minmax(520px, 1fr) 360px;
  gap: 16px;
  padding: 16px 12px 30px;
}

#root .panel-sidebar,
#root .preview-card,
#root .settings-card {
  border-color: var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

#root .panel-sidebar,
#root .inspector-card {
  top: 92px;
  max-height: calc(100vh - 108px);
}

#root button {
  border-radius: 8px;
}

#root .field-group input:not([type="range"]):not([type="file"]),
#root .field-group select,
#root .full-width-select,
#root .font-detail-grid select {
  border-radius: 7px;
}

#root .field-group input[type="file"],
#root .asset-dropzone,
#root .advanced-settings,
#root .asset-processing-section {
  border-radius: 9px;
}

#root .panel-list-item,
#root .choice-card,
#root .palette-choice,
#root .font-set-card,
#root .preset-card,
#root .custom-panel-button,
#root .position-value-grid div,
#root .shared-setting-notice,
#root .future-feature-note,
#root .export-panel-item,
#root .export-size-card {
  border-radius: 8px;
}

#root .settings-tabs {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
}

#root .settings-tabs button.is-active {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: none;
}

#root .preview-stage {
  border-radius: 10px;
}

#root .primary-button {
  background: var(--accent);
}

#root .primary-button:hover:not(:disabled) {
  background: var(--accent-hover);
}

#root .secondary-button,
#root .icon-button {
  border-color: var(--line);
  background: #fff;
  color: var(--text);
}

#root .add-panel-dialog,
#root .export-dialog {
  border-radius: 14px;
  background: var(--surface);
}

#root .modal-heading {
  background: rgba(255, 253, 250, 0.96);
}


#root .export-dialog-actions {
  background: var(--surface);
}

#root .app-footer {
  display: none;
}

#root .loading-shell,
#root .fatal-state-shell {
  min-height: 420px;
}

#root .loading-card,
#root .fatal-state-card {
  border-radius: 12px;
  box-shadow: var(--shadow);
}

@media (max-width: 1280px) {
  #root .formal-editor-layout {
    grid-template-columns: 210px minmax(480px, 1fr);
  }

  #root .inspector-card {
    max-height: none;
  }
}

@media (max-width: 860px) {
  .tpm-page {
    padding-top: 30px;
  }

  .tpm-workspace-section {
    width: min(calc(100% - 16px), 1600px);
    margin-top: 22px;
  }


  #root .app-header {
    position: static;
    margin: 0 4px;
  }

  #root .formal-editor-layout {
    grid-template-columns: 1fr;
    padding-inline: 4px;
  }

  #root .panel-sidebar,
  #root .inspector-card {
    max-height: none;
  }
}

@media (max-width: 560px) {
  .tpm-page-head .tool-facts {
    display: grid;
  }


  #root .app-header {
    padding: 14px;
  }

  #root .header-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  #root .header-status {
    grid-column: 1 / -1;
  }

  #root .header-actions .compact-button,
  #root .workspace-menu {
    width: 100%;
  }
}

/* Result-adjacent Amazon gift support placement */
#root .support-action-mount {
  display: none;
  min-width: 0;
}

#root .support-action-mount.is-visible:not([hidden]) {
  display: block;
}

#root .support-action-mount > #supportAfterPanelGenerate {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

/*
 * 書き出し後の支援欄は、プレビュー列だけではなく編集画面全体の幅を使用します。
 * パネル編集ヘッダーの直下、プレビュー・パネル一覧・設定の直前に配置します。
 */
#root .formal-editor-layout.has-support-action .support-action-mount {
  grid-column: 1 / -1;
  grid-row: 1;
}

#root .formal-editor-layout.has-support-action .panel-sidebar {
  grid-column: 1;
  grid-row: 2;
}

#root .formal-editor-layout.has-support-action .formal-preview-card {
  grid-column: 2;
  grid-row: 2;
}

#root .formal-editor-layout.has-support-action .inspector-card {
  grid-column: 3;
  grid-row: 2;
}

@media (max-width: 1280px) {
  #root .formal-editor-layout.has-support-action .support-action-mount {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  #root .formal-editor-layout.has-support-action .panel-sidebar {
    grid-column: 1;
    grid-row: 2 / span 2;
  }

  #root .formal-editor-layout.has-support-action .formal-preview-card {
    grid-column: 2;
    grid-row: 2;
  }

  #root .formal-editor-layout.has-support-action .inspector-card {
    grid-column: 2;
    grid-row: 3;
  }
}

@media (max-width: 860px) {
  #root .formal-editor-layout.has-support-action .support-action-mount {
    grid-column: 1;
    grid-row: auto;
    order: 1;
  }

  #root .formal-editor-layout.has-support-action .formal-preview-card {
    grid-column: 1;
    grid-row: auto;
    order: 2;
  }

  #root .formal-editor-layout.has-support-action .panel-sidebar {
    grid-column: 1;
    grid-row: auto;
    order: 3;
  }

  #root .formal-editor-layout.has-support-action .inspector-card {
    grid-column: 1;
    grid-row: auto;
    order: 4;
  }
}
