:root {
  --background: #ffffff;
  --foreground: #252525;
  --card: #ffffff;
  --primary: #343434;
  --primary-foreground: #fbfbfb;
  --muted: #f7f7f7;
  --muted-foreground: #8e8e8e;
  --accent: #f7f7f7;
  --border: #ebebeb;
  --ring: #b5b5b5;
  --destructive: #dc2626;
  --warning: #c2620c;
  --radius: 0.375rem;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  background: var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
  height: 100dvh;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.icon {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}
.icon-sm {
  width: 0.75rem;
  height: 0.75rem;
  flex-shrink: 0;
}
.icon-lg {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

/* ---------- Header ---------- */
header {
  background: var(--background);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.logo {
  display: inline-flex;
  height: 3rem;
  min-width: 5rem;
  padding: 0.625rem 0.5rem;
  align-items: center;
}
.logo-img {
  height: 100%;
  width: auto;
  object-fit: contain;
}

nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

button {
  font: inherit;
  cursor: pointer;
  border: 0;
  background: transparent;
  color: inherit;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 2.25rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s;
}
.btn-ghost:hover {
  background: var(--accent);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  height: 2rem;
  padding: 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  font-size: 0.75rem;
  letter-spacing: -0.05em;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  transition: background 0.15s;
}
.btn-outline:hover {
  background: var(--accent);
}

.time-chip {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.375rem 0.75rem;
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}
.time-chip:hover {
  background: var(--accent);
}
.time-chip .label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted-foreground);
}
.time-chip .muted-icon {
  color: var(--muted-foreground);
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border: 1px solid rgba(52, 52, 52, 0.6);
  background: var(--muted);
  border-radius: 9999px;
  padding: 0.125rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: -0.05em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ---------- 言語切り替え ---------- */
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.lang-switch .muted-icon {
  color: var(--muted-foreground);
}
.lang-switch-fixed {
  position: fixed;
  top: 1rem;
  right: 1.25rem;
  z-index: 20;
}
.lang-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.125rem;
  padding: 0.125rem;
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: 9999px;
}
.lang-opt {
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted-foreground);
  transition: color 0.15s, background 0.15s;
}
.lang-opt:hover {
  color: var(--foreground);
}
.lang-opt.is-active {
  background: var(--background);
  color: var(--foreground);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.account-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 2.25rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s;
}
.account-btn:hover {
  background: var(--accent);
}

/* ---------- Body grid ---------- */
.body-grid {
  display: grid;
  grid-template-columns: 260px 1fr;
  grid-template-rows: minmax(0, 1fr);
}

/* ---------- Sidebar ---------- */
.sidebar {
  padding: 1rem 0.5rem;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0.5rem;
  height: 100%;
}
.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
  padding: 0 0.5rem;
}
.sidebar-head h2 {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  height: 2rem;
  font-size: 1rem;
  font-weight: 700;
}
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  height: 2rem;
  padding: 0 0.75rem;
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.75rem;
  letter-spacing: -0.05em;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  transition: background 0.15s;
}
.btn-primary:hover:not(:disabled) {
  background: #2a2a2a;
}

.sidebar-list {
  overflow-y: auto;
  height: 100%;
  padding: 0.5rem 0.25rem;
}
.video-card {
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  background: var(--card);
  box-shadow:
    0 1px 3px 0 rgba(0, 0, 0, 0.1),
    0 1px 2px -1px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: box-shadow 0.15s;
}
.video-card:hover {
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -2px rgba(0, 0, 0, 0.1);
}
.video-card[data-selected="true"] {
  background: rgba(247, 247, 247, 0.6);
  box-shadow: 0 0 0 2px var(--ring);
}
.video-card .inner {
  padding: 1rem;
}
.video-card h3 {
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
}
.meta-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}
.meta-row .item {
  display: flex;
  align-items: center;
  gap: 1px;
}
.card-expire {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: 0.25rem;
}
.card-badge-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.25rem;
}
.badge-warning {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border: 1px solid var(--warning);
  color: var(--warning);
  background: transparent;
  border-radius: 9999px;
  padding: 0.125rem 0.375rem;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: -0.05em;
  white-space: nowrap;
  transition: background 0.15s;
}
.badge-warning:hover {
  background: rgba(0, 0, 0, 0.02);
}

/* ---------- Main ---------- */
.main {
  padding: 1rem;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0.5rem;
  overflow: hidden;
}
.main-head {
  padding: 0 0.5rem;
}
.main-head h2 {
  font-size: 1.125rem;
  font-weight: 700;
  height: 2rem;
  display: flex;
  align-items: center;
}
.main-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}
.main-meta .item {
  display: flex;
  align-items: center;
  gap: 1px;
}
.main-meta .right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 1.5rem;
  width: 1.5rem;
  border-radius: var(--radius);
  color: var(--muted-foreground);
  transition:
    background 0.15s,
    color 0.15s;
}
.icon-btn:hover {
  background: var(--accent);
  color: var(--destructive);
}

/* ---------- Upload dropzone ---------- */
.dropzone-card {
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  background: var(--card);
  box-shadow:
    0 1px 3px 0 rgba(0, 0, 0, 0.1),
    0 1px 2px -1px rgba(0, 0, 0, 0.1);
}
.dropzone-inner {
  padding: 1.5rem;
}
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  transition: border-color 0.15s;
}
.dropzone:hover {
  border-color: var(--muted-foreground);
}
.dropzone .dz-icon {
  display: block;
  width: 2rem;
  height: 2rem;
  margin: 0 auto 0.5rem;
  color: var(--muted-foreground);
}
.dropzone h3 {
  font-weight: 500;
  font-size: 1rem;
}
.dropzone p {
  color: var(--muted-foreground);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}
.dropzone .dz-select {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.25rem;
  padding: 0 1rem;
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: background 0.15s;
}
.dropzone .dz-select:hover {
  background: #2a2a2a;
}

/* ---------- Tabs + settings ---------- */
.settings-wrap {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0.5rem;
  height: 100%;
  min-height: 0;
}
.tabs {
  height: 2.5rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: center;
  justify-content: center;
  background: var(--muted);
  color: var(--muted-foreground);
  border-radius: var(--radius);
  padding: 0.25rem;
}
.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  border-radius: calc(var(--radius) - 4px);
  font-size: 0.875rem;
  font-weight: 500;
}
.tab[data-active="true"] {
  background: var(--background);
  color: var(--foreground);
  box-shadow:
    0 1px 3px 0 rgba(0, 0, 0, 0.1),
    0 1px 2px -1px rgba(0, 0, 0, 0.1);
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(200px, 300px) minmax(600px, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 0.5rem;
  height: 100%;
  overflow: hidden;
}

.settings-left {
  overflow-y: auto;
  padding: 0.125rem 0.25rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.opt-card {
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  background: var(--card);
  box-shadow:
    0 1px 3px 0 rgba(0, 0, 0, 0.1),
    0 1px 2px -1px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: box-shadow 0.15s;
}
.opt-card:hover {
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -2px rgba(0, 0, 0, 0.1);
}
.opt-card[data-selected="true"] {
  background: rgba(247, 247, 247, 0.6);
  box-shadow: 0 0 0 2px var(--ring);
}
.opt-card .opt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  padding: 1rem 1rem 0.5rem;
}
.opt-card .opt-body {
  padding: 0 1rem 0.75rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}
.opt-body .text-destructive {
  color: var(--destructive);
}
.opt-body .text-warning {
  color: var(--warning);
}
.opt-body .status-set {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: #16a34a;
  font-weight: 500;
}
.opt-body .status-set::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  background: #22c55e;
  display: inline-block;
}

.btn-primary-lg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.25rem;
  padding: 0.5rem 1rem;
  width: 100%;
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.settings-right {
  overflow-y: auto;
  padding-bottom: 5rem;
  min-height: 0;
}
.panel-card {
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  background: var(--card);
  box-shadow:
    0 1px 3px 0 rgba(0, 0, 0, 0.1),
    0 1px 2px -1px rgba(0, 0, 0, 0.1);
}
.panel-card .panel-inner {
  padding: 1.5rem;
  padding-bottom: 2.5rem;
}
.panel-head {
  max-width: 48rem;
  margin-bottom: 0.5rem;
}
.panel-head h3 {
  font-weight: 700;
  font-size: 1rem;
}
.panel-desc-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.panel-desc {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  line-height: 1.5;
}
.preset {
  white-space: nowrap;
}
.preset .preset-label {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}
.preset .preset-btns {
  display: flex;
  gap: 0.25rem;
  margin-top: 0.25rem;
}
.btn-sm-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  height: 2rem;
  padding: 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  font-size: 0.75rem;
  letter-spacing: -0.05em;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  transition: background 0.15s;
}
.btn-sm-outline:hover:not(:disabled) {
  background: var(--accent);
}

.thumb {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--muted);
  width: 100%;
  margin-top: 0.75rem;
  max-width: 48rem;
}
.thumb svg {
  display: block;
  width: 100%;
  height: auto;
  cursor: default;
  touch-action: none;
}

.line-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.875rem;
}
.line-table th {
  text-align: left;
  font-weight: 500;
  color: var(--foreground);
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
.line-table td {
  padding: 0.5rem 0.75rem;
  vertical-align: middle;
}
.line-input {
  height: 2.5rem;
  padding: 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  font: inherit;
  color: inherit;
  width: 100%;
  outline: none;
}
.line-input:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(181, 181, 181, 0.4);
}
.line-input.comment {
  min-width: 8rem;
}
.line-input.coord {
  width: 5rem;
  text-align: left;
  font-variant-numeric: tabular-nums;
}
.coord-cell {
  display: flex;
  gap: 0.5rem;
}
.row-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2rem;
  width: 2rem;
  border-radius: var(--radius);
  color: var(--muted-foreground);
  transition:
    background 0.15s,
    color 0.15s;
}
.row-delete:hover {
  background: var(--accent);
  color: var(--destructive);
}

/* ---------- Uploading scene ---------- */
.progress {
  position: relative;
  overflow: hidden;
  border-radius: 9999px;
  background: var(--muted);
  width: 4rem;
  height: 0.375rem;
}
.progress > div {
  height: 100%;
  background: var(--primary);
  width: 100%;
  transform: translateX(-91%);
  transition: transform 0.12s linear;
}

/* クリックで開始ヒント */
.start-hint {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  background: rgba(23, 23, 23, 0.9);
  color: #fff;
  border-radius: 9999px;
  font-size: 0.8rem;
  z-index: 60;
  pointer-events: none;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
  animation: hint-pulse 1.6s ease-in-out infinite;
}
@keyframes hint-pulse {
  0%,
  100% {
    opacity: 0.85;
  }
  50% {
    opacity: 1;
  }
}
.badge-sm {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border: 1px solid rgba(52, 52, 52, 0.6);
  background: var(--muted);
  border-radius: 9999px;
  padding: 0.125rem 0.375rem;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: -0.05em;
}
.spin {
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(1turn);
  }
}

/* ---------- 解析中（処理待ち）ペイン ---------- */
/* 設定/動画 の 2 タブ表示。動画タブ選択時に解析中ペインを表示する */
.tabs--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.analyze-pane {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 1rem;
  padding-bottom: 5rem;
  color: var(--muted-foreground);
}
.analyze-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.analyze-pane .spinner-lg {
  width: 2rem;
  height: 2rem;
  color: var(--muted-foreground);
}
.analyze-pane p {
  font-size: 0.875rem;
}

/* ---------- 解析完了（結果タブ：動画／グラフ／データ共通） ---------- */
/* 各タブ（06-video=動画 / 07-graph=グラフ / 08-data=データ）のCSSはここに集約。
   以前はグラフ/データのシーン内に暫定インライン化していたものを統合した。 */
.badge-done {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border: 1px solid transparent;
  background: var(--primary);
  color: var(--primary-foreground);
  border-radius: 9999px;
  padding: 0.125rem 0.5rem;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: -0.05em;
  white-space: nowrap;
}

.result-card {
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  background: var(--card);
  box-shadow:
    0 1px 3px 0 rgba(0, 0, 0, 0.1),
    0 1px 2px -1px rgba(0, 0, 0, 0.1);
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 各タブ共通ツールバー（動画は右寄せ、グラフ/データは左にフィルタ＋右にDL） */
.result-toolbar,
.graph-toolbar,
.dtab-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  flex-shrink: 0;
}
.result-toolbar {
  justify-content: flex-end;
}
.graph-toolbar-right,
.dtab-toolbar .spacer {
  margin-left: auto;
}
.icon-btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2rem;
  padding: 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  transition: background 0.15s;
}
.icon-btn-outline:hover {
  background: var(--accent);
}
.icon-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2rem;
  padding: 0 0.75rem;
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  transition: background 0.15s;
}
.icon-btn-primary:hover {
  background: #2a2a2a;
}

/* フィルタ用セレクト（グラフ／データ共通） */
.graph-select,
.dtab-select {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  height: 2.25rem;
  padding: 0 0.75rem;
  border: 1px solid var(--input);
  border-radius: var(--radius);
  background: var(--background);
  font-size: 0.875rem;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  transition: background 0.15s;
}
.graph-select:hover,
.dtab-select:hover {
  background: var(--accent);
}
.graph-select .chev,
.dtab-select .chev {
  width: 1rem;
  height: 1rem;
  opacity: 0.5;
}

/* --- 動画タブ（06-video） --- */
.result-body {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.5rem 0.5rem;
  overflow: hidden;
}
.video-frame {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 100%;
  margin-inline: auto;
  background: #000;
  border-radius: 0.5rem;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
}
.video-frame > img,
video.video-frame {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* --- グラフタブ（07-graph） --- */
.graph-body {
  flex: 1;
  min-height: 0;
  padding: 0 0.5rem 0.5rem;
  overflow: hidden;
}
.graph-chart {
  height: 100%;
  width: 100%;
  background: #fff;
  border-radius: 0.5rem;
  box-shadow:
    0 1px 3px 0 rgba(0, 0, 0, 0.1),
    0 1px 2px -1px rgba(0, 0, 0, 0.1);
  padding: 1rem;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0.25rem;
  overflow: hidden;
}
/* メインの折れ線グラフ（縦に伸縮） */
.graph-chart .chart-main {
  width: 100%;
  height: 100%;
  min-height: 0;
}
/* 下部のスクロール（範囲選択）ミニグラフ */
.graph-chart .chart-scroll {
  width: 100%;
  height: 80px;
}
.graph-chart svg text {
  font-family: ui-sans-serif, system-ui, sans-serif;
  fill: #64748b;
}
.graph-chart .axis-domain,
.graph-chart .tick line {
  stroke: #cbd5e1;
}

/* --- データタブ（08-data） --- */
.dtab-body {
  flex: 1;
  min-height: 0;
  padding: 0 1.5rem 1.5rem;
  overflow: hidden;
}
.dtab-scroll {
  height: 100%;
  overflow: auto;
  border-radius: var(--radius);
}
table.dtab-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 0.875rem;
  table-layout: fixed;
  font-variant-numeric: tabular-nums;
}
table.dtab-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--card);
  color: var(--foreground);
  height: 2.5rem;
  padding: 0.5rem;
  font-weight: 500;
  text-align: right;
  line-height: 1.25;
  border-bottom: 1px solid var(--border);
}
table.dtab-table thead th:first-child {
  text-align: center;
  width: 6rem;
}
table.dtab-table tbody td {
  padding: 0.5rem;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
table.dtab-table tbody td:first-child {
  text-align: center;
  font-weight: 500;
}
table.dtab-table tbody tr:hover {
  background: var(--accent);
}
table.dtab-table tbody tr:last-child td {
  border-bottom: 0;
}

/* ---------- Tour navigation (紙芝居送り) ---------- */
/* 前へ/次への表示は一旦非表示（キーボード操作・隠しシーン一覧は有効） */
.tour-nav {
  display: none;
}
.tour-nav--visible {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.5rem;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  border-radius: 9999px;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -2px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(4px);
  z-index: 50;
  font-size: 0.8rem;
}
.tour-nav a,
.tour-nav span.disabled {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  height: 1.75rem;
  padding: 0 0.625rem;
  border-radius: 9999px;
  text-decoration: none;
  color: var(--foreground);
  transition: background 0.15s;
}
.tour-nav a:hover {
  background: var(--accent);
}
.tour-nav span.disabled {
  color: var(--muted-foreground);
  opacity: 0.5;
  cursor: not-allowed;
}
.tour-nav .step {
  color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
  padding: 0 0.25rem;
}

/* ---------- Login scene ---------- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--muted);
  height: 100dvh;
}
.login-card {
  width: 100%;
  max-width: 28rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  box-shadow:
    0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -4px rgba(0, 0, 0, 0.1);
}
.login-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 3rem 1.5rem 0.5rem;
  text-align: center;
}
.login-head .login-logo {
  width: 18rem;
  max-width: 70%;
  height: auto;
  object-fit: contain;
}
.login-head h1 {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.login-form {
  padding: 0 3rem 3.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.field {
  display: grid;
  gap: 0.25rem;
}
.field label {
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1;
}
.field .input {
  height: 2.25rem;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  padding: 0.25rem 0.75rem;
  font-size: 0.875rem;
  color: inherit;
  outline: none;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.field .input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23, 23, 23, 0.15);
}
/* type=password を使わずに伏せ字表示（パスワード保存プロンプト回避用） */
.field .input.is-masked {
  -webkit-text-security: disc;
  text-security: disc;
}
.field .input-wrap {
  position: relative;
}
.field .input-wrap .input {
  padding-right: 2.5rem;
}
.field .toggle-eye {
  position: absolute;
  right: 0.25rem;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.375rem;
  border-radius: var(--radius);
  color: var(--foreground);
  transition: background 0.15s;
}
.field .toggle-eye:hover {
  background: var(--accent);
}
.forgot {
  margin-left: auto;
  font-size: 0.875rem;
  color: var(--primary);
  text-decoration: none;
  cursor: pointer;
}
.forgot:hover {
  text-decoration: underline;
}
.btn-login {
  height: 2rem;
  width: 100%;
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: -0.05em;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  transition: background 0.15s;
}
.btn-login:hover:not(:disabled) {
  background: #2a2a2a;
}
.typing-cursor {
  border-right: 2px solid var(--primary);
  animation: blink 0.8s step-end infinite;
}
@keyframes blink {
  0%,
  100% {
    border-color: transparent;
  }
  50% {
    border-color: var(--primary);
  }
}

/* ---------- 目次（シーン一覧）ボタン + パネル ---------- */
/* ツアー中いつでも目次を開くための常設ボタン。driver.js のオーバーレイより
   前面に置く必要があるため z-index を大きく取る（ポップオーバーよりは下）。 */
.tour-menu-btn {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  height: 2.25rem;
  padding: 0 0.875rem;
  background: #242b5f;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.2),
    0 2px 4px -2px rgba(0, 0, 0, 0.2);
  z-index: 2147483000;
  /* driver.js はツアー中 .driver-active * { pointer-events:none } を当てるため、
     常設ボタンはクリックを受けられるよう明示的に有効化する */
  pointer-events: auto !important;
  transition: background 0.15s, transform 0.1s;
}
.tour-menu-btn:hover {
  background: #2e3773;
}
.tour-menu-btn:active {
  transform: translateY(1px);
}
.tour-menu-btn svg {
  width: 1rem;
  height: 1rem;
}

/* 目次はドロワー：左から前面パネルがスライドインする。
   driver.js のポップオーバー(2147483000)より前面に出し、ツアー中でも開ける。 */
.scene-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  z-index: 2147483647;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.scene-overlay.is-open {
  opacity: 1;
  visibility: visible;
  /* driver.js の pointer-events:none を上書きし、ドロワー内を操作可能にする */
  pointer-events: auto !important;
}
.scene-overlay.is-open * {
  pointer-events: auto !important;
}
.scene-panel {
  width: min(360px, 86vw);
  height: 100%;
  overflow-y: auto;
  background: var(--background);
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 0;
  box-shadow:
    0 10px 15px -3px rgba(0, 0, 0, 0.2),
    0 4px 6px -4px rgba(0, 0, 0, 0.2);
  padding: 1.25rem 1rem;
  /* 閉じているときは画面外（左）へ。is-open で 0 に戻してスライドイン */
  transform: translateX(-100%);
  transition: transform 0.25s ease;
}
.scene-overlay.is-open .scene-panel {
  transform: translateX(0);
}
.scene-panel-head {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
}
.scene-panel-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.scene-panel-list a {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--foreground);
  transition: background 0.15s;
}
.scene-panel-list a:hover {
  background: var(--accent);
}
.scene-panel-list a[aria-current="true"] {
  border-color: var(--primary);
  background: rgba(247, 247, 247, 0.6);
}
.scene-panel-list .n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 9999px;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}
.scene-panel-list .t {
  font-size: 0.875rem;
  font-weight: 500;
}
.scene-panel-list .t .s {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--muted-foreground);
}
.scene-panel-foot {
  margin-top: 0.75rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  text-align: center;
}

/* ---------- 動画開始日時 scene ---------- */
.dt-label {
  font-size: 0.875rem;
  font-weight: 500;
  display: block;
}
.dt-desc {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin: 0.25rem 0 1rem;
  line-height: 1.5;
}
.dt-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.dt-picker-wrap {
  position: relative;
}
.dt-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 2.25rem;
  padding: 0 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  font-size: 0.875rem;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
.dt-trigger:hover {
  background: var(--accent);
}
.dt-trigger .cal-icon {
  color: var(--muted-foreground);
}
.dt-tz-text {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  white-space: nowrap;
}
.dt-clear {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  height: 2rem;
  padding: 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  font-size: 0.75rem;
  letter-spacing: -0.05em;
  color: var(--muted-foreground);
}
.dt-clear:hover {
  background: var(--accent);
}
.dt-field {
  margin-bottom: 1rem;
  max-width: 20rem;
}
.dt-field > label {
  font-size: 0.875rem;
  font-weight: 500;
  display: block;
  margin-bottom: 0.25rem;
}
.dt-select {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  height: 2.25rem;
  padding: 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  font-size: 0.875rem;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
.dt-select .chev {
  color: var(--muted-foreground);
}
.dt-note {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--muted-foreground);
  background: var(--muted);
  border-radius: var(--radius);
  padding: 0.625rem 0.75rem;
}
.dt-calendar {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  z-index: 40;
  width: 320px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  box-shadow:
    0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -4px rgba(0, 0, 0, 0.1);
  padding: 0.75rem;
}
.dt-calendar[hidden] {
  display: none;
}
.dt-cal-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.dt-cal-head .ym {
  display: inline-flex;
  align-items: center;
  gap: 0.125rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
}
.dt-cal-head .ym .chev {
  color: var(--muted-foreground);
}
.dt-cal-head .spacer {
  flex: 1;
}
.dt-nav {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-foreground);
}
.dt-nav:hover {
  background: var(--accent);
}
.dt-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-bottom: 0.25rem;
}
.dt-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.dt-day {
  height: 2.25rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--foreground);
}
.dt-day:hover {
  background: var(--accent);
}
.dt-day.muted {
  color: var(--muted-foreground);
  opacity: 0.4;
}
.dt-day.today {
  background: var(--muted);
}
.dt-day.selected {
  background: var(--primary);
  color: var(--primary-foreground);
}
.dt-time {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-top: 0.75rem;
  font-size: 0.875rem;
}
.dt-time select {
  height: 2.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 0.5rem;
  background: var(--background);
  font-size: 0.875rem;
  color: inherit;
}

/* ---------- driver.js ガイドツアーのテーマ ---------- */
.driver-popover {
  background: #242b5f !important;
  color: #fff !important;
  border-radius: 12px !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  /* ハイライトされた要素より前面に出して重なり（白いボックス）を防ぐ。
     目次パネル(.scene-overlay)は更に前面に出すため、こちらは僅かに下げる */
  z-index: 2147483000 !important;
}
.driver-popover-btn-disabled {
  display: none !important;
}
.driver-popover-title {
  color: #fff !important;
  background: transparent !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  padding: 0;
  padding-bottom: 8px;
  /* タイトル下のディバイダー（背景の濃紺に合わせた淡い白） */
  border-bottom: 1px solid rgba(255, 255, 255, 0.14) !important;
  margin-bottom: 4px;
}
.driver-popover-description {
  color: rgba(255, 255, 255, 0.72) !important;
  background: transparent !important;
  font-size: 13px !important;
  line-height: 1.6 !important;
}
.driver-popover-progress-text {
  color: rgba(255, 255, 255, 0.5) !important;
}
.driver-popover-next-btn {
  background: #fff !important;
  color: #242b5f !important;
  border: none !important;
  text-shadow: none !important;
  font-weight: bold !important;
  border-radius: 6px !important;
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
}
/* 「次へ」ボタンに Enter キーで進められることを示すキーキャップを付与 */
.driver-popover-next-btn::after {
  content: "Enter \21B5";
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  font-size: 8px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.02em;
  border-radius: 4px;
  background: rgba(36, 43, 95, 0.12);
  color: #242b5f;
  margin-left: 8px;
}
/* 「戻る」ボタン：白い「次へ」と区別できるアウトライン調で横に並べる */
.driver-popover-prev-btn {
  color: rgba(255, 255, 255, 0.85) !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.28) !important;
  text-shadow: none !important;
  border-radius: 6px !important;
  font-weight: 600 !important;
}
.driver-popover-prev-btn:hover {
  background: rgba(255, 255, 255, 0.16) !important;
}
/* 最初のステップなどで無効化される「戻る」ボタンは非表示にする
   （＝各シーンの1歩目ではポップアップに「戻る」を出さない。
     前のシーンへ戻りたいときは目次パネルから移動する） */
.driver-popover-btn-disabled {
  display: none !important;
}
.driver-popover-close-btn {
  color: rgba(255, 255, 255, 0.55) !important;
  display: none !important;
}
/* 矢印（三角）をポップオーバーと同じ色に。各 side クラスは矢印要素自身に付くので
   子孫セレクタ（半角スペース）ではなく、その側の border-color を直接上書きする */
.driver-popover-arrow-side-left {
  border-left-color: #242b5f !important;
}
.driver-popover-arrow-side-right {
  border-right-color: #242b5f !important;
}
.driver-popover-arrow-side-top {
  border-top-color: #242b5f !important;
}
.driver-popover-arrow-side-bottom {
  border-bottom-color: #242b5f !important;
}
