:root {
  --background: #ffffff;
  --surface: #ffffff;
  --primary: #246fb6;
  --primary-strong: #131921;
  --accent: #4facfe;
  --text: #0f1111;
  --muted: #4b5563;
  --font-sans: 'Noto Sans JP', 'Noto Sans', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic Medium', 'Yu Gothic', 'Yu Gothic UI', '游ゴシック体', 'YuGothic', 'Meiryo', sans-serif;
  font-family: var(--font-sans);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--text);
}

body,
button,
input,
select,
textarea,
option {
  font-family: var(--font-sans);
}

.gjs-editor,
.gjs-editor [class^="gjs-"],
.gjs-editor [class*=" gjs-"] {
  font-family: var(--font-sans) !important;
}

.editor-layout main {
  max-width: none;
  margin: 0;
  padding: 0;
  width: 100%;
}

a {
  color: inherit;
}

.header-bar {
  background: #ffffff;
  border-bottom: 1px solid rgba(17, 24, 39, 0.08);
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.07);
}

.editor-layout .header-bar {
  padding: 0.35rem 0.9rem;
  min-height: var(--editor-header-height);
}

.editor-layout .brand-title {
  font-size: 1.45rem;
  margin: 0;
}

.brand-title {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--primary-strong);
  margin: 0;
}

.brand-title .brand-sub {
  font-size: 0.52em;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-left: 0.4em;
  white-space: nowrap;
  color: var(--primary);
}

main {
  max-width: 1200px;
  margin: 2.5rem auto;
  padding: 0 2rem 3.5rem;
}

.landing {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.card {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.07);
  padding: 2.5rem;
}

.card + .card {
  margin-top: 2.5rem;
}

.card h2 {
  margin-top: 0;
  font-size: 1.4rem;
  font-weight: 600;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.75rem;
}

.label {
  font-weight: 600;
  color: var(--muted);
}

.label-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.label-icon .icon svg {
  width: 1.5rem;
  height: 1.5rem;
  display: block;
  color: var(--primary);
}

.label-icon .icon svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.help-text {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

body:not(.editor-layout) select,
body:not(.editor-layout) input[type="text"],
.editor-layout .top-controls select,
.editor-layout .top-controls input[type="text"] {
  appearance: none;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 14px;
  padding: 0.78rem 1rem;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 6px 14px rgba(15, 23, 42, 0.05);
  transition: border 0.2s, box-shadow 0.2s, transform 0.1s;
}

body:not(.editor-layout) select:focus,
body:not(.editor-layout) input[type="text"]:focus,
.editor-layout .top-controls select:focus,
.editor-layout .top-controls input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(36, 111, 182, 0.18);
}

.pill-button,
body:not(.editor-layout) button,
.editor-layout .top-controls button {
  cursor: pointer;
  background: linear-gradient(130deg, rgba(36, 111, 182, 0.95), rgba(79, 172, 254, 0.9));
  color: #ffffff;
  font-weight: 700;
  letter-spacing: 0.01em;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  padding: 0.5rem 1.45rem;
  box-shadow:
    0 10px 22px rgba(36, 111, 182, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(4px);
  transition: transform 0.12s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.pill-button:hover,
body:not(.editor-layout) button:hover,
.editor-layout .top-controls button:hover {
  background: linear-gradient(130deg, rgba(36, 111, 182, 1), rgba(79, 172, 254, 0.98));
  transform: translateY(-1px);
  box-shadow:
    0 14px 30px rgba(36, 111, 182, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.pill-button:disabled,
body:not(.editor-layout) button:disabled,
.editor-layout .top-controls button:disabled {
  background: rgba(107, 114, 128, 0.45);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.pill-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  text-decoration: none;
}

.pill-button.ghost {
  background: rgba(19, 25, 33, 0.06);
  color: var(--primary-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(19, 25, 33, 0.1);
}

.pill-button.ghost:hover {
  background: rgba(19, 25, 33, 0.12);
  transform: translateY(-1px);
}

.pill-button.primary.subtle {
  background: linear-gradient(130deg, rgba(36, 111, 182, 0.85), rgba(79, 172, 254, 0.85));
}

.pill-button.secondary {
  background: rgba(19, 25, 33, 0.06);
  color: #131921;
  box-shadow: none;
  border: 1px solid rgba(19, 25, 33, 0.1);
}

.pill-button.secondary:hover {
  background: rgba(19, 25, 33, 0.12);
  color: #0f1111;
}

.pill-button.danger {
  background: linear-gradient(130deg, rgba(240, 82, 82, 0.95), rgba(190, 24, 93, 0.9));
  box-shadow: 0 10px 22px rgba(190, 24, 93, 0.18);
}

.pill-button.danger:hover {
  background: linear-gradient(130deg, rgba(240, 82, 82, 1), rgba(190, 24, 93, 0.95));
  box-shadow: 0 12px 28px rgba(190, 24, 93, 0.2);
}

.notice {
  padding: 1rem;
  border-radius: 12px;
  background: rgba(36, 111, 182, 0.12);
  color: var(--primary-strong);
}

.gjs-highlighter,
.gjs-badge,
.gjs-toolbar,
.gjs-resizer,
.gjs-offset-v,
.gjs-sm-caret {
  transition: none !important;
}

.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  color: var(--primary-strong);
  text-decoration: none;
  margin-top: 2rem;
}

.footer-link svg {
  width: 1.1rem;
  height: 1.1rem;
}

.editor-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  --editor-header-height: 52px;
}

.editor-main {
  flex: 1;
  display: flex;
  min-height: 0;
  width: 100%;
}

#editor-container {
  flex: 1;
  min-width: 0;
  min-height: 320px;
  height: var(--editor-viewport-height, calc(100vh - var(--editor-header-height) - 12px));
}

.top-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.top-controls .field {
  margin: 0;
  min-width: 180px;
}

.top-controls .field select {
  min-width: 200px;
}

.editor-layout .top-controls select,
.editor-layout .top-controls input[type="text"] {
  padding: 0.5rem 0.8rem;
}

.editor-layout .top-controls button {
  padding: 0.45rem 0.9rem;
}

.top-controls .status-field {
  min-width: 160px;
}

.top-controls button {
  align-self: flex-end;
}

.status-badge {
  background: #ffffff;
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: #0f172a;
  border: 1px solid rgba(36, 111, 182, 0.3);
  box-shadow: 0 3px 9px rgba(36, 111, 182, 0.1);
}

.editor-layout .status-badge {
  background: #ffffff;
  color: #0f172a;
  border-color: rgba(36, 111, 182, 0.3);
  box-shadow: 0 3px 9px rgba(36, 111, 182, 0.1);
}

.status-badge.status-version {
  background: #ffffff;
  color: #0f172a;
  border-color: rgba(36, 111, 182, 0.3);
  box-shadow: 0 3px 9px rgba(36, 111, 182, 0.1);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.admin-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.05rem;
  font-size: 0.85rem;
  transition: transform 0.1s ease, box-shadow 0.2s ease;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal.open {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
}

.modal-dialog {
  position: relative;
  background: #fff;
  color: #111827;
  padding: 2.25rem 2rem 2rem;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
  width: 520px;
  max-width: 90vw;
  min-width: 420px;
  z-index: 1;
}

.modal-dialog.wide {
  width: 780px;
  max-width: 94vw;
  min-width: 520px;
}

.modal-title {
  margin: 0 0 1.2rem;
  font-size: 1.25rem;
  font-weight: 800;
  text-align: left;
}

.modal-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  margin: 0 auto 1.4rem;
}

.modal-body.stacked {
  align-items: stretch;
}

.modal-field {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  width: 100%;
}

.modal-body input {
  width: 80%;
  max-width: 360px;
  padding: 0.75rem 0.95rem;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 10px;
  font-size: 1rem;
}

.modal-body.stacked input,
.modal-body.stacked select,
.modal-body.stacked input[type="file"] {
  width: 100%;
  max-width: none;
}

.code-input {
  width: 100%;
  min-height: 280px;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  line-height: 1.4;
  padding: 0.8rem 0.9rem;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 10px;
  resize: vertical;
  box-sizing: border-box;
}

.modal-body input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(57, 73, 171, 0.15);
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
}

.modal-actions button {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 0.65rem 1.1rem;
  font-weight: 600;
  cursor: pointer;
}

.modal-actions button:hover {
  background: var(--primary-strong);
}

.modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #6b7280;
  border-radius: 50%;
}

.modal-close svg {
  width: 1.1rem;
  height: 1.1rem;
}

.modal-error {
  color: #b91c1c;
  font-size: 0.9rem;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  width: 100%;
}

.admin-section {
  background: rgba(36, 111, 182, 0.05);
  border: 1px solid rgba(36, 111, 182, 0.12);
  border-radius: 12px;
  padding: 1rem;
  width: 100%;
}

.admin-section h4 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  color: #111827;
}

.admin-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.admin-actions .pill-button {
  width: 100%;
  padding-left: 0.7rem;
  padding-right: 0.7rem;
}

.admin-button:focus-visible {
  outline: 2px solid rgba(36, 111, 182, 0.45);
  outline-offset: 2px;
}

.hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  padding: 1.4rem 1.6rem;
  border-radius: 24px;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 16px 40px rgba(17, 24, 39, 0.06);
  backdrop-filter: none;
}

.hero-copy h2 {
  font-size: 2.2rem;
  margin: 0.4rem 0 0.6rem;
  letter-spacing: 0.02em;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 700;
  color: var(--primary);
  margin: 0;
  font-size: 0.9rem;
}

.lead {
  margin: 0 0 1.4rem;
  color: #1f2937;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.hero-footnote {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  background: rgba(36, 111, 182, 0.12);
  color: #0f172a;
  font-weight: 700;
  font-size: 0.9rem;
  border: 1px solid rgba(36, 111, 182, 0.2);
}

.chip.subtle {
  background: rgba(79, 172, 254, 0.12);
  color: #0f172a;
  border-color: rgba(79, 172, 254, 0.2);
}

.hero-panel {
  position: relative;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 22px;
  padding: 1.4rem 1.6rem;
  border: 1px solid rgba(36, 111, 182, 0.15);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.55);
  overflow: hidden;
}

.hero-panel::before {
  content: '';
  position: absolute;
  inset: -20% -30%;
  background:
    radial-gradient(circle at 20% 20%, rgba(79, 172, 254, 0.18), transparent 45%),
    radial-gradient(circle at 80% 10%, rgba(241, 147, 251, 0.14), transparent 40%),
    radial-gradient(circle at 40% 80%, rgba(36, 111, 182, 0.16), transparent 48%);
  filter: blur(14px);
  z-index: 0;
}

.hero-panel > * {
  position: relative;
  z-index: 1;
}

.hero-panel__title {
  font-weight: 800;
  color: var(--primary-strong);
  margin-bottom: 0.75rem;
}

.hero-panel__list {
  margin: 0 0 1.2rem 1.2rem;
  padding: 0;
  color: #3a4156;
  line-height: 1.6;
}

.hero-panel__list li {
  margin-bottom: 0.35rem;
}

.hero-panel__cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.hero-panel__hint {
  color: var(--muted);
  font-weight: 600;
}

.small-caption {
  font-size: 0.7em;
}

.selection-card {
  margin-top: 0.75rem;
}

.top-controls .footer-link {
  margin: 0;
  padding: 0.6rem 0.4rem;
  align-self: flex-end;
}

.alert {
  background: rgba(220, 38, 38, 0.08);
  color: #b91c1c;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  margin-top: 1rem;
}

.ProseMirror {
  min-height: 1.25em;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
}

.ProseMirror p {
  margin: 0;
}

@media (max-width: 768px) {
  .header-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  main {
    padding: 0 1.5rem 2.5rem;
  }

  .card {
    padding: 1.75rem;
  }

  body:not(.editor-layout) button,
  .top-controls button {
    width: 100%;
  }

  .top-controls {
    flex-direction: column;
    align-items: flex-start;
  }
}
