:root {
  --bg: #f7f7f2;
  --surface: #ffffff;
  --surface-alt: #f0ebe1;
  --text: #1f2933;
  --muted: #52606d;
  --accent: #b85c38;
  --accent-dark: #8f4327;
  --border: #d9d3c7;
  --shadow: 0 16px 40px rgba(31, 41, 51, 0.08);
  --radius: 22px;
  --font-sans: "Segoe UI", "Hiragino Sans", "Yu Gothic UI", sans-serif;
  --parent: #244867;
  --child: #7a3e12;
  --success-bg: rgba(36, 72, 103, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(184, 92, 56, 0.14), transparent 30%),
    linear-gradient(180deg, #fcfaf5 0%, var(--bg) 48%, #efe7d9 100%);
  line-height: 1.6;
}

a {
  color: var(--accent-dark);
}

.container {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  padding: 56px 0 22px;
}

.hero-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

.site-linkbar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.site-home-link {
  color: var(--accent-dark);
  font-weight: 700;
}

.site-home-link:hover,
.site-home-link:focus-visible {
  text-decoration: underline;
}

.site-link-separator,
.site-tool-label {
  color: var(--muted);
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.4rem, 4vw, 4.6rem);
  line-height: 0.96;
}

.hero-lead,
.hero-note,
.panel-copy,
.status,
.preview-note,
.summary-label,
.removed-empty,
.plan-empty,
.removed-file {
  color: var(--muted);
}

.hero-lead {
  margin: 16px 0 8px;
  max-width: 760px;
}

.hero-note {
  margin: 18px 0 0;
}

.trust-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.trust-badges li {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(184, 92, 56, 0.18);
  color: var(--accent-dark);
  font-size: 0.92rem;
  font-weight: 700;
}

.lang-switch {
  position: relative;
  display: inline-block;
  z-index: 40;
}

.lang-toggle,
.lang-option {
  font: inherit;
  color: var(--text);
}

.lang-toggle {
  min-width: 64px;
  padding: 10px 14px;
  border: 1px solid rgba(31, 41, 51, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  font-weight: 700;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease;
}

.lang-toggle:hover:not(:disabled),
.lang-toggle:focus-visible,
.lang-toggle.is-open {
  background: rgba(184, 92, 56, 0.12);
  border-color: rgba(184, 92, 56, 0.28);
}

.lang-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  display: grid;
  gap: 6px;
  min-width: 148px;
  padding: 8px;
  border: 1px solid rgba(217, 211, 199, 0.9);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 40px rgba(31, 41, 51, 0.14);
  z-index: 60;
}

.lang-menu[hidden] {
  display: none;
}

.lang-option {
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
}

.lang-option:hover:not(:disabled),
.lang-option:focus-visible,
.lang-option.is-active {
  background: rgba(184, 92, 56, 0.12);
  color: var(--accent-dark);
}

.ad-slot {
  margin: 14px 0 36px;
  min-height: 120px;
  padding: 14px;
  border: 1px dashed #c7c0b2;
  border-radius: 20px;
  display: block;
  background: rgba(255, 255, 255, 0.56);
  color: var(--muted);
}

.ad-slot .adsbygoogle {
  display: block !important;
  width: 100%;
  min-height: 92px;
}

.tool-shell,
.content-grid {
  display: grid;
  gap: 20px;
}

.tool-shell {
  grid-template-columns: minmax(320px, 460px) minmax(0, 1fr);
  align-items: start;
  margin-bottom: 48px;
}

.content-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-bottom: 48px;
}

.content-stack {
  display: grid;
  gap: 20px;
  margin-bottom: 48px;
}

.content-panel h2,
.content-panel h3 {
  margin-top: 0;
}

.content-panel h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.steps-list,
.related-links {
  margin: 0;
  padding-left: 20px;
}

.related-links {
  display: grid;
  gap: 8px;
}

.panel {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(217, 211, 199, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.tool-panel-title,
.article-card h2,
.planner-panel h2,
.removed-shell h3 {
  margin-top: 0;
}

.panel-copy {
  margin: -6px 0 18px;
}

.upload-grid {
  display: grid;
  gap: 14px;
}

.dropzone {
  position: relative;
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 180px;
  padding: 24px;
  border: 2px dashed var(--border);
  border-radius: calc(var(--radius) - 4px);
  background:
    linear-gradient(135deg, rgba(184, 92, 56, 0.07), rgba(255, 255, 255, 0.9)),
    var(--surface);
  text-align: center;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease;
}

.dropzone:hover,
.dropzone.is-dragover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dropzone-title {
  font-size: 1.18rem;
  font-weight: 700;
}

.warning-block {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(184, 92, 56, 0.18);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.summary-card {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border);
}

.summary-card strong {
  display: block;
  margin-top: 4px;
  font-size: 1.55rem;
}

.toggle-field {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 18px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
}

.toggle-field input {
  margin-top: 3px;
}

.toggle-copy {
  display: grid;
  gap: 4px;
}

.toggle-copy strong {
  font-size: 0.98rem;
}

.toggle-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-left: auto;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 13px 20px;
  font: inherit;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: background-color 140ms ease, transform 140ms ease, opacity 140ms ease;
}

button:hover:not(:disabled) {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.actions button:nth-child(2),
.actions button:nth-child(3),
.secondary-button,
.plan-action,
.removed-action {
  background: #334e68;
}

.actions button:nth-child(2):hover:not(:disabled),
.actions button:nth-child(3):hover:not(:disabled),
.secondary-button:hover:not(:disabled),
.plan-action:hover:not(:disabled),
.removed-action:hover:not(:disabled) {
  background: #243b53;
}

.status {
  min-height: 1.6em;
  margin: 16px 0 0;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.result-header-small {
  margin-top: 26px;
}

.planner-mode,
.removed-count {
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(184, 92, 56, 0.12);
  color: var(--accent-dark);
  font-size: 0.84rem;
  font-weight: 700;
}

.plan-board,
.removed-list {
  display: grid;
  gap: 12px;
}

.plan-empty,
.removed-empty {
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.5);
}

.plan-slot {
  min-height: 26px;
  border: 1px dashed transparent;
  border-radius: 14px;
  transition: border-color 120ms ease, background-color 120ms ease;
}

.plan-slot.is-visible {
  border-color: rgba(184, 92, 56, 0.28);
  background: rgba(184, 92, 56, 0.06);
}

.plan-slot.is-active {
  border-color: rgba(184, 92, 56, 0.56);
  background: rgba(184, 92, 56, 0.12);
}

.plan-item {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fffefb;
}

.plan-item.without-preview {
  grid-template-columns: minmax(0, 1fr) auto;
}

.plan-item.is-draggable {
  cursor: grab;
  -webkit-touch-callout: none;
}

.plan-item.is-dragging {
  opacity: 0.48;
}

.plan-item.is-draggable .plan-item-main,
.plan-item.is-draggable .plan-item-title,
.plan-item.is-draggable .page-file,
.plan-item.is-draggable .page-name,
.plan-item.is-draggable .page-badge {
  user-select: none;
  -webkit-user-select: none;
}

.plan-item-main {
  min-width: 0;
}

.plan-item-preview {
  width: 112px;
  min-height: 148px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(207, 212, 218, 0.95);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(240, 235, 225, 0.9));
  display: grid;
  place-items: center;
  position: relative;
}

.plan-item-preview::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(184, 92, 56, 0.06), transparent 44%),
    linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(36, 72, 103, 0.03));
  pointer-events: none;
}

.plan-preview-canvas {
  display: block;
  width: 100%;
  height: auto;
  position: relative;
  z-index: 1;
}

.plan-preview-placeholder {
  width: 78%;
  aspect-ratio: 0.72;
  border-radius: 10px;
  border: 1px solid rgba(82, 96, 109, 0.14);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(236, 230, 219, 0.9));
  box-shadow: 0 10px 24px rgba(31, 41, 51, 0.08);
  position: relative;
  z-index: 1;
}

.plan-preview-placeholder::before,
.plan-preview-placeholder::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  height: 7px;
  border-radius: 999px;
  background: rgba(82, 96, 109, 0.12);
}

.plan-preview-placeholder::before {
  top: 16%;
}

.plan-preview-placeholder::after {
  top: 28%;
}

.plan-item-title {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: center;
}

.page-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.page-badge.parent {
  background: rgba(36, 72, 103, 0.1);
  color: var(--parent);
}

.page-badge.child {
  background: rgba(122, 62, 18, 0.12);
  color: var(--child);
}

.page-badge.source {
  background: rgba(36, 72, 103, 0.1);
  color: var(--parent);
}

.page-name {
  font-weight: 700;
}

.rotation-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(184, 92, 56, 0.12);
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 700;
}

.page-file {
  margin-top: 4px;
  font-size: 0.94rem;
  overflow-wrap: anywhere;
}

.plan-item-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.plan-action,
.removed-action {
  padding: 9px 14px;
  font-size: 0.92rem;
}

.removed-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.site-footer {
  border-top: 1px solid rgba(82, 96, 109, 0.16);
  padding: 26px 0 36px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 20px;
}

@media (max-width: 920px) {
  .tool-shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .hero {
    padding-top: 48px;
  }

  .hero-topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-topbar .lang-switch {
    align-self: flex-end;
  }

  .hero-topbar .lang-toggle {
    width: auto;
  }

  .hero-topbar .lang-menu {
    left: auto;
    right: 0;
    min-width: max(148px, 100%);
  }

  .panel {
    padding: 18px;
  }

  .summary-grid {
    grid-template-columns: 1fr 1fr;
  }

  .actions {
    flex-direction: column;
  }

  button {
    width: 100%;
  }

  .toggle-actions {
    width: 100%;
    margin-left: 0;
  }

  .plan-item,
  .removed-item {
    grid-template-columns: 1fr;
  }

  .plan-item.without-preview {
    grid-template-columns: 1fr;
  }

  .plan-item-preview {
    width: 100%;
    max-width: 140px;
  }

  .plan-item-actions {
    justify-content: flex-start;
  }
}
