:root {
  --bg: #fff7ed;
  --card: #ffffff;
  --line: #fde7c9;
  --text: #2b2118;
  --muted: #8a7762;
  --accent: #f97316;
  --accent-hover: #ea580c;
  --accent-soft: #ffedd5;
  --ok: #16a34a;
  --ok-hover: #15803d;
  --err: #d92d20;
  --radius: 22px;
  --shadow: 0 10px 30px -14px rgba(120, 70, 20, .25);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Nunito", "Avenir Next", "Segoe UI", -apple-system, Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); }
button { font: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* top bar */
.top { background: var(--card); border-bottom: 1px solid var(--line); }
.top-inner {
  display: flex; justify-content: space-between; align-items: center;
  max-width: 960px; margin: 0 auto; padding: 12px 16px;
}
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700; text-decoration: none; color: var(--text); font-size: 17px;
}
.brand-mark { width: 22px; height: 22px; border-radius: 6px; background: var(--accent); display: inline-block; }
.top-nav { display: flex; gap: 16px; font-size: 14px; align-items: center; white-space: nowrap; }
.top-nav a { color: var(--muted); text-decoration: none; }
.top-nav a:hover { color: var(--text); }

/* layout */
.wrap { width: 100%; max-width: 680px; margin: 0 auto; padding: 0 16px 48px; flex: 1; }

/* hero */
.hero { padding: 40px 0 8px; text-align: center; }
h1 { font-size: 30px; line-height: 1.2; font-weight: 700; margin: 0 0 8px; letter-spacing: -.01em; }
.lede { color: var(--muted); font-size: 15px; margin: 0 auto 22px; max-width: 520px; }

.grab {
  display: flex; gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px;
  box-shadow: var(--shadow);
  text-align: left;
}
.grab:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field { flex: 1; display: flex; align-items: center; min-width: 0; }
.field input {
  flex: 1; min-width: 0;
  background: transparent; border: 0; outline: 0;
  color: var(--text); font-size: 16px; padding: 10px 12px;
}
.field input::placeholder { color: #98a2b3; }
.ghost {
  background: transparent; border: 0; color: var(--accent);
  padding: 8px 10px; border-radius: 8px; font-weight: 600; font-size: 14px;
}
.ghost:hover { background: var(--accent-soft); }
#clear { font-size: 20px; line-height: 1; padding: 4px 10px; color: var(--muted); }

.primary {
  position: relative;
  background: var(--accent); color: #fff;
  border: 0; border-radius: 9px;
  padding: 0 20px; font-weight: 600; font-size: 15px;
  min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none;
  transition: background .15s ease;
}
.primary:hover { background: var(--accent-hover); }
.primary[disabled] { opacity: .65; cursor: progress; }
.primary.big { width: 100%; min-height: 48px; font-size: 16px; }
.spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  animation: spin .7s linear infinite; display: none;
}
.busy .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.msg { min-height: 0; margin: 8px 0 0; font-size: 14px; color: var(--muted); }
.msg:empty { display: none; }
.msg.err { color: var(--err); }

.platforms {
  list-style: none; padding: 0; margin: 16px 0 0;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px;
  color: var(--muted); font-size: 13px;
}
.platforms li { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }

/* result */
.result { padding: 16px 0 0; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
  display: grid; gap: 14px;
  grid-template-columns: 96px 1fr;
  grid-template-areas:
    "media meta"
    "choose choose"
    "action action"
    "done done";
}
.media {
  grid-area: media; position: relative;
  border-radius: 8px; overflow: hidden; background: #eef1f5;
  aspect-ratio: 9/16;
}
.media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dur {
  position: absolute; right: 5px; bottom: 5px;
  background: rgba(0,0,0,.75); color: #fff; font-size: 11px; font-weight: 600;
  padding: 1px 5px; border-radius: 4px;
}
.dur:empty { display: none; }
.meta { grid-area: meta; min-width: 0; align-self: center; }
.pill {
  display: inline-block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--accent); background: var(--accent-soft); padding: 2px 8px; border-radius: 999px; margin-bottom: 6px;
}
.meta h2 {
  margin: 0; font-size: 16px; line-height: 1.35; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.by { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.card.wide { grid-template-columns: 180px 1fr; }
.card.wide .media { aspect-ratio: 16/9; }

.choose { grid-area: choose; display: grid; gap: 10px; }
.seg {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--card);
}
.seg button {
  background: transparent; border: 0; border-right: 1px solid var(--line); padding: 10px 6px;
  font-weight: 500; font-size: 14px; color: var(--muted); white-space: nowrap;
}
.seg button:last-child { border-right: 0; }
.seg button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.seg button[disabled] { opacity: .4; cursor: not-allowed; }
.qual { display: flex; flex-wrap: wrap; gap: 6px; }
.qual:empty { display: none; }
.qual button {
  background: var(--card); border: 1px solid var(--line); color: var(--muted);
  border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 500;
}
.qual button[aria-checked="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); font-weight: 600; }

.action { grid-area: action; display: grid; gap: 8px; }
.prog { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.prog i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s ease; border-radius: 999px; }
.prog.indet i { width: 30%; animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%);} 100% { transform: translateX(400%);} }
.phase { margin: 0; font-size: 13px; color: var(--muted); min-height: 18px; text-align: center; }
.phase.err { color: var(--err); }

.done { grid-area: done; display: grid; gap: 6px; text-align: center; }
.done .primary { background: var(--ok); }
.done .primary:hover { background: var(--ok-hover); }
.fileinfo { margin: 0; font-size: 13px; color: var(--muted); word-break: break-word; }
.link { background: none; border: 0; color: var(--accent); font-size: 14px; padding: 6px; }
.link:hover { text-decoration: underline; }

/* how / faq */
.how, .faq { padding: 40px 0 0; }
.how h2, .faq h2 { font-size: 20px; margin: 0 0 12px; }
.how ol { padding-left: 20px; margin: 0; color: var(--muted); display: grid; gap: 8px; }
.how b { color: var(--text); font-weight: 600; }
details { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; }
summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; font-size: 15px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; color: var(--muted); font-weight: 400; }
details[open] summary::after { content: "–"; }
details p { margin: 8px 0 0; color: var(--muted); font-size: 14px; }

.foot {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  max-width: 960px; width: 100%; margin: 0 auto; padding: 20px 16px calc(16px + env(safe-area-inset-bottom));
  color: var(--muted); font-size: 12px; border-top: 1px solid var(--line);
}

@media (max-width: 900px) {
  .top-nav a:not(.lang) { display: none; }
}
@media (max-width: 560px) {
  .hero { padding-top: 28px; }
  h1 { font-size: 24px; }
  .grab { flex-direction: column; }
  .primary { min-height: 46px; }
  .top-nav { display: none; }
  .seg button { font-size: 13px; padding: 10px 2px; }
  .card.wide { grid-template-columns: 1fr; grid-template-areas: "media" "meta" "choose" "action" "done"; }
}
:root { --bg:#fff7ed; --card:#fff; --line:#fde7c9; --text:#2b2118; --muted:#8a7762; --accent:#f97316; --accent-hover:#ea580c; --accent-soft:#ffedd5; --ok:#16a34a; --ok-hover:#15803d; --radius:22px; --shadow:0 10px 30px -14px rgba(120,70,20,.25); }
body { font-family: "Nunito", "Avenir Next", "Segoe UI", -apple-system, Roboto, sans-serif; }
.top { background: transparent; border: 0; }
.brand { font-weight: 900; }
.brand-mark { border-radius: 50%; }
.hero { padding-top: 48px; }
h1 { font-size: 34px; font-weight: 900; letter-spacing: -.02em; }
.grab { border-radius: 999px; padding: 8px 8px 8px 14px; border-width: 2px; }
.grab:focus-within { box-shadow: none; }
.primary { border-radius: 999px; font-weight: 800; }
.primary.big { border-radius: 16px; }
.platforms li { background: #fff; border-color: var(--line); color: var(--text); font-weight: 600; }
.card { border-width: 2px; }
.seg { border-radius: 14px; border-width: 2px; }
.seg button { font-weight: 700; }
.qual button { border-width: 2px; font-weight: 700; }
details { border-width: 2px; border-radius: 16px; }
@media (max-width:560px){ .grab { border-radius: 20px; padding: 8px; } }

/* ---- v2 widget additions ---- */
.lang { font-size: 13px; color: var(--muted); text-decoration: none; margin-left: 16px; }
.lang:hover { color: var(--text); }
.seg { grid-auto-columns: minmax(0, 1fr); }
.seg button { padding: 10px 4px; font-size: 13px; }
.opt { display: grid; gap: 8px; }
.opt-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 14px; color: var(--muted); }
.opt-row label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.opt-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.opt-row .range { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.opt-row input[type="text"] {
  width: 92px; padding: 8px 10px; border: 2px solid var(--line); border-radius: 10px; font: inherit; font-size: 15px;
  color: var(--text); background: var(--card); text-align: center;
}
.opt-row input[type="text"]:focus { outline: 0; border-color: var(--accent); }
.hint { font-size: 12px; color: var(--muted); }
.note { font-size: 13px; color: var(--accent); margin: 8px 0 0; }
.note:empty { display: none; }
.cap { grid-area: action; display: grid; gap: 10px; }
.cap textarea {
  width: 100%; min-height: 160px; resize: vertical; padding: 12px; border: 2px solid var(--line); border-radius: 12px;
  font: inherit; font-size: 15px; line-height: 1.5; color: var(--text); background: var(--bg);
}
.cap .tags { font-size: 14px; color: var(--muted); line-height: 1.7; word-break: break-word; }
.cap .row { display: flex; flex-wrap: wrap; gap: 8px; }
.cap .row .primary { flex: 1; min-width: 160px; min-height: 46px; }
.secondary {
  background: var(--card); color: var(--accent); border: 2px solid var(--accent); border-radius: 999px;
  padding: 0 18px; font-weight: 800; font-size: 15px; min-height: 46px; display: inline-flex; align-items: center; justify-content: center; flex: 1; min-width: 160px;
}
.secondary:hover { background: var(--accent-soft); }
.intro { padding: 36px 0 0; color: var(--text); font-size: 16px; }
.intro p { margin: 0 0 12px; color: #4a3f33; }
.tools { padding: 40px 0 0; }
.tools h2 { font-size: 20px; margin: 0 0 12px; }
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.tools-grid a {
  display: block; padding: 12px 14px; background: var(--card); border: 2px solid var(--line); border-radius: 14px;
  text-decoration: none; color: var(--text); font-weight: 700; font-size: 14px;
}
.tools-grid a:hover { border-color: var(--accent); }
.tools-grid small { display: block; color: var(--muted); font-weight: 500; margin-top: 2px; }
.meta-line { margin: 28px 0 0; font-size: 13px; color: var(--muted); }
.meta-line a { color: var(--muted); }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.foot-links a { color: var(--muted); text-decoration: none; }
.foot-links a:hover { text-decoration: underline; }
.page { padding: 40px 0 0; }
.page h1 { font-size: 30px; text-align: left; }
.page h2 { font-size: 20px; margin: 24px 0 8px; }
.page p { color: #4a3f33; }
@media (max-width: 560px) {
  .seg { grid-auto-flow: row; grid-template-columns: repeat(3, 1fr); }
  .seg button { border-bottom: 1px solid var(--line); }
  .seg button:nth-child(n+4) { border-bottom: 0; }
  .seg button:nth-child(3n) { border-right: 0; }
  .cap textarea { min-height: 140px; }
}
