@font-face {
  font-family: "MessagePreviewFont";
  src: url("/assets/fonts/message.otf") format("opentype");
  font-display: swap;
}

:root {
  /* --- Color: Backgrounds (dark to light) --- */
  --bg-base: #0a0a0a;         /* body background */
  --bg-panel: #1a1a1a;        /* primary panels */
  --bg-elevated: #232323;     /* sub-panels, hover state */
  --bg-input: #141414;        /* form inputs */

  /* --- Color: Borders --- */
  --border-default: #2a2a2a;
  --border-strong: #3a3a3a;

  /* --- Color: Text --- */
  --text: #ececec;
  --text-muted: #9a9a9a;

  /* --- Color: Accents --- */
  --accent: #3dd6c6;
  --accent-strong: #23b8a9;
  --accent-soft: rgba(61, 214, 198, 0.12);

  /* --- Color: Status --- */
  --danger: #ff8a80;
  --success: #8ee7a8;
  --warning: #ffd36a;

  /* --- Radius --- */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 999px;

  /* --- Spacing (4px scale) --- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;

  /* --- Legacy aliases (1st sweep 互換用、将来削除) --- */
  --bg: var(--bg-base);
  --panel: var(--bg-panel);
  --line: var(--border-default);
  --muted: var(--text-muted);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Hiragino Sans", "Yu Gothic", sans-serif;
  color: var(--text);
  color-scheme: dark;
  background:
    radial-gradient(circle at top left, rgba(61, 214, 198, 0.14), transparent 24%),
    linear-gradient(180deg, #050505 0%, #000000 100%);
}

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

.site-header,
.page {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 0 14px;
  gap: 16px;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.site-brand h1 {
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0;
}

.site-brand-divider {
  width: 1px;
  height: 22px;
  background: var(--line);
}

.site-brand-provider {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.header-logo {
  width: auto;
  height: 22px;
  object-fit: contain;
  opacity: 0.78;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* 言語切替: セグメント式 JA | EN */
.lang-switch {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  background: var(--bg-input);
}

.lang-option {
  min-width: 46px;
  padding: 5px 12px;
  border: none;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.lang-option:hover {
  color: var(--text);
}

.lang-option.active {
  background: var(--accent);
  color: #041413;
}

.page {
  padding: 12px 0 40px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 28px;
  margin-bottom: 20px;
}

.panel {
  padding: 24px;
}

.page > .panel + .panel {
  margin-top: 20px;
}

.panel > h2 {
  display: block;
  margin: 0 0 20px;
  padding: 0 0 12px;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.panel > h3,
.section-head h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  background: transparent;
}

/* 単独見出しは下線で区切ってメリハリを出す */
.panel > h3 {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.panel > h3::before,
.section-head h3::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 16px;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}

.panel > h3 .panel-title-link,
.section-head h3 .panel-title-link {
  display: inline-flex;
  align-items: center;
  color: var(--text);
}

.panel > h3 .panel-title-link:hover,
.panel > h3 .panel-title-link:focus-visible,
.section-head h3 .panel-title-link:hover,
.section-head h3 .panel-title-link:focus-visible {
  color: var(--accent);
}

.grid {
  display: grid;
  gap: 20px;
  margin-bottom: 20px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid {
  display: grid;
  gap: 14px;
}

.form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid .full,
.full {
  grid-column: 1 / -1;
}

.form-section-heading {
  display: grid;
  gap: 8px;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.form-section-heading::before {
  content: "";
  height: 1px;
  background: rgba(255, 255, 255, 0.2);
}

.form-divider {
  height: 1px;
  margin-top: 4px;
  background: rgba(255, 255, 255, 0.2);
}

.half-control > input,
.half-control > select,
.half-control > textarea {
  max-width: calc((100% - 14px) / 2);
}

label {
  display: grid;
  gap: 6px;
  font-weight: 500;
  font-size: 0.88rem;
  color: var(--text-muted);
}

input,
select,
textarea,
button {
  font: inherit;
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  padding: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text);
  background: var(--bg-input);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(61, 214, 198, 0.15);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

.monitor-project-info {
  display: grid;
  gap: 16px;
  margin: 0;
}

.monitor-project-info > div {
  display: grid;
  grid-template-columns: minmax(100px, 160px) minmax(0, 1fr);
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.monitor-project-info > div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.monitor-project-info dt {
  color: var(--text-muted);
  font-weight: 600;
}

.monitor-project-info dd {
  margin: 0;
  color: var(--text);
}

.monitor-project-memo {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.monitor-snapshot-panel {
  text-align: center;
}

.monitor-snapshot-panel > h2 {
  text-align: left;
}

.monitor-snapshot {
  display: block;
  width: min(100%, 1152px);
  height: auto;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #000;
}

/* ファイル選択ボタンをテーマに合わせる */
input[type="file"] {
  padding: 7px 12px;
  cursor: pointer;
}

input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 6px 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--border-strong);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.12s;
}

input[type="file"]::file-selector-button:hover {
  background: #4a4a4a;
}

/* ============================================================
 * Button variants
 * ------------------------------------------------------------
 * .button          → Primary CTA: pill, accent fill (保存/適用/再生)
 * .button.muted    → Secondary CTA: pill, neutral fill (戻る/キャンセル)
 * .button.rect     → Compact action: 矩形 radius-sm (テーブル行・↑↓・削除)
 * .icon-button     → Icon-only: 矩形 radius-sm, 中身は SVG
 * .toggle-button   → Power toggle 専用 (pill)
 * .segmented-button → Segmented control 専用 (矩形 radius-sm)
 * ============================================================ */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #041413;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}

.button:hover { background: var(--accent-strong); }
.button:active { transform: translateY(1px); }

.button.muted {
  background: var(--border-strong);
  color: var(--text);
}

.button.muted:hover { background: #4a4a4a; }

/* Compact (rect) variant for in-table actions */
.button.rect {
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.82rem;
  min-width: 0;
}

/* テーブル行内 / playlist 行内 / playground 行内 では自動で矩形に */
td .button,
.playlist-item-actions .button,
.playground-row-actions .button {
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.82rem;
  min-width: 0;
}

.symbol-button {
  min-width: 44px;
  padding: 10px 14px;
  font-size: 1rem;
  line-height: 1;
}

/* Icon-only button */
.icon-button {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  color: var(--text);
  cursor: pointer;
}

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

.icon-button img,
.icon-button svg {
  display: block;
  height: 18px;
  width: auto;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.overlay-action-row {
  margin-top: 4px;
}

.overlay-apply-button {
  min-width: 148px;
  padding: 14px 26px;
  font-weight: 700;
  box-shadow: 0 0 0 3px rgba(61, 214, 198, 0.18), 0 12px 28px rgba(61, 214, 198, 0.22);
}

.summary-list {
  display: grid;
  gap: 12px;
}

.summary-list div {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-default);
}

.summary-list.compact div {
  grid-template-columns: 88px 1fr;
}

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

dd {
  margin: 0;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.section-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stack-block + .stack-block {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border-default);
}

.playlist-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.playlist-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.playlist-actions form {
  margin: 0;
}

td form {
  margin: 0;
}

.brightness-form {
  display: grid;
  gap: 16px;
}

.brightness-form input[type="range"] {
  padding: 0;
  accent-color: var(--accent);
}

.brightness-actions {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  align-items: center;
  gap: 16px;
}

.brightness-note {
  min-width: 0;
}

.brightness-submit {
  justify-self: center;
}

.power-toggle {
  display: inline-flex;
  align-items: center;
  justify-self: end;
  padding: 4px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  background: var(--bg-input);
}

.power-toggle form {
  margin: 0;
}

.toggle-button {
  min-width: 72px;
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.toggle-button.active {
  background: var(--accent);
  color: #041413;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border-default);
  text-align: left;
  vertical-align: top;
}

.subtle,
.user-label {
  color: var(--muted);
}

.flash-list {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

.flash {
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
}

.flash.success {
  color: var(--success);
  background: rgba(34, 68, 44, 0.55);
  border-color: rgba(142, 231, 168, 0.45);
}

.flash.warning {
  color: var(--warning);
  background: rgba(86, 67, 24, 0.55);
  border-color: rgba(255, 211, 106, 0.45);
}

.flash.error {
  color: var(--danger);
  background: rgba(82, 32, 32, 0.55);
  border-color: rgba(255, 138, 128, 0.45);
}

.narrow {
  max-width: 560px;
  margin: 40px auto 0;
}

.inline-note {
  margin-top: 14px;
  color: var(--success);
}

.upload-progress {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(61, 214, 198, 0.28);
  border-radius: var(--radius-md);
  color: var(--text);
  background: rgba(61, 214, 198, 0.08);
  font-size: 0.88rem;
}

.upload-progress[hidden] {
  display: none;
}

.upload-progress-spinner {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(236, 236, 236, 0.28);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: upload-progress-spin 0.8s linear infinite;
}

@keyframes upload-progress-spin {
  to {
    transform: rotate(360deg);
  }
}

.upload-meta {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--bg-input);
}

.preview-panel {
  display: grid;
  gap: 14px;
}

.mv-options {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--bg-input);
  transition: opacity 0.2s ease;
}

.mv-options-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 12px;
  align-items: center;
}

.mv-options-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.mv-options.is-disabled {
  opacity: 0.55;
}

.toggle-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.toggle-check input[type="checkbox"] {
  margin: 0;
  accent-color: var(--accent);
}

.checkbox-field {
  align-content: start;
}

.checkbox-field input[type="checkbox"] {
  justify-self: start;
  margin-top: 4px;
  accent-color: var(--accent);
}

.playlist-editor {
  display: grid;
  gap: 18px;
}

.playlist-edit-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--bg-input);
}

.playlist-edit-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}

.playlist-edit-head .full {
  flex: 0 1 50%;
  min-width: min(320px, 100%);
}

.playlist-table-wrap {
  overflow-x: auto;
}

.playlist-edit-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.playlist-edit-table th:first-child,
.playlist-edit-table td:first-child {
  width: 50%;
}

.playlist-edit-table th:nth-child(2),
.playlist-edit-table td:nth-child(2) {
  width: 160px;
}

.playlist-edit-table th:nth-child(3),
.playlist-edit-table td:nth-child(3) {
  width: 140px;
}

.playlist-edit-table th:nth-child(4),
.playlist-edit-table td:nth-child(4) {
  width: 96px;
}

.playlist-edit-table td select,
.playlist-edit-table td input {
  width: 100%;
  min-width: 0;
}

.playlist-edit-table .item-duration-input,
.playlist-edit-table .item-volume-input {
  min-width: 110px;
}

.playlist-item-actions {
  white-space: nowrap;
}

.schedule-editor {
  display: grid;
  gap: 18px;
}

.schedule-edit-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--bg-input);
}

.schedule-edit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

.schedule-spot-check {
  align-self: end;
  min-height: 42px;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  color: var(--text);
}

.schedule-spot-check input {
  flex: 0 0 auto;
}

.schedule-weekdays {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.schedule-weekdays legend {
  flex: 0 0 100%;
  margin-bottom: -2px;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
}

.weekday-button {
  display: inline-flex;
  min-width: 42px;
  min-height: 36px;
  cursor: pointer;
}

.weekday-button input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.weekday-button span {
  display: inline-flex;
  width: 42px;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.weekday-button input:checked + span {
  border-color: var(--accent);
  background: var(--accent);
  color: #041413;
}

.weekday-button input:focus-visible + span {
  box-shadow: 0 0 0 3px rgba(61, 214, 198, 0.15);
}

.schedule-end-time-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.playground-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}

.playground-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.playground-header h2 {
  margin: 0;
}

.playground-mode-switch {
  display: flex;
  align-items: center;
  gap: 12px;
}

.playground-mode-switch .power-toggle {
  justify-self: auto;
}

.playground-block {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--bg-input);
}

.playground-block.playground-mode-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.playground-block .section-head {
  margin-bottom: 0;
}

.playground-table th:first-child,
.playground-table td:first-child {
  width: auto;
}

.playground-table th:nth-child(2),
.playground-table td:nth-child(2) {
  width: 76px;
}

.playground-table th:nth-child(3),
.playground-table td:nth-child(3) {
  width: 86px;
}

.playground-table td select,
.playground-table td input {
  width: 100%;
  min-width: 0;
}

.playground-table .playground-duration-input {
  min-width: 0;
  padding-inline: 8px;
  text-align: center;
}

.playground-row-actions {
  white-space: normal;
}

.playground-row-actions .button {
  min-width: 0;
  margin: 0 6px 6px 0;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
}

.playground-actions {
  justify-content: space-between;
}

.playground-text-stack {
  display: grid;
  gap: 16px;
}

.playground-text-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--bg-base);
}

.playground-message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-start;
  justify-self: start;
}

.playground-generate-control {
  display: grid;
  gap: 6px;
  justify-items: start;
}

.playground-generate-status {
  color: var(--text-muted);
  font-size: 0.86rem;
}

.playground-message-head,
.playground-row-head,
.playground-row-settings {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.playground-message-head {
  justify-content: space-between;
}

.playground-message-head-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: flex-end;
}

.playground-layout-select,
.playground-number-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.playground-layout-select select {
  width: auto;
  min-width: 96px;
}

.playground-message-rows {
  display: grid;
  gap: 14px;
}

.playground-message-row {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
}

.playground-message-row[hidden] {
  display: none;
}

.playground-primary-textarea {
  min-height: 3.1rem;
  resize: vertical;
}

.playground-number-control input {
  width: 68px;
}

.playground-number-control-speed input,
.playground-number-control-size input {
  width: 60px;
}

.playground-number-control-letter-spacing input {
  width: 56px;
}

.playground-message-preview {
  display: flex;
  justify-content: center;
  padding: 10px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: #000000;
}

.playground-message-preview-video {
  display: block;
  width: min(50%, 260px);
  height: auto;
  border: 1pt solid var(--border-strong);
  image-rendering: pixelated;
  transform: rotate(var(--preview-rotation, 0deg));
  transform-origin: center;
}

.playground-message-preview-placeholder {
  width: min(50%, 260px);
  min-height: 80px;
  display: grid;
  place-items: center;
  border: 1pt solid var(--border-strong);
  color: var(--text-muted);
  font-size: 0.86rem;
  text-align: center;
}

.playground-scroll-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.playground-scroll-option input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.playground-color-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.playground-color-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.playground-color-option input[type="radio"] {
  width: auto;
  margin: 0;
}

.playground-color-custom {
  flex-wrap: wrap;
}

.playground-color-custom-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.playground-color-code-input {
  width: 82px;
  padding: 8px 10px;
  font-size: 0.9rem;
  text-transform: uppercase;
}

.playground-color-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.playground-color-red {
  background: #ff0000;
}

.playground-color-blue {
  background: #0000ff;
}

.playground-color-green {
  background: #00ff00;
}

.playground-color-yellow {
  background: #ffff00;
}

.playground-color-label {
  font-size: 0.9rem;
}

.preview-shell {
  display: flex;
  justify-content: center;
}

.preview-stage {
  position: relative;
  width: min(100%, 520px);
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(61, 214, 198, 0.12), rgba(24, 24, 24, 0.95)),
    repeating-linear-gradient(
      45deg,
      rgba(61, 214, 198, 0.08) 0,
      rgba(61, 214, 198, 0.08) 12px,
      rgba(255, 255, 255, 0.03) 12px,
      rgba(255, 255, 255, 0.03) 24px
    );
}

.preview-media,
.preview-placeholder,
.crop-guide {
  position: absolute;
  inset: 0;
}

.preview-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.preview-placeholder {
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

.crop-guide {
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.55);
  pointer-events: none;
}

@media (max-width: 800px) {
  .hero,
  .site-header,
  .grid.two,
  .form-grid.two {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: flex-start;
  }

  .half-control > input,
  .half-control > select,
  .half-control > textarea {
    max-width: none;
  }

  .summary-list div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .brightness-actions {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .brightness-submit,
  .power-toggle {
    justify-self: start;
  }

  .playground-layout {
    grid-template-columns: 1fr;
  }

  .playground-actions {
    justify-content: flex-start;
  }

  .playground-header,
  .playground-mode-switch,
  .playground-block.playground-mode-block {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ===== Now Playing hero ===== */
.now-playing {
  position: relative;
  padding: 24px 28px;
  margin-bottom: 20px;
  background:
    radial-gradient(circle at 8% 50%, rgba(61, 214, 198, 0.16), transparent 50%),
    linear-gradient(135deg, rgba(61, 214, 198, 0.05), rgba(35, 35, 35, 0.7));
  border: 1px solid rgba(61, 214, 198, 0.22);
  border-radius: var(--radius-lg);
}

.now-playing-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  padding: 4px 12px 4px 4px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
}

.now-playing-eyebrow-label {
  display: inline-block;
  padding: 2px 8px;
  background: var(--accent);
  color: #041413;
  border-radius: var(--radius-pill);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.now-playing-eyebrow-value {
  color: var(--text);
  font-weight: 600;
}

.now-playing-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  font-weight: 700;
  text-transform: uppercase;
}

.now-playing-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(61, 214, 198, 0.18);
}

.now-playing-title {
  font-size: 1.55rem;
  font-weight: 600;
  margin: 0 0 4px;
}

.now-playing-source {
  color: var(--muted);
  margin: 0;
  font-size: 0.95rem;
}

.now-playing-source strong {
  color: var(--text);
  font-weight: 600;
}

.now-playing-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 36px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.now-playing-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.now-playing-stat-label {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
}

.now-playing-stat-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.now-playing-stat-value.is-on {
  color: var(--accent);
}

.now-playing-actions {
  position: absolute;
  top: 24px;
  right: 28px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px 14px;
}

.now-playing-actions form {
  margin: 0;
}

.now-playing-toggle-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.now-playing-action-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

/* ===== Quick actions strip ===== */
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 12px 16px;
  margin-bottom: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.quick-actions a {
  padding: 8px 14px;
  font-size: 0.88rem;
  color: var(--muted);
  border-radius: var(--radius-sm);
  transition: background 0.12s, color 0.12s;
}

.quick-actions a:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

/* ===== Details (collapsed settings) ===== */
.details-block {
  margin-top: 20px;
}

.details-block > summary {
  cursor: pointer;
  padding: 10px 14px;
  color: var(--muted);
  font-size: 0.92rem;
}

.details-block > summary:hover {
  color: var(--text);
}

/* ===== Power toggle wrap ===== */
.power-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

@media (max-width: 800px) {
  .now-playing-actions {
    position: static;
    margin-top: 14px;
    justify-content: flex-start;
  }
  .now-playing-stats {
    gap: 20px;
  }
  .schedule-edit-grid {
    grid-template-columns: 1fr;
  }
  .schedule-weekdays {
    gap: 6px;
  }
}

/* ===== Focus visible (a11y) ===== */
:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: inherit;
}

/* Form 入力欄は box-shadow リング（Task 08）と共存。視覚過剰を避けるため offset を詰める。 */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline-offset: 0;
}

/* マウスクリック時のリングは出さない（:focus-visible 標準挙動の保険） */
:focus:not(:focus-visible) {
  outline: none;
}

/* ===== Playground syntax help ===== */
.playground-help { margin-top: 16px; }
.playground-help > summary {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.88rem;
  padding: 6px 0;
}
.syntax-help {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding: 12px 14px;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  font-size: 0.88rem;
}
.syntax-help > div {
  display: grid;
  grid-template-columns: minmax(140px, auto) 1fr;
  gap: 14px;
}
.syntax-help dt {
  color: var(--text-muted);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
.syntax-help dd { margin: 0; color: var(--text); }

/* ===== Playground message toolbar ===== */
.msg-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 6px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
}

.msg-toolbar-btn {
  padding: 4px 10px;
  font-size: 0.82rem;
  border: none;
  background: var(--bg-elevated);
  color: var(--text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s;
}

.msg-toolbar-btn:hover {
  background: var(--border-default);
}

.msg-toolbar-btn:active {
  background: var(--accent);
  color: #041413;
}
