/* 見た目は Spinel Review（025_動画レビューサービス/public/app.css）に合わせる。
   ・地は黒に近づけ、カードだけを一段明るくして浮かせる
   ・差し色は緑ひとつ。緑の上の文字は黒
   ・ボタンはピル型、入力欄は角丸 10px */
:root {
  --bg: #0a0a0c;
  --panel: #141518;
  --panel-2: #1d1f24;
  --line: #2a2d34;
  --text: #e9eaec;
  --muted: #8e939b;

  --accent: #1ed760;
  --accent-hover: #33e072;
  --accent-ink: #07100a;
  --accent-dim: #14432a;
  --accent-soft: rgba(30, 215, 96, .14);

  --danger: #ef4d5a;
  --ok: #1ed760;
  --warn: #e0a13a;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --font: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Noto Sans JP', sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }

button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-weight: 550;
  transition: background .12s, border-color .12s, transform .08s;
}
button:hover { background: #262a31; }
button:active { transform: scale(.97); }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); padding: 6px 8px; }
button.ghost:hover { background: var(--panel-2); color: var(--text); }
button.danger { color: var(--danger); border-color: transparent; background: transparent; }
button.danger:hover { background: rgba(239,77,90,.12); }
button.link { border: 0; background: none; color: var(--accent); padding: 0; text-decoration: underline; font-weight: 500; }
button.link:hover { background: none; color: var(--accent-hover); }

input, textarea, select {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  width: 100%;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; line-height: 1.6; }
input[type=color] { padding: 3px; height: 38px; cursor: pointer; }
input[readonly] { color: var(--muted); }
label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
label > input, label > select, label > textarea { margin-top: 6px; color: var(--text); }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--danger); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }

/* ---------------------------------------------------------- ヘッダ */

header.top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  height: 56px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky; top: 0; z-index: 20;
}
header.top .brand { font-weight: 650; letter-spacing: .02em; display: flex; align-items: center; gap: 10px; }
header.top .brand img { width: 22px; height: 22px; border-radius: 6px; }
header.top .crumb { color: var(--muted); }
header.top nav { margin-left: auto; display: flex; gap: 4px; }
header.top nav button { background: transparent; border-color: transparent; color: var(--muted); padding: 6px 12px; }
header.top nav button:hover { background: var(--panel-2); color: var(--text); }
header.top nav button.active { background: var(--accent-soft); color: var(--text); }
.badge { background: var(--accent); color: var(--accent-ink); font-weight: 650; border-radius: 20px; padding: 1px 7px; font-size: 11px; margin-left: 4px; }

/* ------------------------------------------------------ ログイン画面（Review と同じ） */
.center-screen { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-card { width: 360px; max-width: 100%; border-radius: 20px; padding: 28px; }
.login-card h1 { margin: 0 0 4px; font-size: 18px; }
.login-card p.sub { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.login-card .field { margin-bottom: 14px; }
.login-card label { margin-bottom: 6px; }
.err { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 18px; }
.google-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; height: 44px; margin-bottom: 18px;
  background: #fff; color: #1f1f1f; font-weight: 550; font-size: 14px;
  border-radius: 8px; text-decoration: none; transition: box-shadow .12s;
}
.google-btn:hover { box-shadow: 0 2px 10px rgba(0,0,0,.4); }
.google-btn svg { width: 18px; height: 18px; flex: 0 0 auto; }
.or { display: flex; align-items: center; gap: 10px; margin: 0 0 18px; color: var(--muted); font-size: 12px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
header.top .who { font-size: 13px; }

/* ------------------------------------------------------ ダイアログ・メンバー管理 */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 200; padding: 12px; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 22px; width: 440px; max-width: 100%; max-height: 92vh; overflow-y: auto; }
.modal h2 { margin: 0; font-size: 16px; }
.modal.members { width: 640px; }
.modal .row { margin-top: 0; }
.member-add { background: var(--panel-2); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 12px; }
.member-add-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.member-add-grid input, .member-add-grid select { background: var(--bg); }
.member-row { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.member-row:last-child { border-bottom: 0; }
.m-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-dim); color: var(--accent); display: grid; place-items: center; font-weight: 700; flex: 0 0 auto; }
.m-name { flex: 1; min-width: 0; display: grid; gap: 2px; }
.m-title { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-mail { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-google { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 4px; background: #fff; color: #1f1f1f; font-size: 10px; font-weight: 700; margin-right: 6px; }
.m-you { color: var(--muted); font-weight: 400; margin-left: 4px; font-size: 12px; }
.member-row select { width: auto; padding: 5px 8px; font-size: 12px; }
.member-row .m-more { padding: 4px 8px; }
.menu { position: fixed; z-index: 210; min-width: 180px; padding: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.5); }
.menu button { display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: 8px; padding: 9px 10px; }
.menu button:hover { background: var(--panel-2); }
.menu button.danger { color: var(--danger); }
@media (max-width: 640px) { .member-add-grid { grid-template-columns: 1fr; } .modal { padding: 16px; border-radius: 14px; } }

/* ---------------------------------------------------------- 本文 */

main { max-width: 1120px; margin: 0 auto; padding: 22px 26px 60px; }
.tab { display: none; }
.tab.active { display: block; }
h2.page { font-size: 20px; margin: 0 0 18px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
}

/* 作る */
.drop {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  padding: 30px;
  text-align: center;
  color: var(--muted);
  transition: border-color .12s, background .12s;
}
.drop.over { border-color: var(--accent); background: rgba(30, 215, 96, .07); color: var(--text); }
.drop-title { font-size: 16px; font-weight: 600; margin: 0 0 6px; color: var(--text); }
.drop p { margin: 4px 0; }
.file-info { font-weight: 600; color: var(--accent); }
.grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 12px; margin-top: 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
label.block { margin-top: 14px; }
.row > input { flex: 1; }

/* 進捗バー。Review の .bar と同じ細い緑 */
.progress { flex: 1; min-width: 200px; }
.progress .label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress .bar { height: 4px; background: var(--panel-2); border-radius: 3px; overflow: hidden; }
.progress .bar > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .3s; }
.progress.failed .bar > i { background: var(--danger); }
.progress.done .label { color: var(--accent); }
.progress.failed .label { color: var(--danger); }

/* ジョブ */
.jobs { display: grid; gap: 14px; }
.job {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.job > header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.job h3 { margin: 0 0 4px; font-size: 15px; font-weight: 600; word-break: break-all; }
.job-actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.job-actions button, .job-actions a {
  padding: 5px 12px; font-size: 12px; border-radius: var(--radius-pill);
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text); text-decoration: none; cursor: pointer;
}
.job-actions a:hover, .job-actions button:hover { background: #262a31; }
.job-actions button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.job-actions button.primary:hover { background: var(--accent-hover); }
.job-progress { margin-top: 12px; }
.job-summary { margin: 12px 0 0; padding: 12px 14px; background: var(--panel-2); border-radius: var(--radius-sm); font-size: 13px; line-height: 1.7; color: var(--muted); }

/* クリップのタイル。Review のタイルと同じ枠・ホバー */
.clips { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-top: 14px; }
.clip {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: border-color .12s, transform .12s;
}
.clip:hover { border-color: var(--accent); transform: translateY(-2px); }
.clip video { width: 100%; aspect-ratio: 9 / 16; background: #000; display: block; }
.clip .info { padding: 10px 12px; font-size: 12px; line-height: 1.5; color: var(--muted); }
.clip .info b { display: block; font-size: 13px; color: var(--text); margin-bottom: 4px; }
.clip .info a { color: var(--accent); text-decoration: none; }
.clip .info a:hover { text-decoration: underline; }
.clip .reason { margin-top: 6px; }

/* 設定: 左に一覧（Review のサイドバー）、右にフォーム */
.presets { display: grid; grid-template-columns: 240px 1fr; gap: 16px; align-items: start; }
.preset-list { padding: 14px; }
.preset-list h2 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 4px 0 10px; }
.preset-list ul { list-style: none; margin: 0; padding: 0; }
.preset-list li { padding: 9px 10px; border-radius: 8px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preset-list li:hover { background: var(--panel-2); }
.preset-list li.active { background: var(--accent-soft); }
.preset-list .row { margin-top: 12px; }
.preset-form h2 { margin: 0 0 16px; font-size: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 260px; gap: 24px; }
.fields label { margin-top: 12px; }
.fields .row { margin-top: 6px; }
.fields .row input { flex: 1; }
.preview img { width: 100%; aspect-ratio: 9 / 16; border-radius: var(--radius); background: #000; display: block; border: 1px solid var(--line); }
.preview p { margin-top: 8px; }

fieldset.colors { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px 14px; margin: 16px 0 0; }
fieldset.colors legend { font-size: 12px; color: var(--muted); padding: 0 6px; }
fieldset.colors > label { margin-top: 0; }
fieldset.colors .grid3 { margin-top: 10px; }
.hex-row input { max-width: 120px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.brand-row { margin-top: 10px; }
.brand-row label.inline { display: flex; align-items: center; gap: 8px; margin: 0; }
.brand-row label.inline input { width: 56px; height: 36px; margin: 0; padding: 3px; }
.brand-row input#brandHex { max-width: 120px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; flex: 0 1 120px; }
#manualColors.off { opacity: .4; pointer-events: none; }

@media (max-width: 800px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .presets, .form-grid { grid-template-columns: 1fr; }
}

.narrow-only { display: none; }
@media (max-width: 640px) { .wide-only { display: none; } .narrow-only { display: block; } .drop { cursor: pointer; } }

/* ------------------------------------------------ スマホ（640px 以下） */
/* Review と同じく、タブは画面下の固定バーにして親指で切り替える。
   入力欄は 16px にしないと iOS が自動で拡大する */
@media (max-width: 640px) {
  html, body { font-size: 15px; }
  input, textarea, select { font-size: 16px; }
  header.top { height: 50px; padding: 0 14px; }
  header.top nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    margin: 0; gap: 0;
    display: grid; grid-template-columns: repeat(3, 1fr);
    background: var(--panel); border-top: 1px solid var(--line);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  }
  header.top nav button { padding: 9px 6px; border-radius: var(--radius-sm); font-size: 14px; }
  main { padding: 14px 12px calc(84px + env(safe-area-inset-bottom, 0px)); }
  .card { padding: 16px 14px; border-radius: 12px; }

  /* 作る */
  .drop { padding: 22px 14px; }
  .drop-title { font-size: 15px; }
  .grid { grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 14px; }
  .grid label:first-child { grid-column: 1 / -1; }
  .row { gap: 8px; }
  #start { width: 100%; padding: 12px; font-size: 16px; }

  /* ジョブ */
  .job { padding: 14px; }
  .job > header { flex-direction: column; }
  .job-actions { justify-content: flex-start; width: 100%; }
  .job-actions button, .job-actions a { padding: 7px 12px; }
  .clips { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .clip .info { padding: 8px 10px; font-size: 12px; }
  .clip .reason { display: none; } /* 狭い画面では理由は省く。README とダウンロード後に読める */

  /* 設定 */
  .presets { gap: 12px; }
  .preset-list { padding: 12px; }
  .preset-list ul { display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .preset-list li { flex: 0 0 auto; border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 7px 14px; }
  .preset-list li.active { border-color: var(--accent); }
  .form-grid { display: flex; flex-direction: column-reverse; gap: 16px; }
  .preview { display: flex; flex-direction: column; align-items: center; }
  .preview img { width: 200px; }
  .fields label { margin-top: 10px; }
  .fields .row { flex-wrap: wrap; }
  .fields .row input { flex: 1 1 100%; }
  .grid3 { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .grid3 label { font-size: 11px; }
  .brand-row { gap: 8px; }
  .brand-row input#brandHex { flex: 1 1 100px; }
  .hex-row select { width: auto; flex: 1; }
}
