:root {
  color-scheme: dark;
  --bg: #071018;
  --surface: #0d1822;
  --surface-raised: #12212d;
  --surface-soft: #172834;
  --line: #253846;
  --line-strong: #365062;
  --text: #f5f8fa;
  --text-muted: #94a8b7;
  --text-subtle: #6f8798;
  --accent: #ff5d2a;
  --accent-hover: #ff754d;
  --accent-soft: #3a1d18;
  --cyan: #42d3c5;
  --danger: #ff6b71;
  --success: #4dd6a8;
  --warning: #ffc15a;
  --shadow: 0 20px 60px rgb(0 0 0 / 28%);
  --radius: 10px;
  font-family:
    Inter, "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
}

* {
  box-sizing: border-box;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background-color: var(--bg);
}

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

button,
select {
  cursor: pointer;
}

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

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid rgb(66 211 197 / 42%);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 14px;
  color: #06100f;
  background: var(--cyan);
  border-radius: 6px;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 14px clamp(20px, 3vw, 48px);
  background: rgb(7 16 24 / 94%);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

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

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  background: var(--accent);
  border-radius: 8px;
  box-shadow: 0 0 0 5px rgb(255 93 42 / 10%);
}

.brand-mark span {
  width: 0;
  height: 0;
  margin-left: 3px;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 11px solid #fff;
}

.brand h1,
.brand p,
.section-heading h2,
.section-heading p {
  margin: 0;
}

.brand h1 {
  font-size: 1.22rem;
  letter-spacing: 0.13em;
}

.eyebrow,
.section-kicker {
  color: var(--text-subtle);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.header-status {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.header-status-dot {
  width: 7px;
  height: 7px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgb(77 214 168 / 12%);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(340px, 0.72fr);
  gap: clamp(18px, 2vw, 32px);
  width: min(1920px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 10px clamp(18px, 2vw, 32px) 32px;
}

.player-column,
.control-column {
  min-width: 0;
}

.player-column {
  position: relative;
  align-self: stretch;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
}

.section-heading h2 {
  margin-top: 2px;
  font-size: clamp(1.25rem, 2vw, 1.65rem);
}

.video-id-label {
  max-width: 48%;
  overflow: hidden;
  color: var(--text-muted);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-frame {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #020609;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

#youtube-player,
#youtube-player iframe {
  display: block;
  width: 100%;
  height: 100%;
}

.player-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 24px;
  text-align: center;
  background-color: #050a0f;
  border: 10px solid #071017;
  box-shadow: inset 0 0 0 1px #172631;
}

.placeholder-icon {
  display: grid;
  width: 54px;
  height: 54px;
  margin-bottom: 18px;
  place-items: center;
  padding-left: 3px;
  color: #fff;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 8px rgb(255 93 42 / 9%);
}

.player-placeholder p {
  max-width: 500px;
  margin: 0 0 7px;
  font-size: clamp(0.95rem, 1.6vw, 1.08rem);
  font-weight: 700;
}

.player-placeholder span {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.playback-controls {
  display: grid;
  grid-template-columns: 1fr 1fr 1.35fr;
  gap: 9px;
  margin-top: 12px;
}

.control-button {
  display: flex;
  min-height: 54px;
  gap: 9px;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 750;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 7px;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.control-button:hover {
  background: var(--surface-soft);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.control-button > span:first-child {
  color: var(--cyan);
  font-family: Consolas, monospace;
  font-size: 0.76rem;
}

.control-button kbd {
  margin-left: auto;
}

.live-button {
  background: var(--accent-soft);
  border-color: rgb(255 93 42 / 42%);
}

.live-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgb(255 93 42 / 16%);
}

kbd {
  display: inline-block;
  min-width: 22px;
  padding: 2px 5px;
  color: var(--text-muted);
  font-family: Consolas, monospace;
  font-size: 0.66rem;
  text-align: center;
  background: #091119;
  border: 1px solid var(--line);
  border-bottom-color: var(--line-strong);
  border-radius: 4px;
}

.player-status {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 66px;
  margin-top: 13px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: 7px;
}

.status-indicator {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  background: var(--text-subtle);
  border-radius: 50%;
}

.player-status.is-ready {
  border-left-color: var(--success);
}

.player-status.is-ready .status-indicator {
  background: var(--success);
  box-shadow: 0 0 0 5px rgb(77 214 168 / 10%);
}

.player-status.is-playing {
  border-left-color: var(--accent);
}

.player-status.is-playing .status-indicator {
  background: var(--accent);
  box-shadow: 0 0 0 5px rgb(255 93 42 / 12%);
}

.player-status.is-error {
  border-left-color: var(--danger);
}

.player-status.is-error .status-indicator {
  background: var(--danger);
}

.player-status div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.player-status strong {
  font-size: 0.86rem;
}

.player-status div span {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shortcut-guide {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: center;
  margin-top: 19px;
  padding: 13px 0;
  color: var(--text-muted);
  font-size: 0.72rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.shortcut-guide strong {
  color: var(--cyan);
  font-size: 0.65rem;
  letter-spacing: 0.13em;
}

.control-column {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.control-block {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

label {
  display: block;
  margin-bottom: 8px;
  color: #dbe6ec;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

input,
textarea,
select {
  width: 100%;
  color: var(--text);
  background: #08131c;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
}

input,
select {
  min-height: 46px;
  padding: 0 12px;
}

textarea {
  min-height: 168px;
  padding: 13px 14px;
  line-height: 1.65;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #617786;
}

input:hover,
textarea:hover,
select:hover {
  border-color: #466274;
}

.input-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.secondary-button {
  min-height: 46px;
  padding: 0 16px;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 800;
  background: var(--surface-soft);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
}

.secondary-button:hover {
  background: #203441;
}

.field-help {
  margin: 8px 0 0;
  color: var(--text-subtle);
  font-size: 0.68rem;
}

.memo-compose {
  position: relative;
  border-top: 3px solid var(--accent);
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.label-row span {
  color: var(--text-subtle);
  font-size: 0.68rem;
}

.save-settings {
  display: grid;
  grid-template-columns: auto minmax(150px, 0.6fr);
  gap: 15px;
  align-items: center;
  margin-top: 12px;
}

.save-settings label {
  margin: 0;
}

.primary-button {
  display: flex;
  width: 100%;
  min-height: 66px;
  gap: 13px;
  align-items: center;
  justify-content: center;
  margin-top: 12px;
  padding: 11px 18px;
  color: #fff;
  font-weight: 850;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 7px;
  box-shadow: 0 9px 24px rgb(255 93 42 / 20%);
  transition:
    background-color 150ms ease,
    transform 150ms ease,
    box-shadow 150ms ease;
}

.primary-button:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgb(255 93 42 / 26%);
}

.primary-button:active {
  transform: translateY(0);
}

.save-button-icon {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  font-size: 1.35rem;
  font-weight: 400;
  border: 1px solid rgb(255 255 255 / 45%);
  border-radius: 50%;
}

.primary-button > span:last-child {
  display: flex;
  flex-direction: column;
  gap: 1px;
  text-align: left;
}

.primary-button small {
  font-size: 0.63rem;
  font-weight: 650;
  opacity: 0.72;
}

.notes-block {
  min-height: 300px;
}

.notes-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(155px, 0.7fr);
  gap: 10px;
}

.utility-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.utility-button {
  min-height: 38px;
  padding: 0 13px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 750;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.utility-button:hover {
  color: var(--text);
  background: var(--surface-raised);
  border-color: var(--line-strong);
}

.danger-button {
  margin-left: auto;
  color: #f3a3a6;
  border-color: rgb(255 107 113 / 25%);
}

.danger-button:hover {
  color: #ffd7d8;
  background: rgb(255 107 113 / 9%);
  border-color: rgb(255 107 113 / 45%);
}

.notes-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 24px 0 10px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.notes-heading h2 {
  margin: 0;
  font-size: 1rem;
}

.memo-count {
  color: var(--cyan);
  font-family: Consolas, monospace;
  font-size: 0.72rem;
}

.memo-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.empty-state {
  padding: 32px 18px;
  color: var(--text-muted);
  text-align: center;
  background: #0a141c;
  border: 1px dashed var(--line-strong);
  border-radius: 7px;
}

.empty-state strong,
.empty-state span {
  display: block;
}

.empty-state strong {
  margin-bottom: 5px;
  color: #c7d5dc;
  font-size: 0.86rem;
}

.empty-state span {
  font-size: 0.72rem;
  line-height: 1.6;
}

.memo-card {
  padding: 14px;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-left: 3px solid #315064;
  border-radius: 7px;
  transition:
    border-color 150ms ease,
    background-color 150ms ease;
}

.memo-card:hover {
  background: #142531;
  border-color: var(--line-strong);
  border-left-color: var(--cyan);
}

.memo-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.time-jump-button {
  padding: 3px 7px;
  color: var(--cyan);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 0.85rem;
  font-weight: 800;
  background: rgb(66 211 197 / 7%);
  border: 1px solid rgb(66 211 197 / 24%);
  border-radius: 4px;
}

.time-jump-button:hover {
  color: #8df0e7;
  background: rgb(66 211 197 / 13%);
}

.saved-date {
  color: var(--text-subtle);
  font-size: 0.65rem;
  white-space: nowrap;
}

.memo-content-button {
  display: block;
  width: 100%;
  margin: 0;
  padding: 2px 0 9px;
  color: var(--text);
  line-height: 1.65;
  text-align: left;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: transparent;
  border: 0;
}

.memo-content-button:hover {
  color: #fff;
  text-decoration: underline;
  text-decoration-color: rgb(66 211 197 / 40%);
  text-underline-offset: 3px;
}

.memo-actions {
  display: flex;
  gap: 7px;
  justify-content: flex-end;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.memo-action-button {
  min-height: 30px;
  padding: 0 9px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 750;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
}

.memo-action-button:hover {
  color: var(--text);
  background: #1b303e;
  border-color: var(--line-strong);
}

.memo-action-button.delete:hover {
  color: #ffc2c5;
  background: rgb(255 107 113 / 10%);
  border-color: rgb(255 107 113 / 25%);
}

.memo-edit-textarea {
  min-height: 125px;
  margin: 2px 0 10px;
}

.memo-action-button.commit {
  color: #9cebd1;
  border-color: rgb(77 214 168 / 22%);
}

.toast-region {
  position: fixed;
  top: 14px;
  right: 20px;
  z-index: 80;
  display: flex;
  width: min(390px, calc(100vw - 40px));
  flex-direction: column;
  gap: 9px;
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: start;
  padding: 13px 14px;
  color: var(--text);
  background: #14232e;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  box-shadow: 0 15px 40px rgb(0 0 0 / 38%);
  animation: toast-in 180ms ease-out;
  pointer-events: auto;
}

.toast::before {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  content: "";
  background: var(--cyan);
  border-radius: 50%;
}

.toast.success::before {
  background: var(--success);
}

.toast.error::before {
  background: var(--danger);
}

.toast.warning::before {
  background: var(--warning);
}

.toast-message {
  font-size: 0.78rem;
  line-height: 1.55;
}

.toast-close {
  padding: 0 3px;
  color: var(--text-muted);
  background: transparent;
  border: 0;
}

.toast.is-leaving {
  animation: toast-out 180ms ease-in forwards;
}

.noscript-message {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  padding: 14px;
  color: #fff;
  background: #7a2026;
  border-radius: 6px;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateX(12px);
  }
}

@media (min-width: 1121px) {
  body {
    overflow: hidden;
  }

  .workspace {
    height: 100vh;
    min-height: 0;
    overflow: hidden;
  }

  .player-column,
  .control-column {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    scrollbar-color: var(--line-strong) transparent;
    scrollbar-width: thin;
  }

  .player-column {
    padding-right: 5px;
  }

  .control-column {
    padding-right: 7px;
  }
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: 1fr;
    width: min(920px, 100%);
  }

  .player-column {
    position: static;
  }

  .shortcut-guide {
    display: none;
  }
}

@media (max-width: 640px) {
  .app-header {
    min-height: 68px;
    padding: 12px 16px;
  }

  .brand-mark {
    width: 35px;
    height: 35px;
  }

  .brand h1 {
    font-size: 1.02rem;
  }

  .eyebrow {
    display: none;
  }

  .header-status {
    max-width: 120px;
    font-size: 0.66rem;
    text-align: right;
  }

  .workspace {
    gap: 20px;
    padding: 19px 14px 30px;
  }

  .playback-controls {
    grid-template-columns: 1fr 1fr;
  }

  .live-button {
    grid-column: 1 / -1;
  }

  .control-button kbd {
    display: none;
  }

  .player-status div span {
    white-space: normal;
  }

  .control-block {
    padding: 16px;
  }

  .input-action-row,
  .notes-toolbar {
    grid-template-columns: 1fr;
  }

  .save-settings {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  textarea {
    min-height: 185px;
  }

  .toast-region {
    top: 12px;
    right: 12px;
    width: calc(100vw - 24px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
