/* 「とある櫻花の画像生成（復刻版）」样式表
 * 美学定位：2011 日系复古同人工具架构 + 学园都市精密工程质感 */

:root {
  --bg-canvas: #ebeff5;
  --bg-grid-line: rgba(45, 85, 140, 0.055);
  --card-bg: #ffffff;
  --text-main: #22262e;
  --text-muted: #5b6472;
  --topbar-bg: #1b1e24;
  --topbar-border: #2e3440;
  --accent-blue: #11549a;
  --accent-red: #e9131d;
  --thumb-border: #4477ff;
  --radius-sm: 4px;
  --radius-md: 6px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background-color: var(--bg-canvas);
  background-image:
    linear-gradient(to right, var(--bg-grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--bg-grid-line) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--text-main);
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

/* 日文页面专用正文字体栈，避免与中文 UI 字体混排 */
html[lang="ja"] body {
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif;
}

/* 英文页面专用西文字体栈 */
html[lang="en"] body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ========== 顶部深色导航栏（复刻原站 navbar-inverse） ========== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: linear-gradient(180deg, #272b33 0%, var(--topbar-bg) 100%);
  border-bottom: 1px solid var(--topbar-border);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
}

.topbar-inner {
  max-width: 1000px;
  min-height: 44px;
  margin: 0 auto;
  padding: 6px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.brand {
  color: #f4f7fb;
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.3;
  letter-spacing: 0.04em;
  font-family: "Noto Serif JP", "Source Han Serif SC", serif;
}

/* 中文页导航标题避免本地日文字库缺字导致简体混排粗细不一 */
html[lang="zh-CN"] .brand {
  font-family: "Source Han Serif SC", "Songti SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.brand:hover {
  color: #82c4ff;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.nav-pill,
.nav-lang-btn {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #d7dee9;
  border-radius: 3px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.nav-pill:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.nav-lang-btn {
  background: rgba(17, 84, 154, 0.45);
  border-color: rgba(111, 184, 227, 0.45);
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.nav-lang-btn:hover {
  background: rgba(17, 84, 154, 0.75);
}

/* 顶部三语切换分段器 */
.lang-switcher {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(111, 184, 227, 0.4);
  border-radius: 3px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
}

.lang-item {
  padding: 4px 8px;
  font-size: 12px;
  line-height: 1.3;
  color: #cbd5e1;
  text-decoration: none;
  border-left: 1px solid rgba(255, 255, 255, 0.14);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.lang-item:first-child {
  border-left: none;
}

.lang-item:hover:not(.is-active) {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.lang-item.is-active {
  background: rgba(17, 84, 154, 0.75);
  color: #ffffff;
  font-weight: 700;
  cursor: default;
}

/* ========== 主内容容器 ========== */
.page-wrapper {
  max-width: 1020px;
  margin: 18px auto 24px;
  padding: 0 12px;
}

.content-card {
  background-color: var(--card-bg);
  border: 1px solid #d5dce6;
  border-radius: var(--radius-md);
  box-shadow: 0 3px 14px rgba(18, 32, 56, 0.08);
  padding: 18px 22px 22px;
}

/* 静态唯一 H1 顶部介绍条（紧凑不影响首屏操作区） */
.page-intro {
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid #e7ecf3;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.page-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
  color: #1a202c;
  letter-spacing: 0.02em;
}

.page-subtitle {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-muted);
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.95fr);
  gap: 24px;
  align-items: start;
}

/* ========== 左栏：实时预览与导出 ========== */
.preview-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.preview-stage {
  width: 100%;
  min-height: 220px;
  padding: 12px;
  border: 1px solid #dde3ec;
  border-radius: var(--radius-sm);
  background-color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: background-color 0.2s ease;
}

/* 透明背景开启时显示适中对比度棋盘格纹理（确保白色外描边也可清晰辨识） */
.preview-stage.is-transparent {
  background-color: #eef1f6;
  background-image:
    linear-gradient(45deg, #d3dae6 25%, transparent 25%),
    linear-gradient(-45deg, #d3dae6 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d3dae6 75%),
    linear-gradient(-45deg, transparent 75%, #d3dae6 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

#logoCanvas {
  max-width: 100%;
  max-height: 460px;
  width: auto;
  height: auto;
  aspect-ratio: 640 / 300;
  display: block;
}

#logoCanvas.is-vertical {
  aspect-ratio: 300 / 700;
}

.preview-meta {
  margin-top: 12px;
  width: 100%;
}

.preview-caption {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 700;
  color: #1c222d;
  word-break: break-all;
}

.preview-dimensions {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.font-status-badge {
  margin-left: 8px;
  padding: 1px 6px;
  border-radius: 3px;
  background: #eef3f9;
  color: #11549a;
  font-size: 11px;
}

.font-status-badge[hidden] {
  display: none;
}

.export-actions {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.action-btn {
  border: 1px solid #c3ccd9;
  background: linear-gradient(180deg, #ffffff 0%, #eff3f8 100%);
  color: #252b36;
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.action-btn:hover {
  border-color: #7c96bd;
  box-shadow: 0 1px 4px rgba(17, 84, 154, 0.15);
}

.action-btn:active {
  transform: translateY(1px);
}

.action-btn-primary {
  border-color: #0e4a88;
  background: linear-gradient(180deg, #2573c2 0%, #11549a 100%);
  color: #ffffff;
}

.action-btn-primary:hover {
  border-color: #093564;
  background: linear-gradient(180deg, #2d80d4 0%, #135eab 100%);
}

.action-feedback {
  margin: 8px 0 0;
  min-height: 18px;
  font-size: 12px;
  color: #136f3a;
  font-weight: 600;
}

/* ========== 右栏：原版变色表单（红/蓝/自定义主题联动） ========== */
.control-column {
  border-left: 1px solid #eceff4;
  padding-left: 22px;
}

.toaru-form {
  padding: 18px 16px;
  border: 1px solid #9db4dc;
  border-radius: var(--radius-sm);
  text-align: center;
  transition: background-color 0.25s ease, border-color 0.25s ease;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.toaru-form.theme-majutsu {
  background-color: #99bbff;
  border-color: #6b93e6;
}

.toaru-form.theme-kagaku {
  background-color: #ff8866;
  border-color: #db5f3c;
}

.toaru-form.theme-sonota {
  background-color: #d0e1fd;
  border-color: #82a3df;
}

.sentence-inputs {
  max-width: 268px;
  margin: 0 auto 4px;
}

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.fixed-word {
  font-family: "Noto Serif JP", "Source Han Serif SC", serif;
  font-weight: 900;
  font-size: 19px;
  color: #161920;
  flex-shrink: 0;
}

.fixed-paren {
  font-size: 16px;
  font-weight: 700;
  color: #20242c;
  flex-shrink: 0;
}

.text-input,
.select-second {
  height: 34px;
  padding: 4px 8px;
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 3px;
  background-color: #ffffff;
  color: #111;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}

.text-input:focus,
.select-second:focus {
  outline: 2px solid rgba(17, 84, 154, 0.45);
  border-color: #11549a;
}

.input-prefix {
  width: 88px;
  flex-shrink: 0;
  font-size: 14px;
}

.input-kagaku {
  flex: 1;
  min-width: 0;
}

.input-railgun {
  flex: 1;
  min-width: 0;
}

.select-second {
  width: 92px;
  flex-shrink: 0;
  text-align: center;
  font-size: 13px;
  white-space: nowrap;
}

.input-kana {
  flex: 1;
  min-width: 0;
  font-size: 14px;
}

.sentence-tools {
  display: flex;
  justify-content: center;
  margin-top: 2px;
}

.mini-tool-btn {
  border: 1px solid rgba(0, 0, 0, 0.18);
  background: rgba(255, 255, 255, 0.72);
  color: #1f2733;
  border-radius: 3px;
  padding: 3px 10px;
  font-size: 11.5px;
  line-height: 1.4;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.mini-tool-btn:hover {
  background: #ffffff;
}

.form-group {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed rgba(0, 0, 0, 0.16);
}

.group-label {
  font-weight: 700;
  font-size: 13px;
  color: #171a21;
  margin-bottom: 6px;
}

.radio-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.radio-option {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #181c24;
  user-select: none;
}

.radio-option input[type="radio"],
.radio-option input[type="checkbox"] {
  accent-color: #11549a;
  cursor: pointer;
}

/* 自定义渐变颜色框 */
.sonota-box {
  margin-top: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 4px;
}

.sonota-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
}

.color-pair {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.color-pair input[type="color"] {
  width: 32px;
  height: 28px;
  padding: 1px;
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
}

.hex-input {
  width: 72px;
  height: 28px;
  padding: 2px 5px;
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  text-transform: uppercase;
  text-align: center;
}

.swap-btn {
  border: 1px solid rgba(0, 0, 0, 0.22);
  background: #ffffff;
  border-radius: 3px;
  height: 28px;
  padding: 0 8px;
  cursor: pointer;
  font-size: 13px;
}

.swap-btn:hover {
  background: #f0f4fa;
}

.submit-row {
  margin-top: 16px;
}

.btn-create-main {
  width: 100%;
  max-width: 240px;
  padding: 10px 18px;
  border: 1px solid #0b417a;
  border-radius: 4px;
  background: linear-gradient(180deg, #0088cc 0%, #0044cc 100%);
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18);
  transition: filter 0.15s ease, transform 0.1s ease;
}

.btn-create-main:hover {
  filter: brightness(1.08);
}

.btn-create-main:active {
  transform: translateY(1px);
}

.warning-note {
  margin: 10px 0 0;
  font-size: 11px;
  color: #2c2f36;
  line-height: 1.4;
}

.warn-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-right: 4px;
  border-radius: 2px;
  background: #d97706;
  color: #fff;
  font-weight: 900;
  font-size: 10px;
  vertical-align: middle;
}

/* ========== 底部缩略图画廊（致敬原站 128x128 虚线边框风格） ========== */
.gallery-section {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid #e1e6ef;
}

.gallery-block + .gallery-block {
  margin-top: 22px;
}

.gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.gallery-header h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #2a313d;
}

.text-link-btn {
  border: none;
  background: transparent;
  color: #11549a;
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  padding: 2px 4px;
}

.text-link-btn:hover {
  color: #cc2222;
}

.thumb-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.thumb-card {
  position: relative;
  width: 128px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.thumb-trigger {
  padding: 0;
  border: 1px dashed var(--thumb-border);
  background: #ffffff;
  width: 128px;
  height: 128px;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-style 0.15s ease;
}

.thumb-trigger:hover {
  transform: translateY(-2px);
  border-style: solid;
  box-shadow: 0 3px 10px rgba(68, 119, 255, 0.22);
}

.thumb-trigger img {
  width: 128px;
  height: 128px;
  display: block;
  object-fit: contain;
}

.thumb-title {
  margin-top: 4px;
  width: 100%;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.thumb-delete {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 2px;
  background: rgba(24, 28, 36, 0.72);
  color: #ffffff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background-color 0.15s ease;
}

.thumb-card:hover .thumb-delete {
  opacity: 1;
}

.thumb-delete:hover {
  background: #d92d20;
}

.empty-gallery-hint {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

/* ========== 展示广告占位容器（预留最小高度防止 CLS 抖动） ========== */
.ad-banner-slot {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid #e1e6ef;
  min-height: 112px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.ad-slot-label {
  font-size: 11px;
  line-height: 1;
  color: #8c96a6;
  letter-spacing: 0.06em;
}

.ad-banner-slot .adsbygoogle {
  width: 100%;
  max-width: 970px;
}

/* ========== 使用说明与 FAQ（克制轻量化信息区） ========== */
.seo-guide-section {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid #e1e6ef;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.guide-card {
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid #e4e9f2;
  border-radius: var(--radius-sm);
}

.guide-card h2,
.faq-block h2 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 700;
  color: #1f2733;
}

.guide-card p {
  margin: 0;
  font-size: 12.5px;
  color: #4b5565;
  line-height: 1.65;
}

.guide-list {
  margin: 0;
  padding-left: 18px;
  font-size: 12.5px;
  color: #4b5565;
  line-height: 1.65;
}

.guide-list li + li {
  margin-top: 4px;
}

.faq-block {
  margin-top: 14px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid #e4e9f2;
  border-radius: var(--radius-sm);
}

.faq-list {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.faq-item dt {
  font-size: 12.5px;
  font-weight: 700;
  color: #222936;
  margin-bottom: 4px;
}

.faq-item dd {
  margin: 0;
  font-size: 12px;
  color: #535d6e;
  line-height: 1.6;
}

/* ========== 页脚 ========== */
.site-footer {
  text-align: center;
  padding: 8px 16px 24px;
  font-size: 12px;
  color: #5b6472;
}

/* ========== 响应式布局（平板及移动端） ========== */
@media (max-width: 860px) {
  .workspace-grid,
  .guide-grid,
  .faq-list {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .control-column {
    border-left: none;
    border-top: 1px solid #eceff4;
    padding-left: 0;
    padding-top: 18px;
  }

  .thumb-grid {
    justify-content: center;
  }
}
