/* サイドパネルの中（data-surface="side-panel"）で使う色は tokens.css */
@import url("tokens.css");

* {
  box-sizing: border-box;
}

:root {
  color-scheme: light;
}

/* Creation forms grow with their fields; the chat panel's fixed viewport does not apply. */
html {
  overflow-y: auto;
}

body {
  height: auto;
  min-height: 100%;
  overflow: visible;
  margin: 0;
  background: #f4f6f8;
  color: #202124;
  font-size: 15px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.create-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px max(16px, calc((100vw - 760px) / 2));
  border-bottom: 1px solid #e0e4e9;
  background: #fff;
}

.create-header a {
  color: #c9000b;
  font-size: 17px;
  font-weight: 800;
  text-decoration: none;
}

.create-header span {
  color: #697386;
  font-size: 13px;
}

.create-main {
  display: block;
  height: auto;
  overflow: visible;
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.draft-recovery {
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid #e0a21a;
  border-radius: 10px;
  background: #fff8e8;
  color: #553700;
}

.draft-recovery-label {
  color: #a06100;
  font-size: 13px;
  font-weight: 800;
}

.draft-recovery h2 {
  margin: 5px 0 8px;
  color: #30250f;
  font-size: 19px;
}

.draft-recovery p {
  margin: 0;
  line-height: 1.6;
}

.draft-recovery-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.draft-recovery-actions button {
  min-height: 44px;
  padding: 9px 12px;
  border-radius: 7px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.draft-recovery-primary {
  border: 0;
  background: #e50914;
  color: #fff;
}

.draft-recovery-secondary {
  border: 1px solid #c5a45f;
  background: #fff;
  color: #6b4500;
}

.draft-recovery-actions button:disabled {
  cursor: wait;
  opacity: .65;
}

.create-lead,
.create-disclosure,
.create-rules {
  color: #52606d;
  font-size: 14px;
  line-height: 1.6;
}

.create-video {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 10px;
  align-items: center;
  margin: 14px 0 18px;
  padding: 10px;
  border: 1px solid #dfe4ea;
  border-radius: 8px;
  background: #fff;
}

.create-video img {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  object-fit: cover;
}

.create-video img[hidden] + div {
  grid-column: 1 / -1;
}

.create-video div {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.create-video span {
  color: #c9000b;
  font-size: 13px;
  font-weight: 800;
}

.create-video strong {
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

form {
  display: grid;
  gap: 8px;
}

label {
  margin-top: 8px;
  color: #202124;
  font-size: 14px;
  font-weight: 700;
}

label b {
  color: #c9000b;
  font-size: 12px;
}

input,
textarea {
  width: 100%;
  height: 44px;
  padding: 0 10px;
  border: 1px solid #cfd5dc;
  border-radius: 7px;
  background: #fff;
  color: #202124;
  font: inherit;
  font-size: 15px;
}

.video-title-status {
  min-height: 20px;
  margin: -2px 0 4px;
  color: #697386;
  font-size: 12px;
  line-height: 1.5;
}

.video-title-status[data-state="loading"] {
  color: #8a5700;
}

.video-title-status[data-state="success"] {
  color: #087a42;
}

.video-title-status[data-state="manual"] {
  color: #a33a00;
}

textarea {
  min-height: 88px;
  padding: 10px;
  resize: vertical;
}

.create-optional-details {
  margin: 10px 0 2px;
  border: 1px solid #dfe4ea;
  border-radius: 8px;
  background: #fff;
}

.create-optional-details summary {
  padding: 13px 14px;
  color: #354052;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.create-optional-details[open] summary {
  border-bottom: 1px solid #e6e9ed;
}

.create-optional-fields {
  display: grid;
  gap: 8px;
  padding: 4px 14px 14px;
}

fieldset {
  margin: 10px 0;
  padding: 12px;
  border: 1px solid #dfe4ea;
  border-radius: 8px;
  background: #fff;
}

legend {
  padding: 0 5px;
  color: #202124;
  font-size: 14px;
  font-weight: 700;
}

.style-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.style-tags label {
  display: flex;
  gap: 5px;
  align-items: center;
  margin: 0;
  padding: 7px 10px;
  border-radius: 999px;
  background: #eceff3;
  cursor: pointer;
}

.style-tags input {
  width: auto;
  height: auto;
}

.create-rules {
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid #dfe4ea;
  border-radius: 8px;
  background: #fff;
}

.create-rules ul {
  margin: 6px 0 0;
  padding-left: 20px;
}

.create-disclosure a {
  color: #b0000a;
}

.create-submit-bar {
  position: static;
  padding: 0;
  margin-top: 8px;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

button[type="submit"] {
  display: block;
  width: min(100%, 728px);
  height: 48px;
  margin: 0 auto;
  border: 0;
  border-radius: 8px;
  background: #e50914;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

button[type="submit"]:disabled {
  cursor: wait;
  opacity: .65;
}

@media (max-width: 380px) {
  .draft-recovery-actions {
    grid-template-columns: 1fr;
  }

  .create-video {
    grid-template-columns: 1fr;
  }
}

#createError {
  border-color: #ffc7c7;
  background: #fff0f0;
  color: #a61b1b;
}

:root[data-surface="side-panel"] {
  color-scheme: dark;
  scrollbar-color: var(--border-strong) var(--panel-background);
}

html[data-surface="side-panel"] body {
  background: var(--panel-background);
  color: var(--text);
}

html[data-surface="side-panel"] .create-header {
  border-color: var(--border);
  background: var(--surface);
}

html[data-surface="side-panel"] .create-header a,
html[data-surface="side-panel"] .create-video span,
html[data-surface="side-panel"] label b {
  color: var(--brand);
}

html[data-surface="side-panel"] .create-header span,
html[data-surface="side-panel"] .create-lead,
html[data-surface="side-panel"] .create-disclosure,
html[data-surface="side-panel"] .create-rules,
html[data-surface="side-panel"] .video-title-status {
  color: var(--muted);
}

html[data-surface="side-panel"] .draft-recovery {
  border-color: var(--warning-border);
  background: var(--warning-soft);
  color: var(--warning);
}

html[data-surface="side-panel"] .draft-recovery-label {
  color: var(--warning);
}

html[data-surface="side-panel"] .draft-recovery h2 {
  color: var(--text);
}

html[data-surface="side-panel"] .draft-recovery-secondary {
  border-color: var(--warning-border);
  background: var(--surface-elevated);
  color: var(--warning);
}

html[data-surface="side-panel"] .create-video,
html[data-surface="side-panel"] .create-optional-details,
html[data-surface="side-panel"] fieldset,
html[data-surface="side-panel"] .create-rules {
  border-color: var(--border);
  background: var(--surface);
}

html[data-surface="side-panel"] label,
html[data-surface="side-panel"] legend,
html[data-surface="side-panel"] .create-optional-details summary {
  color: var(--text);
}

html[data-surface="side-panel"] input,
html[data-surface="side-panel"] textarea {
  border-color: var(--border-strong);
  background: var(--surface-elevated);
  color: var(--text);
  caret-color: var(--text);
}

html[data-surface="side-panel"] input::placeholder,
html[data-surface="side-panel"] textarea::placeholder {
  color: var(--subtle);
}

html[data-surface="side-panel"] .video-title-status[data-state="loading"],
html[data-surface="side-panel"] .video-title-status[data-state="manual"] {
  color: var(--warning);
}

html[data-surface="side-panel"] .video-title-status[data-state="success"] {
  color: var(--success);
}

html[data-surface="side-panel"] .create-optional-details[open] summary {
  border-color: var(--border);
}

html[data-surface="side-panel"] .style-tags label {
  background: var(--surface-elevated);
}

html[data-surface="side-panel"] .create-disclosure a {
  color: var(--danger);
}

html[data-surface="side-panel"] .create-submit-bar {
  position: fixed;
  z-index: 20;
  right: 0;
  bottom: 0;
  left: 0;
  margin: 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 -6px 18px rgba(0, 0, 0, .2);
}

html[data-surface="side-panel"] { overflow-y: auto; scroll-padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
html[data-surface="side-panel"] body { height: auto; min-height: 100%; overflow: visible; }
html[data-surface="side-panel"] .create-main { display: block; height: auto; overflow: visible; padding-top: 16px; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
html[data-surface="side-panel"] .create-video { grid-template-columns: 88px minmax(0, 1fr); gap: 10px; margin: 12px 0; }
html[data-surface="side-panel"] .create-video strong { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; white-space: normal; overflow-wrap: anywhere; }
.create-rules summary { font-weight: 700; }
[data-panel-details] > summary { cursor: pointer; }

html[data-surface="side-panel"] #createError {
  border-color: var(--danger-border);
  background: var(--danger-soft);
  color: var(--danger);
}

.create-main h1 { font-size: clamp(23px, 5vw, 30px); line-height: 1.35; }
.create-header { gap: 12px; flex-wrap: wrap; }
.prepared-start { width: 100%; min-height: 48px; padding: 12px; border: 0; border-radius: 8px; background: #e50914; color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.prepared-start:disabled { opacity: .5; cursor: default; }
#preparedRoomDetailsLink { display: inline-block; margin-top: 18px; color: #b0000a; }
html[data-surface="side-panel"] #preparedRoomDetailsLink { color: var(--blue); }
#preparedRoomPanel p { line-height: 1.65; }

.edit-video-title,
.restore-recruitment {
  width: auto;
  padding: 6px 10px;
  border: 1px solid #98a2b3;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.create-video .edit-video-title { margin-top: 6px; }
#videoTitleFields { margin-bottom: 8px; }
#videoUrlFields { display: grid; gap: 8px; }
#videoUrlFields[hidden] { display: none; }
#editVideoUrlButton { justify-self: start; }
#videoTitleFields[hidden], .edit-video-title[hidden], .restore-recruitment[hidden] { display: none; }
#videoTitleFields .edit-video-title { margin-top: 6px; }
.create-video .edit-video-title { justify-self: start; }
.restore-recruitment { justify-self: start; }
#recruitmentRestoreStatus:empty, #videoTitleStatus:empty { display: none; }
/* The preview card already shows the auto-filled title, so the success note is redundant. */
#videoTitleStatus[data-state="success"] { display: none; }

/* Keep the public-room action visible while the optional fields are expanded. */
html:not([data-surface="side-panel"]):has(#publicWatchCreateForm) {
  scroll-padding-bottom: calc(96px + env(safe-area-inset-bottom));
}
html:not([data-surface="side-panel"]) #publicWatchCreateForm {
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
html:not([data-surface="side-panel"]) #publicWatchCreateForm .create-submit-bar {
  position: fixed;
  z-index: 20;
  inset: auto 0 0;
  margin: 0;
  padding: 12px max(16px, calc((100% - 728px) / 2)) calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid #e0e4e9;
  background: #f4f6f8;
  box-shadow: 0 -4px 14px rgba(0, 0, 0, .06);
}
#publicWatchCreateForm[hidden] { display: none; }

.public-create-update { padding: 16px; border: 1px solid #bf343f; border-radius: 10px; background: #fff2f3; color: #8a1721; line-height: 1.7; }
.public-create-update h2 { margin: 0 0 12px; font-size: 18px; }
.public-create-update p { margin: 12px 0; }
.public-create-update .public-create-update-link { display: block; box-sizing: border-box; text-align: center; text-decoration: none; }
html[data-surface="side-panel"] .public-create-update { background: var(--danger-soft); border-color: var(--danger-border); color: var(--text); }
html[data-surface="side-panel"] .public-create-update h2 { color: var(--danger); }

.public-create-update-link { padding: 10px 12px; border: 1px solid currentColor; border-radius: 8px; color: inherit; font-weight: 700; min-height: 44px; }

/* Data-handling note folded under a short summary on both create pages. */
.create-disclosure-details summary { cursor: pointer; font-weight: 700; }
.create-disclosure-details p { margin: .45rem 0 0; }
