:root {
  --bg: #081426;
  --panel: #0f1f39;
  --panel-light: #142a4a;
  --line: #2f4e79;
  --text: #eef5ff;
  --muted: #bfd2ee;
  --accent: #f59e0b;
  --accent-2: #0ea5e9;
  --ok: #22c55e;
  --warn: #f97316;
  --danger: #ef4444;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Noto Sans JP", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 10%, rgba(14, 165, 233, 0.26), transparent 32%),
    radial-gradient(circle at 85% 90%, rgba(245, 158, 11, 0.22), transparent 35%),
    linear-gradient(160deg, #081426 0%, #0c1c35 45%, #071324 100%);
  min-height: 100vh;
}

a { color: #d7e9ff; }
a:hover { color: #fff; }

.container {
  width: min(1180px, 92%);
  margin: 0 auto;
}

.telecom-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(6, 16, 34, 0.86);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(110, 149, 204, 0.35);
}

.telecom-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brand-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: radial-gradient(circle at 32% 30%, #fff8e7 0%, #f59e0b 72%, #bc5a03 100%);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.55);
  animation: pulse-dot 1.8s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.2); opacity: 1; }
}

.header-nav {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.header-nav a {
  text-decoration: none;
  color: #d2e4ff;
  font-weight: 600;
  font-size: 0.92rem;
}

main {
  padding-bottom: 3.2rem;
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 4.8rem 0 3.2rem;
  border-bottom: 1px solid rgba(121, 154, 202, 0.3);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(104, 152, 221, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(104, 152, 221, 0.08) 1px, transparent 1px);
  background-size: 36px 36px;
  animation: grid-slide 16s linear infinite;
  pointer-events: none;
}

@keyframes grid-slide {
  0% { transform: translateY(0px); }
  100% { transform: translateY(36px); }
}

.hero h1 {
  position: relative;
  margin: 0;
  font-size: clamp(1.8rem, 4.2vw, 2.95rem);
  line-height: 1.25;
}

.hero p {
  position: relative;
  color: var(--muted);
  font-size: clamp(0.98rem, 2.2vw, 1.13rem);
  max-width: 860px;
}

.hero-actions {
  margin-top: 1.2rem;
  display: flex;
  gap: 0.72rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  text-decoration: none;
  border-radius: 11px;
  border: 1px solid transparent;
  min-height: 42px;
  padding: 0.56rem 1rem;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, #d97706, #9a4308);
  border-color: #fbbf24;
}

.btn-secondary {
  background: linear-gradient(135deg, #0284c7, #075985);
  border-color: #7dd3fc;
}

.btn-ghost {
  background: rgba(27, 48, 80, 0.75);
  border-color: #456896;
  color: #eaf4ff;
}

.section {
  padding: 1.4rem 0;
}

.panel {
  background: linear-gradient(180deg, rgba(18, 38, 66, 0.95), rgba(10, 24, 44, 0.98));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.24);
}

.panel h2,
.panel h3 {
  margin-top: 0.3rem;
  margin-bottom: 0.55rem;
}

.lead {
  color: var(--muted);
  margin-top: 0.2rem;
}

.notice {
  border-left: 4px solid #f59e0b;
  background: rgba(245, 158, 11, 0.09);
  color: #ffe5bf;
  border-radius: 10px;
  padding: 0.72rem 0.8rem;
  margin: 0.8rem 0;
}

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

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

.card {
  border: 1px solid rgba(102, 138, 186, 0.4);
  border-radius: 12px;
  background: rgba(20, 40, 72, 0.8);
  padding: 0.88rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.2rem 0.62rem;
  font-size: 0.84rem;
  font-weight: 700;
}

.badge.ok { background: rgba(34, 197, 94, 0.2); color: #d7ffe4; border: 1px solid rgba(34, 197, 94, 0.45); }
.badge.warn { background: rgba(249, 115, 22, 0.2); color: #ffe3d1; border: 1px solid rgba(249, 115, 22, 0.45); }
.badge.gray { background: rgba(148, 163, 184, 0.2); color: #e5edf9; border: 1px solid rgba(148, 163, 184, 0.45); }

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

.field {
  display: flex;
  flex-direction: column;
  gap: 0.36rem;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  font-weight: 700;
  color: #eff6ff;
}

.field input[type="text"],
.field input[type="url"],
.field input[type="number"],
.field select,
.field textarea {
  width: 100%;
  border: 1px solid #4f709f;
  border-radius: 10px;
  background: rgba(9, 19, 36, 0.95);
  color: #fff;
  min-height: 42px;
  padding: 0.58rem 0.62rem;
}

.field textarea {
  resize: vertical;
  min-height: 90px;
}

.choice-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem 0.7rem;
  margin: 0;
  padding: 0;
}

.choice-list > div {
  margin: 0;
}

.choice-list label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 500;
}

.form-help {
  color: #c9dbf8;
  font-size: 0.84rem;
}

.form-errors {
  margin: 0;
  color: #ffddd6;
  font-size: 0.83rem;
}

.flow-nav {
  display: flex;
  gap: 0.64rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.diagram-layout {
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 0.9rem;
}

.toolbox .hint {
  margin: 0.25rem 0 0.6rem;
  color: #bfd2ee;
  font-size: 0.85rem;
}

.toolbox-editor {
  border: 1px solid rgba(102, 138, 186, 0.42);
  border-radius: 10px;
  padding: 0.7rem;
  background: rgba(13, 28, 50, 0.82);
}

.toolbox-editor .field {
  margin-bottom: 0.45rem;
}

.canvas-wrap {
  position: relative;
  border: 1px solid #3f5f8e;
  border-radius: 12px;
  background: linear-gradient(180deg, #0a1d39 0%, #091a31 100%);
  overflow: hidden;
}

.canvas {
  position: relative;
  width: 100%;
  min-height: 560px;
  background-image:
    linear-gradient(rgba(90, 126, 180, 0.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(90, 126, 180, 0.14) 1px, transparent 1px);
  background-size: 20px 20px;
}

.canvas svg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

#edgeFlowLayer .flow-dot {
  filter: drop-shadow(0 0 6px rgba(125, 211, 252, 0.9));
}

.node {
  position: absolute;
  border-radius: 11px;
  border: 1px solid rgba(128, 161, 214, 0.8);
  background: #dfefff;
  color: #092247;
  font-weight: 700;
  font-size: 0.82rem;
  line-height: 1.25;
  padding: 0.34rem 0.45rem 0.36rem;
  cursor: move;
  user-select: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.node > span {
  display: block;
  padding-right: 1.1rem;
}

.node small {
  display: block;
  opacity: 0.86;
  font-weight: 500;
  padding-right: 1.1rem;
}

.node-delete {
  position: absolute;
  top: 5px;
  right: 6px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid rgba(140, 33, 33, 0.35);
  background: rgba(255, 255, 255, 0.84);
  color: #9f1616;
  font-size: 0.9rem;
  line-height: 1;
  font-weight: 800;
  padding: 0;
  cursor: pointer;
}

.node-delete:hover {
  background: #ffe3e3;
  border-color: rgba(159, 22, 22, 0.55);
}

.node.selected {
  outline: 2px solid #f59e0b;
}

.node.connect-source {
  outline: 2px solid #7dd3fc;
  box-shadow: 0 0 0 2px rgba(125, 211, 252, 0.3), 0 4px 12px rgba(0, 0, 0, 0.25);
}

.btn.mode-on {
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
  border-color: #93c5fd;
  color: #f8fbff;
}

.small {
  color: #c3d5f2;
  font-size: 0.84rem;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.table th,
.table td {
  border-bottom: 1px solid #355278;
  padding: 0.55rem 0.48rem;
  text-align: left;
}

.table th {
  color: #d4e8ff;
}

.footer {
  border-top: 1px solid rgba(102, 136, 186, 0.35);
  color: #c6d9f5;
  padding: 1.2rem 0 1.8rem;
  margin-top: 2rem;
}

@media (max-width: 1024px) {
  .diagram-layout {
    grid-template-columns: 1fr;
  }
  .grid-3 {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .telecom-header-inner {
    min-height: 58px;
    align-items: flex-start;
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
  }
  .header-nav {
    gap: 0.55rem;
  }
  .header-nav a {
    font-size: 0.82rem;
  }
  .form-grid,
  .grid-2,
  .grid-3,
  .choice-list {
    grid-template-columns: 1fr;
  }
  .canvas {
    min-height: 430px;
  }
}
