:root {
  --bg: #f7f8fc;
  --card: #ffffff;
  --text: #1c2033;
  --muted: #5d6480;
  --line: #e3e6f0;
  --accent: #4f46e5;
  --accent-dark: #4338ca;
  --accent-soft: #eef0ff;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
a { color: var(--accent); }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { font-weight: 800; font-size: 1.35rem; color: var(--text); text-decoration: none; letter-spacing: -0.5px; }
.logo span { color: var(--accent); }
.nav a { margin-left: 22px; color: var(--muted); text-decoration: none; font-weight: 500; }
.nav a:hover { color: var(--accent); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--card); margin-top: 60px; padding: 26px 0; color: var(--muted); font-size: 0.92rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; }
.site-footer a { color: var(--muted); margin-left: 16px; text-decoration: none; }
.site-footer a:first-child { margin-left: 0; }

/* Home */
.hero { text-align: center; padding: 64px 0 36px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3rem); line-height: 1.15; margin: 0 0 16px; letter-spacing: -1px; }
.hero p { max-width: 620px; margin: 0 auto; color: var(--muted); font-size: 1.12rem; }
.section-title { font-size: 1.4rem; margin: 40px 0 18px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; text-decoration: none; color: inherit; display: block; transition: box-shadow .15s, transform .15s; }
a.card:hover { box-shadow: 0 8px 24px rgba(79, 70, 229, .12); transform: translateY(-2px); }
.card h3 { margin: 10px 0 6px; font-size: 1.15rem; }
.card p { margin: 0; color: var(--muted); font-size: .96rem; }
.icon { width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.icon.img { width: 72px; height: 72px; background: none; border-radius: 0; margin-bottom: 4px; }
.icon.img img { width: 100%; height: 100%; display: block; }
.card.soon { border-style: dashed; background: transparent; }
.tag { display: inline-block; font-size: .75rem; font-weight: 600; background: var(--accent-soft); color: var(--accent); padding: 2px 10px; border-radius: 99px; margin-top: 12px; }

/* Tool page */
.tool-head { padding: 36px 0 18px; }
.tool-head h1 { margin: 0 0 8px; font-size: clamp(1.7rem, 4vw, 2.3rem); letter-spacing: -.5px; }
.tool-head p { margin: 0; color: var(--muted); max-width: 720px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tab { border: 1px solid var(--line); background: var(--bg); padding: 8px 16px; border-radius: 99px; cursor: pointer; font: inherit; font-weight: 600; color: var(--muted); }
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
input[type="text"], input[type="number"], textarea { font: inherit; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; color: var(--text); }
input[type="text"] { flex: 1; min-width: 220px; }
textarea { width: 100%; min-height: 150px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .88rem; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.btn { font: inherit; font-weight: 600; border: 1px solid var(--line); background: #fff; color: var(--text); padding: 10px 16px; border-radius: 10px; cursor: pointer; text-decoration: none; display: inline-block; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); color: #fff; }
.btn.small { padding: 6px 12px; font-size: .9rem; }
.btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.hint { color: var(--muted); font-size: .88rem; margin: 10px 0 0; }
.pane { display: none; }
.pane.active { display: block; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar .sep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
.size-inputs { display: flex; align-items: center; gap: 6px; }
.size-inputs input { width: 82px; padding: 6px 8px; }
.readout { font-weight: 600; margin-left: auto; font-size: .92rem; color: var(--accent); }

.stage { background: repeating-conic-gradient(#eceef6 0% 25%, #f4f5fa 0% 50%) 50% / 24px 24px; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 28px 30px; overflow: auto; min-height: 300px; }
.device { position: relative; margin: 0 auto; }
.device iframe { position: absolute; top: 0; left: 0; border: 0; background: #fff; transform-origin: 0 0; box-shadow: 0 4px 24px rgba(20, 24, 60, .18); border-radius: 4px; }
.handle { position: absolute; background: var(--accent); opacity: .35; border-radius: 6px; touch-action: none; z-index: 5; transition: opacity .15s; }
.handle:hover, .handle.drag { opacity: .9; }
.handle.r, .handle.l { top: 50%; width: 10px; height: 64px; margin-top: -32px; cursor: ew-resize; }
.handle.r { right: -18px; }
.handle.l { left: -18px; }
.handle.b { left: 50%; bottom: -18px; height: 10px; width: 64px; margin-left: -32px; cursor: ns-resize; }

/* SEO content */
.content { max-width: 800px; margin-top: 44px; }
.content h2 { margin: 32px 0 10px; font-size: 1.35rem; }
.content p, .content li { color: #3b4160; }
.content details { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin-bottom: 10px; }
.content summary { cursor: pointer; font-weight: 600; }
.content details p { margin: 10px 0 0; }

@media (max-width: 600px) {
  .nav a { margin-left: 14px; }
  .readout { margin-left: 0; width: 100%; }
  .toolbar .sep { display: none; }
  .stage { padding: 14px 24px 26px; }
}
