:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #2b3240;
  --muted: #687082;
  --border: #e3e6ec;
  --blue: #1f74d4;
  --blue-dark: #165fb0;
  --red: #e8483b;
  --red-dark: #c93a2f;
  --dark: #3a4250;
  --green: #4cae7c;
  --accent: #f26b4f;
  --teal: #149c9c;
  --note-bg: #e4f2fc;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans", "Noto Sans CJK JP", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
.container { max-width: 1140px; margin: 0 auto; padding: 0 16px; }

/* Header */
.site-header { background: var(--card); border-bottom: 1px solid var(--border); }
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 84px; }
.logo { font-size: clamp(1.6rem, 5vw, 2.4rem); font-weight: 900; text-decoration: none; letter-spacing: -1px; white-space: nowrap; }
.logo .a { color: var(--accent); }
.logo .to { color: var(--dark); font-size: .7em; margin: 0 6px; }
.logo .b { color: var(--teal); }
.lang {
  border: 1px solid var(--blue); color: var(--blue); background: var(--card);
  border-radius: 6px; padding: 8px 12px; font-weight: 600; font-size: 1rem; cursor: pointer; max-width: 160px;
}

/* Intro */
.intro { padding: 48px 16px 24px; }
.intro h1 { text-align: center; font-size: clamp(1.7rem, 4vw, 2.4rem); margin-bottom: 24px; }
.intro p { font-size: 1.1rem; }
.intro ul { margin: 16px 0 0 20px; font-size: 1.1rem; }
.intro li { margin: 6px 0; }
.intro li::marker { color: #b5bac5; }

/* Tabs */
.tabs { display: flex; gap: 6px; margin-top: 24px; }
.tab {
  display: inline-block; background: #e9ebef; padding: 12px 24px; font-size: 1rem; font-weight: 700;
  color: var(--dark); border-radius: 8px 8px 0 0; text-decoration: none;
}
.tab:hover { background: #dfe2e8; }
.tab.active { background: var(--card); color: var(--accent); }

/* Tool box */
.tool {
  background: var(--card); border-radius: 0 8px 8px 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,.06); padding: 32px 16px;
}
.btn-row { display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-width: 190px; padding: 11px 22px; border: none; border-radius: 4px;
  color: #fff; font-size: 1rem; font-weight: 700; letter-spacing: .5px;
  text-transform: uppercase; cursor: pointer; position: relative; font-family: inherit;
}
.btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.btn-blue { background: var(--blue); } .btn-blue:hover { background: var(--blue-dark); }
.btn-red { background: var(--red); } .btn-red:hover { background: var(--red-dark); }
.btn-dark { background: var(--dark); } .btn-dark:hover { background: #2a303b; }
.btn-green { background: var(--green); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.badge {
  position: absolute; top: -12px; right: -12px; background: var(--dark); color: #fff;
  border: 2px solid #fff; border-radius: 50%; width: 28px; height: 28px;
  font-size: .8rem; display: flex; align-items: center; justify-content: center;
}
.badge[hidden] { display: none; }

/* Drop area + carousel */
.drop-area {
  margin: 28px 0; position: relative; min-height: 220px;
  border: 2px dashed transparent; border-radius: 8px; transition: border-color .2s;
}
.drop-area.drag { border-color: var(--blue); background: #f2f8ff; }
.empty {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; color: var(--muted); text-align: center;
  border: 2px dashed var(--border); border-radius: 8px; cursor: pointer; padding: 16px;
}
.empty[hidden], .carousel[hidden] { display: none; }
.empty strong { color: var(--text); font-size: 1.1rem; }
.carousel { display: flex; align-items: center; gap: 8px; }
.arrow {
  background: none; border: none; color: var(--accent); font-size: 2.6rem; line-height: 1;
  cursor: pointer; padding: 0 6px; flex-shrink: 0;
}
.track {
  display: flex; gap: 18px; overflow-x: auto; scroll-behavior: smooth;
  padding: 8px 2px; flex: 1; scrollbar-width: none;
}
.track::-webkit-scrollbar { display: none; }

.card {
  position: relative; width: 204px; height: 204px; flex-shrink: 0;
  border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
  background: repeating-conic-gradient(#d9d9d9 0 25%, #f2f2f2 0 50%) 50% / 18px 18px;
}
.card img { width: 100%; height: 100%; object-fit: contain; }
.card .fname {
  position: absolute; top: 0; left: 0; right: 36px; padding: 6px 10px;
  font-size: .8rem; font-weight: 600; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.8);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card .remove {
  position: absolute; top: 6px; right: 6px; width: 22px; height: 22px;
  background: rgba(255,255,255,.9); border: 1px solid #999; border-radius: 3px;
  cursor: pointer; font-size: 14px; line-height: 1; color: #444;
}
.card .label {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 1.9rem; font-weight: 900; color: #fff; pointer-events: none;
  text-shadow: 0 2px 6px rgba(0,0,0,.7);
}
.card .bottom {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 8px;
  display: flex; justify-content: center;
}
.card .save {
  background: var(--green); color: #fff; text-decoration: none; font-weight: 700;
  font-size: .85rem; padding: 6px 16px; border-radius: 4px; text-transform: uppercase;
}
.card .status { background: rgba(0,0,0,.65); color: #fff; font-size: .8rem; padding: 4px 10px; border-radius: 4px; }
.card .status.err { background: var(--red); }

/* Options */
.options {
  display: flex; justify-content: center; gap: 32px; flex-wrap: wrap;
  margin-top: 28px; color: var(--muted); font-size: .95rem;
}
.options label { display: flex; align-items: center; gap: 10px; }
.options input[type=range] { width: 160px; }
.options input[type=color] { width: 40px; height: 28px; border: 1px solid var(--border); border-radius: 4px; }

/* Content area */
.content { background: var(--card); margin-top: 56px; padding: 56px 0 64px; }
.content .container { max-width: 980px; }
.content h2 { font-size: clamp(1.5rem, 3.5vw, 2rem); margin: 44px 0 14px; }
.content h2:first-child { margin-top: 0; }
.content h3 { font-size: 1.3rem; margin: 28px 0 10px; }
.content p { font-size: 1.1rem; margin-bottom: 14px; }
.content ul, .content ol { margin: 0 0 16px 26px; font-size: 1.1rem; }
.content li { margin: 6px 0; }
.note {
  background: linear-gradient(90deg, var(--note-bg), #d6ebfb); border-left: 5px solid var(--blue);
  border-radius: 0 8px 8px 0; padding: 18px 26px; margin: 26px 0; font-size: 1.1rem;
}
.note strong { color: var(--blue); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; margin: 16px 0 24px; font-size: 1rem; }
th, td { border: 1px solid var(--border); padding: 10px 14px; text-align: left; }
th { background: #f2f4f7; }
details { border: 1px solid var(--border); border-radius: 6px; padding: 14px 18px; margin: 10px 0; }
summary { font-weight: 700; cursor: pointer; font-size: 1.05rem; }
details p { margin: 10px 0 0; }

.content a { color: var(--blue); }
.content.info { margin-top: 0; min-height: 60vh; }
.content.info h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); margin-bottom: 20px; }

footer { text-align: center; color: var(--muted); font-size: .9rem; padding: 28px 16px; }
.footer-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 24px; margin-bottom: 10px; }
.footer-links a { color: var(--text); text-decoration: none; font-weight: 600; }
.footer-links a:hover { color: var(--blue); text-decoration: underline; }

@media (max-width: 600px) {
  .btn { min-width: 0; flex: 1; }
  .card { width: 160px; height: 160px; }
  .arrow { display: none; }
  .tab { padding: 10px 14px; font-size: .9rem; }
  .lang { max-width: 120px; }
}
