:root {
  --bg: #0b1020;
  --bg-soft: #141a2e;
  --card: #1a2138;
  --line: #2a3350;
  --text: #e7ecff;
  --muted: #9aa6c9;
  --accent: #6ea8ff;
  --accent-2: #b388ff;
  --ok: #79ffe1;
  --warn: #ffd479;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #1b2b4a, transparent), var(--bg);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }

/* ===== ヘッダー ===== */
header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 28px; border-bottom: 1px solid var(--line);
  background: rgba(11, 16, 32, 0.8); backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 50;
}
header .brand { font-weight: 800; font-size: 1.2rem; letter-spacing: -0.02em; }
header .brand span { background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lang-switch { font-size: 0.95rem; border: 1px solid var(--line); padding: 6px 14px; border-radius: 999px; color: var(--text); text-decoration: none; transition: all 0.2s; }
.lang-switch:hover { border-color: var(--accent); color: var(--accent); }

/* ===== ヒーロー ===== */
.hero { text-align: center; padding: 40px 20px 8px; }
.hero h1 { font-size: 2rem; letter-spacing: -0.02em; line-height: 1.3; }
.hero h1 span { background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); max-width: 680px; margin: 12px auto 0; font-size: 1.05rem; }

/* ===== レイアウト ===== */
.layout { display: grid; grid-template-columns: 340px 1fr; gap: 24px; max-width: 1200px; margin: 24px auto; padding: 0 20px; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }

/* ===== コントロール ===== */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.panel h2 { font-size: 1rem; color: var(--muted); margin-bottom: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.field { margin-bottom: 16px; }
.field > label { display: flex; justify-content: space-between; font-size: 0.95rem; color: var(--text); margin-bottom: 6px; }
.field .val { color: var(--accent); font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="color"] { width: 100%; height: 38px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-soft); cursor: pointer; }
input[type="text"] { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-soft); color: var(--text); font-size: 1rem; }
.shape-row, .bg-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { flex: 1; min-width: 64px; text-align: center; padding: 9px 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-soft); color: var(--text); font-size: 0.95rem; cursor: pointer; transition: all 0.15s; }
.chip:hover { border-color: var(--accent); }
.chip.active { border-color: var(--accent); background: rgba(110, 168, 255, 0.15); color: var(--accent); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* サイドバー単体スクロール（デスクトップのみ。スティッキー＋独自スクロールで本体と切り離す） */
@media (min-width: 901px) {
  .layout > .panel { position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow-y: auto; }
}

/* ===== プレビュー ===== */
.stage-wrap { display: flex; flex-direction: column; gap: 14px; }
.support-notice { font-size: 0.95rem; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-soft); }
.support-notice.ok { color: var(--ok); border-color: rgba(121, 255, 225, 0.3); }
.support-notice.warn { color: var(--warn); border-color: rgba(255, 212, 121, 0.3); }
.bg-row .chip { flex: 0 0 auto; }

.preview-stage { height: 440px; overflow-y: auto; position: relative; border-radius: 16px; border: 1px solid var(--line); }
.preview-track { min-height: 1500px; position: relative; }
.lg-sticky { position: sticky; top: 50%; z-index: 5; display: flex; justify-content: center; }
.lg-sticky-inner { transform: translateY(-50%); }
.scroll-hint { position: sticky; top: 12px; z-index: 6; text-align: center; color: #fff; font-weight: 700; text-shadow: 0 1px 3px rgba(0,0,0,.6); pointer-events: none; }

/* 背景バリエーション（スクロールで動く＝屈折が追従する） */
.bg-colorful { background: repeating-linear-gradient(48deg, #ff5470 0 46px, #ffb703 46px 92px, #06d6a0 92px 138px, #3a86ff 138px 184px); }
.bg-photo { background: #11162b url("../assets/preview.jpg?v=20260619") top center / 100% auto repeat-y; }
.bg-text { background-color: #11162b; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='120'%3E%3Ctext x='0' y='70' font-size='64' font-weight='800' font-family='sans-serif' fill='%23ffffff'%3EGLASS%3C/text%3E%3C/svg%3E"); background-repeat: repeat; }

/* ===== 出力 ===== */
.output { margin-top: 18px; }
.output-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .output-grid { grid-template-columns: 1fr; } }
.code-block { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.code-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.code-head h3 { font-size: 1rem; }
.copy-btn { font-size: 0.9rem; border: 1px solid var(--accent); color: var(--accent); background: transparent; padding: 6px 14px; border-radius: 8px; cursor: pointer; transition: all 0.15s; }
.copy-btn:hover { background: rgba(110, 168, 255, 0.15); }
textarea.code { width: 100%; min-height: 200px; background: #0d1226; color: #cfe0ff; border: 1px solid var(--line); border-radius: 8px; padding: 12px; font-family: "SFMono-Regular", Consolas, monospace; font-size: 0.95rem; resize: vertical; line-height: 1.5; }

/* ===== AdSense ===== */
.ad-wrap { max-width: 728px; margin: 32px auto; text-align: center; min-height: 90px; }

/* ===== 記事 ===== */
.article { max-width: 860px; margin: 40px auto; padding: 0 20px; }
.article h2 { font-size: 1.5rem; margin: 32px 0 12px; letter-spacing: -0.01em; }
.article h3 { font-size: 1.2rem; margin: 22px 0 8px; }
.article p { color: #c7d0ec; margin-bottom: 12px; }
.article ul, .article ol { color: #c7d0ec; margin: 0 0 14px 22px; }
.article li { margin-bottom: 6px; }
.answer-box { background: rgba(110, 168, 255, 0.1); border-left: 4px solid var(--accent); padding: 16px 18px; border-radius: 8px; margin-bottom: 18px; }
.answer-box p { color: var(--text); margin: 0; }
.compare-table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 0.98rem; }
.compare-table th, .compare-table td { border: 1px solid var(--line); padding: 10px 12px; text-align: left; }
.compare-table th { background: var(--bg-soft); }
.faq-item { border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; margin-bottom: 12px; background: var(--card); }
.faq-item h3 { margin: 0 0 6px; font-size: 1.05rem; }
.faq-item p { margin: 0; color: #c7d0ec; }
.related { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px; }
.related a { border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; text-decoration: none; color: var(--text); background: var(--card); transition: all 0.15s; }
.related a:hover { border-color: var(--accent); color: var(--accent); }

/* ===== フッター ===== */
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); 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: 768px) {
  footer { flex-direction: column; gap: 16px; padding: 24px 16px; text-align: center; }
  .footer-links { flex-wrap: wrap; justify-content: center; }
  header { padding: 14px 16px; }
}
