:root {
  --bg: #0b1020;
  --panel: #141a2e;
  --panel-2: #1b2238;
  --line: #2a3350;
  --text: #e7ebf5;
  --muted: #9aa6c4;
  --accent: #6ea8ff;
  --accent-2: #b07bff;
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  font-family: "Noto Sans JP", system-ui, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 700px at 20% -10%, #1a2540 0%, transparent 60%), var(--bg);
  background-color: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ---- ヘッダー ---- */
header {
  padding: 40px 24px 24px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(110, 168, 255, 0.08), transparent);
}

.header-inner {
  max-width: 1180px;
  margin: 0 auto;
  position: relative;
}

h1 {
  margin: 0 0 10px;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1 .accent {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

header p {
  margin: 0;
  color: var(--muted);
  max-width: 720px;
}

.lang-switch {
  position: absolute;
  top: 0;
  right: 0;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
  border: 1px solid var(--line);
  padding: 6px 14px;
  border-radius: 999px;
  transition: all 0.2s;
}

.lang-switch:hover {
  color: var(--text);
  border-color: var(--accent);
}

/* ---- レイアウト ---- */
.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 24px 0;
}

.layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}

/* ---- ステージ（プレビュー） ---- */
.canvas-wrap {
  position: relative;
  height: 460px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: #000;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

#preview {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#preview:active {
  cursor: grabbing;
}

/* ガラス内テキスト（出力スニペットと同じ見た目になるよう揃える） */
.glass-label {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: system-ui, -apple-system, sans-serif;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.01em;
  pointer-events: none;
  white-space: nowrap;
}

.drag-hint {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  margin: 0;
  font-size: 0.9rem;
  color: #fff;
  background: rgba(10, 14, 28, 0.55);
  backdrop-filter: blur(8px);
  padding: 6px 14px;
  border-radius: 999px;
  pointer-events: none;
  white-space: nowrap;
}

/* ---- 背景バー ---- */
.bg-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.bg-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.bg-thumb {
  width: 64px;
  height: 44px;
  border-radius: 10px;
  border: 2px solid var(--line);
  background-size: cover;
  background-position: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.18s;
}

.bg-thumb:hover {
  transform: translateY(-2px);
}

.bg-thumb.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(110, 168, 255, 0.25);
}

.bg-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  color: var(--text);
  border: 1px dashed var(--line);
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.18s;
}

.bg-upload-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---- コントロールパネル ---- */
.panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

.card-title {
  font-weight: 700;
  margin-bottom: 14px;
  font-size: 1rem;
}

.shape-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.shape-btn {
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
  transition: all 0.18s;
}

.shape-btn:hover {
  color: var(--text);
}

.shape-btn.active {
  color: #fff;
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(110, 168, 255, 0.25), rgba(176, 123, 255, 0.2));
}

.slider-row {
  display: block;
  margin-bottom: 16px;
}

.slider-row:last-child {
  margin-bottom: 0;
}

.slider-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.slider-label em {
  font-style: normal;
  color: var(--accent);
  font-family: "JetBrains Mono", monospace;
}

input[type="range"] {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--panel-2);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
}

.text-input {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
}

.text-input:focus {
  outline: none;
  border-color: var(--accent);
}

.text-input::placeholder {
  color: var(--muted);
}

.tint-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

input[type="color"] {
  width: 52px;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: none;
  cursor: pointer;
  padding: 4px;
}

.tint-opacity {
  flex: 1;
  margin-bottom: 0;
}

/* ---- 出力 ---- */
.output-section {
  margin-top: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.output-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.output-head h2 {
  margin: 0;
  font-size: 1.15rem;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.18s;
}

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

.copy-btn.copied {
  background: #2ecc71;
}

#output {
  width: 100%;
  height: 220px;
  resize: vertical;
  background: #0a0f1e;
  color: #cfe0ff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.9rem;
  line-height: 1.6;
  white-space: pre;
  overflow: auto;
}

.output-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.output-note code,
.article code {
  background: var(--panel-2);
  padding: 2px 7px;
  border-radius: 6px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.9em;
  color: var(--accent);
}

/* ---- 解説 ---- */
.article {
  margin: 36px 0;
  max-width: 820px;
}

.article h2 {
  font-size: 1.4rem;
  letter-spacing: -0.01em;
  margin: 28px 0 12px;
}

.article h3 {
  font-size: 1.15rem;
  margin: 24px 0 10px;
}

.article p {
  color: #c7d0e6;
  margin: 0 0 14px;
}

.article ul {
  color: #c7d0e6;
  padding-left: 22px;
}

.article li {
  margin-bottom: 8px;
}

.article ol {
  color: #c7d0e6;
  padding-left: 22px;
}

.answer-box {
  background: linear-gradient(135deg, rgba(110, 168, 255, 0.12), rgba(176, 123, 255, 0.1));
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 20px;
}

.answer-box p {
  margin: 0;
  color: var(--text);
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0 8px;
  font-size: 0.95rem;
}

.compare-table th,
.compare-table td {
  border: 1px solid var(--line);
  padding: 10px 14px;
  text-align: left;
  color: #c7d0e6;
}

.compare-table th {
  background: var(--panel-2);
  color: var(--text);
  font-weight: 700;
}

.compare-table td:first-child {
  color: var(--muted);
}

.faq {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.faq-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
}

.faq-item h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
  color: var(--text);
}

.faq-item p {
  margin: 0;
}

/* ---- フッター ---- */
footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 40px;
  color: var(--muted);
  font-size: 1rem;
  border-top: 1px solid var(--line);
  background: var(--panel);
  margin-top: 40px;
}

footer a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s;
}

footer a:hover {
  color: var(--accent);
}

.footer-links {
  display: flex;
  gap: 16px;
}

.footer-links a {
  border: 1px solid var(--line);
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 1rem;
  transition: all 0.2s;
}

.footer-links a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---- レスポンシブ ---- */
@media (max-width: 920px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .canvas-wrap {
    height: 360px;
  }
}

@media (max-width: 768px) {
  h1 {
    font-size: 1.6rem;
  }
  footer {
    flex-direction: column;
    gap: 16px;
    padding: 24px 16px;
    text-align: center;
  }
  .footer-links {
    flex-wrap: wrap;
    justify-content: center;
  }
}
