/* 資料棚の見た目。iPad の縦横・iPhone の幅、明るい表示と暗い表示。押す場所は 44px 以上、本文は 17px 前後 */

:root {
  --bg: #f7f6f3;
  --panel: #ffffff;
  --text: #1d1d1f;
  --sub: #6b6b70;
  --line: #e4e2dd;
  --accent: #2f6fdf;
  --accent-text: #ffffff;
  --done: #2e8b57;
  --new: #2f6fdf;
  --update: #c46a00;
  --warn-bg: #fff4e0;
  --error-bg: #fde8e8;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
  --radius: 12px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16171a;
    --panel: #212226;
    --text: #f2f2f4;
    --sub: #a0a0a8;
    --line: #34353a;
    --accent: #5b94ff;
    --accent-text: #0d1220;
    --done: #4cc38a;
    --new: #6ea2ff;
    --update: #f0a040;
    --warn-bg: #3a2e18;
    --error-bg: #3e1f22;
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.5 -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  min-height: 44px;
  min-width: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  cursor: pointer;
}

button:disabled {
  opacity: 0.4;
  cursor: default;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

button.link {
  border: 0;
  background: none;
  color: var(--accent);
  padding: 0 8px;
}

.dim {
  color: var(--sub) !important;
}

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.page {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 16px 140px;
}

.page.narrow {
  max-width: 560px;
  padding-top: 32px;
}

.title {
  font-size: 28px;
  margin: 0 0 12px;
}

.note {
  color: var(--sub);
  min-height: 1.5em;
}

/* 上のバー */
.bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 60px;
  margin: 0 -16px;
  padding: 8px 12px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.bar-title {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 10px;
}

.bar-title h1 {
  font-size: 22px;
  margin: 0;
  overflow-wrap: anywhere;
}

.bar-prefix {
  width: 100%;
  font-size: 13px;
  color: var(--sub);
  overflow-wrap: anywhere;
}

.count {
  font-size: 15px;
  color: var(--sub);
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--accent);
  flex: none;
}

.icon-button.done {
  color: var(--done);
}

.icon {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.status {
  display: flex;
  gap: 12px;
  font-size: 13px;
  color: var(--sub);
  padding: 8px 4px 0;
  min-height: 28px;
}

.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 15px;
}

.banner.error {
  background: var(--error-bg);
}

.banner.warn {
  background: var(--warn-bg);
}

/* 一覧 */
.list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.list > li + li {
  border-top: 1px solid var(--line);
}

.item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 60px;
  padding: 10px 12px 10px 16px;
  text-align: left;
  border: 0;
  border-radius: 0;
  background: none;
}

.item:active {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.item-row {
  display: flex;
  align-items: center;
  padding-right: 8px;
}

.item-open {
  flex: 1;
  min-width: 0;
}

.item-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.item-prefix {
  font-size: 13px;
  color: var(--sub);
}

.item-title {
  overflow-wrap: anywhere;
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  font-size: 13px;
  color: var(--sub);
}

.item-dir {
  overflow-wrap: anywhere;
}

.is-seen .item-title,
.is-seen .kind {
  opacity: 0.45;
}

.badge {
  min-width: 32px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 15px;
  font-weight: 600;
  text-align: center;
}

.tag {
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid currentColor;
  font-size: 12px;
  font-weight: 600;
  line-height: 20px;
}

.tag-new {
  color: var(--new);
}

.tag-update {
  color: var(--update);
}

.kind {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex: none;
}

.kind-pdf {
  color: #d0453a;
  background: color-mix(in srgb, #d0453a 12%, transparent);
}

.kind-video {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.group {
  margin-top: 20px;
}

.group-title {
  margin: 0 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--sub);
  overflow-wrap: anywhere;
}

.empty {
  margin: 64px 0;
  text-align: center;
  color: var(--sub);
}

.foot {
  margin-top: 40px;
  text-align: center;
}

/* メニュー（上のバーの中に置き、一覧の上に重ねる） */
.menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 12px;
  z-index: 6;
  display: flex;
  flex-direction: column;
  width: min(320px, calc(100% - 24px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.menu button {
  border: 0;
  border-radius: 0;
  text-align: left;
  min-height: 50px;
}

.menu button + button {
  border-top: 1px solid var(--line);
}

/* 接続・最初の 1 回 */
.steps {
  padding-left: 1.4em;
}

.steps li {
  margin: 16px 0;
}

.row-input {
  display: flex;
  gap: 8px;
}

.code-input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}

.choices {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 14px 16px;
  text-align: left;
}

.choice-sub {
  font-size: 14px;
  font-weight: 400;
  opacity: 0.8;
}

/* 動画 */
.player .video {
  display: block;
  width: 100%;
  max-height: calc(100vh - 220px);
  margin-top: 12px;
  background: #000;
  border-radius: var(--radius);
}

.player-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.rates {
  display: flex;
  gap: 6px;
}

.rate[aria-pressed='true'] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

/* 下に出すもの（「見終わった？」と「取り消す」） */
.dock {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  justify-content: center;
  padding: 0 12px;
  pointer-events: none;
}

#ask {
  bottom: calc(env(safe-area-inset-bottom) + 76px);
}

#toast {
  bottom: calc(env(safe-area-inset-bottom) + 12px);
}

.sheet,
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(600px, 100%);
  padding: 10px 12px 10px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.sheet {
  flex-wrap: wrap;
}

.sheet-text {
  flex: 1;
  min-width: 200px;
  margin: 0;
  overflow-wrap: anywhere;
}

.sheet-buttons {
  display: flex;
  gap: 8px;
}

.toast-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.toast-undo {
  border: 0;
  background: none;
  color: var(--accent);
  font-weight: 600;
}
