/*
 * スマ枠 スタイル
 * 方針: 業務ツール風。白とグレーを基調に、差し色は青1色。区切りは1pxの枠線で、影やグラデーションは使わない。
 */

:root {
  --color-bg: #f6f8fa;
  --color-surface: #ffffff;
  --color-text: #1f2328;
  --color-muted: #59636e;
  --color-border: #d1d9e0;
  --color-border-muted: #e4e8ec;
  --color-accent: #0969da;
  --color-accent-hover: #0757ba;
  --color-danger: #cf222e;
  --color-danger-subtle: #ffebe9;
  --color-success: #1a7f37;
  --color-success-subtle: #dafbe1;
  --color-attention: #9a6700;
  --color-attention-subtle: #fff8c5;
  --radius: 6px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--color-accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  padding: 0.1em 0.35em;
  background: var(--color-bg);
  border: 1px solid var(--color-border-muted);
  border-radius: 4px;
}

h1,
h2,
h3 {
  line-height: 1.3;
  font-weight: 600;
}

h1 {
  font-size: 1.375rem;
  margin: 0 0 1rem;
}

h2 {
  font-size: 1.0625rem;
  margin: 2rem 0 0.75rem;
}

/* ---------- レイアウト ---------- */

.container {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 1.5rem 1rem 2.5rem;
  flex: 1 0 auto;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.page-header h1 {
  margin: 0;
}

.section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border-muted);
}

.section h2 {
  margin-top: 0;
}

.muted {
  color: var(--color-muted);
}

small {
  font-size: 0.8125rem;
}

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

.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.site-header-inner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 1rem;
  min-height: 52px;
}

.brand {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.02em;
  color: var(--color-text);
  white-space: nowrap;
}

.brand:hover {
  text-decoration: none;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
}

.site-nav::-webkit-scrollbar {
  display: none;
}

.site-nav a,
.site-nav .link-button {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 0.625rem;
  border-radius: var(--radius);
  color: var(--color-muted);
  font-size: 0.875rem;
  white-space: nowrap;
}

.site-nav a:hover,
.site-nav .link-button:hover {
  color: var(--color-text);
  background: var(--color-bg);
  text-decoration: none;
}

.site-nav a[aria-current="page"] {
  color: var(--color-text);
  font-weight: 600;
}

.site-nav .nav-spacer {
  flex: 1;
}

.mock-banner {
  background: var(--color-attention-subtle);
  color: var(--color-attention);
  border-bottom: 1px solid #eed888;
  font-size: 0.8125rem;
  text-align: center;
  padding: 0.35rem 1rem;
}

/* ---------- ボタン ---------- */

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  min-height: 40px;
  padding: 0 1rem;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

button:hover,
.button:hover {
  background: var(--color-bg);
  text-decoration: none;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.button-primary {
  color: #fff;
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.button-primary:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
}

.button-small {
  min-height: 30px;
  padding: 0 0.75rem;
  font-size: 0.8125rem;
}

button.danger,
.button.danger {
  color: var(--color-danger);
}

button.danger:hover {
  color: #fff;
  background: var(--color-danger);
  border-color: var(--color-danger);
}

button.link-button {
  min-height: 0;
  padding: 0;
  border: none;
  background: none;
  color: var(--color-accent);
  font-weight: normal;
}

button.link-button:hover {
  background: none;
  text-decoration: underline;
}

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

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

form.inline-form {
  display: inline;
  margin: 0;
}

/* ---------- フォーム ---------- */

form {
  display: flex;
  flex-direction: column;
  gap: 1.125rem;
  margin: 1rem 0;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border-muted);
}

label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
}

label small,
.field-hint {
  display: block;
  font-weight: normal;
  color: var(--color-muted);
  margin-top: 0.25rem;
}

input[type="text"],
input[type="url"],
input[type="datetime-local"],
input[type="file"],
select,
textarea {
  display: block;
  width: 100%;
  margin-top: 0.375rem;
  padding: 0.5rem 0.75rem;
  font: inherit;
  font-size: 16px; /* iOS のズームを防ぐ */
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

input[type="file"] {
  padding: 0.375rem;
  background: var(--color-bg);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.2);
}

textarea {
  min-height: 7rem;
  resize: vertical;
  line-height: 1.6;
}

fieldset {
  margin: 0;
  padding: 0.75rem 1rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
}

legend {
  padding: 0 0.375rem;
  font-weight: 600;
  font-size: 0.875rem;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-weight: normal;
  margin-top: 0.625rem;
}

.checkbox-row input {
  margin-top: 0.3rem;
}

/* ---------- メッセージ ---------- */

.errors,
.warnings,
.notice {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid;
  border-radius: var(--radius);
  font-size: 0.875rem;
}

ul.errors,
ul.warnings {
  padding-left: 2rem;
}

.errors {
  color: var(--color-danger);
  background: var(--color-danger-subtle);
  border-color: #ffcecb;
}

.warnings {
  color: var(--color-attention);
  background: var(--color-attention-subtle);
  border-color: #eed888;
}

.notice {
  color: var(--color-success);
  background: var(--color-success-subtle);
  border-color: #aceebb;
}

.flash {
  width: calc(100% - 2rem);
  max-width: 728px;
  margin: 1rem auto 0;
}

.thumbnail-status.errors {
  margin-top: 0.5rem;
}

/* ---------- 一覧 ---------- */

.item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.item-list > li {
  display: grid;
  grid-template-columns: 128px 1fr;
  gap: 0.875rem;
  padding: 0.875rem 1rem;
  border-top: 1px solid var(--color-border-muted);
}

.item-list > li:first-child {
  border-top: none;
}

.item-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 4px;
  background: var(--color-bg);
  border: 1px solid var(--color-border-muted);
}

.item-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-muted);
  font-size: 0.75rem;
}

.item-body {
  min-width: 0;
}

.item-title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  word-break: break-word;
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.75rem;
  margin: 0.25rem 0 0;
  color: var(--color-muted);
  font-size: 0.8125rem;
}

.item-time {
  font-variant-numeric: tabular-nums;
  color: var(--color-text);
}

.label {
  display: inline-block;
  padding: 0 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: 2em;
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--color-muted);
}

.label-public {
  color: var(--color-success);
  border-color: #aceebb;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem 0.875rem;
  align-items: center;
  margin-top: 0.625rem;
  font-size: 0.8125rem;
}

.actions form {
  margin: 0;
}

.empty-state {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--color-muted);
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
}

.empty-state p {
  margin: 0 0 1rem;
}

@media (max-width: 480px) {
  .item-list > li {
    grid-template-columns: 96px 1fr;
    gap: 0.75rem;
    padding: 0.75rem;
  }
}

/* ---------- サムネイル ---------- */

.thumbnail-preview {
  display: block;
  max-width: 280px;
  margin: 0.5rem 0;
  border-radius: 4px;
  border: 1px solid var(--color-border-muted);
}

.thumbnail-choices {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.thumbnail-choice {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-weight: normal;
  font-size: 0.8125rem;
  cursor: pointer;
}

.thumbnail-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.thumbnail-choice img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--color-border);
}

.thumbnail-choice input:checked + img {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-accent);
}

.thumbnail-choice input:focus-visible + img {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ---------- パネル（アカウント画面など） ---------- */

.panel {
  padding: 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.panel > :first-child {
  margin-top: 0;
}

.panel > :last-child {
  margin-bottom: 0;
}

.panel form {
  margin: 0.75rem 0 0;
}

.panel-danger {
  border-color: #ffcecb;
}

.definition-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.5rem 1.25rem;
  margin: 0;
}

.definition-list dt {
  color: var(--color-muted);
  font-size: 0.875rem;
}

.definition-list dd {
  margin: 0;
  word-break: break-word;
}

.usage {
  font-variant-numeric: tabular-nums;
}

/* ---------- ランディング ---------- */
/* 枠や格子で区切らず、文字の大きさの強弱と余白だけで縦に読ませる */

.landing {
  max-width: 640px;
  padding-top: 2rem;
  padding-bottom: 4rem;
}

.hero-title {
  margin: 0 0 2.5rem;
}

.hero-title img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
}

.lp-lead {
  margin: 0 0 2rem;
  font-size: 1.125rem;
  line-height: 1.8;
  color: var(--color-muted);
}

.lp-note {
  margin: 0.875rem 0 0;
  font-size: 0.8125rem;
  color: var(--color-muted);
}

.button-large {
  min-height: 50px;
  padding: 0 1.5rem;
  font-size: 1rem;
}

.lp-section {
  margin-top: 5rem;
}

.lp-kicker {
  margin: 0 0 2rem;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--color-accent);
}

.lp-section-title {
  margin: 0 0 2.25rem;
  font-size: clamp(2rem, 7.5vw, 2.75rem);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.lp-item + .lp-item {
  margin-top: 2.75rem;
}

.lp-heading {
  margin: 0 0 0.5rem;
  font-size: clamp(1.1875rem, 4.5vw, 1.375rem);
  font-weight: 700;
  line-height: 1.35;
}

.lp-item p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.85;
  color: var(--color-muted);
}

.lp-section-quiet .lp-kicker {
  margin-bottom: 1rem;
  color: var(--color-muted);
}

.lp-section-quiet p {
  font-size: 0.9375rem;
  line-height: 1.85;
  color: var(--color-muted);
}

.lp-closing {
  padding-top: 3rem;
  border-top: 1px solid var(--color-border-muted);
}

.lp-closing-text {
  margin: 0 0 1.5rem;
  font-size: clamp(1.375rem, 5vw, 1.75rem);
  font-weight: 700;
  line-height: 1.4;
}

/* ---------- 規約・ポリシー ---------- */

.prose {
  line-height: 1.85;
}

.prose h2 {
  margin-top: 2.25rem;
  padding-bottom: 0.375rem;
  border-bottom: 1px solid var(--color-border-muted);
}

.prose ul {
  padding-left: 1.5rem;
}

.prose li + li {
  margin-top: 0.25rem;
}

/* ---------- フッター ---------- */

.site-footer {
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-muted);
  font-size: 0.8125rem;
}

.site-footer-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 1.25rem 1rem 1.5rem;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin-bottom: 0.5rem;
}

.site-footer a {
  color: var(--color-muted);
}

.site-footer a:hover {
  color: var(--color-accent);
}

.site-footer p {
  margin: 0;
}

/* ---------- その他 ---------- */

.studio-link {
  color: var(--color-danger);
}

/* ---------- 処理中の表示（busy.js） ---------- */

.busy-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 3px;
  overflow: hidden;
  background: rgba(9, 105, 218, 0.15);
}

.busy-bar::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -40%;
  width: 40%;
  background: var(--color-accent);
  animation: busy-bar-slide 1.1s ease-in-out infinite;
}

@keyframes busy-bar-slide {
  0% { left: -40%; }
  100% { left: 100%; }
}

.spinner {
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spinner-rotate 0.7s linear infinite;
}

@keyframes spinner-rotate {
  to { transform: rotate(360deg); }
}

button.is-busy {
  cursor: progress;
  opacity: 0.85;
}

@media (prefers-reduced-motion: reduce) {
  .busy-bar::before {
    left: 0;
    width: 100%;
    animation: none;
  }

  .spinner {
    animation: none;
    border-right-color: currentColor;
    opacity: 0.6;
  }
}

/* ---------- ページ送り ---------- */

.pager {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1rem;
}

ul.notice {
  padding-left: 2rem;
}

/* ---------- YouTube の配信のサムネイル（youtubeThumbnails.js） ---------- */

.youtube-thumbnails {
  margin-top: 1rem;
  padding: 0.75rem 1rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.youtube-thumbnails-title {
  margin: 0;
  font-size: 0.875rem;
}

.youtube-thumbnails .thumbnail-choices:not(:empty) {
  margin: 0.75rem 0;
}
