/* ================================================================
   GOGTubeもどき — ミニマル＆モダンスタイル（手書き・単一ファイル・依存ゼロ）
   配色は prefers-color-scheme で OS 設定に自動追従。
   ================================================================ */

:root {
  --bg:        #fbfbfa;
  --surface:   #ffffff;
  --surface-2: #f1f1ef;
  --text:      #1c1c1e;
  --muted:     #6b7280;
  --border:    #e6e6e2;
  --accent:    #4f46e5;
  --accent-2:  #db2777;
  --accent-fg: #ffffff;
  --danger:    #dc2626;
  --ok:        #16a34a;
  --warn:      #d97706;
  --radius:    14px;
  --radius-lg: 22px;
  --maxw:      860px;
  --gap:       1.1rem;
  --shadow:    0 1px 2px rgba(20,20,40,.04), 0 8px 24px -12px rgba(20,20,40,.18);
  --shadow-lg: 0 8px 40px -12px rgba(79,70,229,.35);
  --blob-1:    rgba(99,102,241,.28);
  --blob-2:    rgba(219,39,119,.22);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0f1115;
    --surface:   #181b21;
    --surface-2: #222730;
    --text:      #e8e8ea;
    --muted:     #98a0ad;
    --border:    #2b313b;
    --accent:    #7c83ff;
    --accent-2:  #ff6fae;
    --accent-fg: #0c0d10;
    --danger:    #f0656a;
    --ok:        #56d364;
    --warn:      #e0a64a;
    --shadow:    0 1px 2px rgba(0,0,0,.4), 0 10px 30px -12px rgba(0,0,0,.6);
    --shadow-lg: 0 10px 44px -14px rgba(124,131,255,.5);
    --blob-1:    rgba(99,102,241,.22);
    --blob-2:    rgba(219,39,119,.16);
  }
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}

/* 背景の装飾ブロブ（ぼかした図形）を固定配置 */
body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
}
body::before {
  width: 46vmax; height: 46vmax;
  top: -16vmax; right: -12vmax;
  background: var(--blob-1);
}
body::after {
  width: 40vmax; height: 40vmax;
  bottom: -14vmax; left: -14vmax;
  background: var(--blob-2);
}

body {
  position: relative;
  margin: 0 auto;
  max-width: var(--maxw);
  padding: 0 1.1rem 5rem;
  color: var(--text);
  font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
  line-height: 1.75;
  font-size: 16px;
}

/* ---------- リンク・見出し ---------- */
a { color: var(--accent); text-decoration: none; transition: color .15s ease; }
a:hover { text-decoration: underline; }

h1 { font-size: 1.6rem; margin: 1.3rem 0 .6rem; line-height: 1.3; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; margin: 1.6rem 0 .5rem; letter-spacing: -.01em; }
h3 { font-size: 1.05rem; margin: 1.1rem 0 .3rem; }
small { color: var(--muted); }
p { margin: .55rem 0; }
hr { border: none; border-top: 1px solid var(--border); margin: 1.6rem 0; }

/* セクション見出しにアクセントバー */
section.box > h1:first-child,
section.box > h2:first-child {
  position: relative;
  padding-left: .7rem;
}
section.box > h1:first-child::before,
section.box > h2:first-child::before {
  content: "";
  position: absolute;
  left: 0; top: .15em; bottom: .15em;
  width: 4px; border-radius: 4px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}

/* ---------- ヘッダー ---------- */
header.site {
  display: flex;
  flex-direction: column;
  gap: .9rem;
  padding: 1.4rem 0 1.2rem;
  margin-bottom: 1.8rem;
  border-bottom: 1px solid var(--border);
}
header.site .bar {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1rem;
  align-items: center;
  justify-content: space-between;
}
header.site .brand { display: flex; align-items: center; gap: .65rem; }
header.site .brand .logo {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: var(--shadow-lg);
  flex: 0 0 auto;
}
header.site .brand h1 { margin: 0; font-size: 1.3rem; }
header.site .brand small { display: block; }
header.site nav { display: flex; gap: .25rem; align-items: center; }
header.site nav a {
  padding: .35rem .8rem;
  border-radius: 999px;
  color: var(--text);
  font-size: .92rem;
  transition: background .15s ease;
}
header.site nav a:hover { background: var(--surface-2); text-decoration: none; }

/* 検索フォーム */
.search { display: flex; gap: .5rem; }
.search input { flex: 1 1 auto; }

/* ---------- フォーム要素 ---------- */
input[type="text"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: .65rem .85rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

label { font-weight: 600; }
fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 1.1rem 0;
  padding: .9rem 1.1rem;
  background: var(--surface-2);
}
legend { font-weight: 700; padding: 0 .4rem; }
fieldset .hint { font-weight: 400; font-size: .8rem; color: var(--muted); margin: .25rem 0 .6rem; }
.field { margin: 1.1rem 0; }
.field > label { display: block; margin-bottom: .4rem; }
.inline { display: inline-flex; align-items: center; gap: .35rem; margin-right: 1rem; font-weight: 400; }
.codecs { display: flex; flex-wrap: wrap; gap: 1rem; }
.codecs label { display: block; font-weight: 400; font-size: .85rem; color: var(--muted); margin-bottom: .25rem; }

/* ボタン */
button,
input[type="submit"],
.btn {
  display: inline-block;
  padding: .6rem 1.15rem;
  font: inherit;
  font-weight: 600;
  color: var(--accent-fg);
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .15s ease, filter .15s ease;
}
button:hover, input[type="submit"]:hover, .btn:hover {
  filter: brightness(1.06);
  text-decoration: none;
}
button:active, input[type="submit"]:active, .btn:active { transform: translateY(1px); }
button:disabled, input[type="submit"]:disabled {
  background: var(--surface-2);
  color: var(--muted);
  cursor: not-allowed;
  filter: none;
}
.btn-ghost {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}
.submit-main {
  width: 100%;
  padding: 1.05rem;
  font-size: 1.18rem;
  letter-spacing: .04em;
  margin-top: 1.2rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-lg);
}
.submit-main:hover { transform: translateY(-2px); }

/* ---------- メインのダウンロードフォーム（ヒーロー） ---------- */
form#urlForm {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.6rem 1.6rem 1.8rem;
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
}

/* ---------- セクション・カード ---------- */
section.box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.6rem;
  margin: 1.8rem 0;
  box-shadow: var(--shadow);
}
section.box ul { padding-left: 1.2rem; }
section.box li { margin: .25rem 0; }

/* 検索結果グリッド */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--gap);
  margin: 1.2rem 0;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 0;
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: var(--shadow-lg); }
.card button {
  display: block;
  width: 100%;
  padding: 0;
  text-align: left;
  background: none;
  color: inherit;
  border: none;
  border-radius: 0;
  cursor: pointer;
}
.card button:hover { filter: none; }
.card .thumb { aspect-ratio: 16 / 9; width: 100%; object-fit: cover; background: var(--surface-2); display: block; }
.card .meta { padding: .65rem .8rem; }
.card .meta h2 {
  margin: 0 0 .25rem;
  font-size: 1rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card .meta p { margin: 0; font-size: .78rem; color: var(--muted); }

/* ---------- テーブル ---------- */
table { width: 100%; border-collapse: collapse; margin: .8rem 0; }
th, td {
  text-align: left;
  padding: .5rem .65rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
thead th { color: var(--muted); font-size: .85rem; }
table th:first-child { width: 12rem; color: var(--muted); font-weight: 600; }

details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .6rem .85rem;
  margin: .8rem 0;
  background: var(--surface);
}
summary { cursor: pointer; font-weight: 600; }

/* ---------- メディア ---------- */
video { width: 100%; max-height: 80vh; border-radius: var(--radius); background: #000; margin: .5rem 0; box-shadow: var(--shadow); }

/* ---------- ステータスメッセージ ---------- */
.status-msg {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: .85rem 1.1rem;
  box-shadow: var(--shadow);
}

/* ---------- カウンター ---------- */
.counter {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 1.02em;
  padding: .1em .5em;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}

/* ---------- フッター ---------- */
footer.site {
  margin-top: 2.8rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
  font-size: .85rem;
  color: var(--muted);
}

@media (max-width: 480px) {
  header.site .bar { flex-direction: column; align-items: flex-start; }
  form#urlForm, section.box { padding: 1.2rem; }
}
