:root {
  --bg: #f4f8ff;
  --bg-2: #edf4ff;
  --surface: rgba(255, 255, 255, 0.96);
  --surface-2: #ffffff;
  --line: rgba(17, 48, 108, 0.1);
  --line-strong: rgba(17, 48, 108, 0.18);
  --text: #10284f;
  --muted: #5f7190;
  --primary: #0b5bff;
  --primary-strong: #0a47c9;
  --primary-soft: rgba(11, 91, 255, 0.08);
  --danger: #d94b66;
  --success: #0b8b67;
  --warn: #c47a12;
  --shadow-lg: 0 28px 80px rgba(31, 72, 148, 0.11);
  --shadow-md: 0 16px 42px rgba(31, 72, 148, 0.08);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --progress: 0%;
  color-scheme: light;
  font-family: Inter, "Noto Sans JP", "Hiragino Sans", "Yu Gothic UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(11, 91, 255, 0.1), transparent 28%),
    radial-gradient(circle at 100% 0%, rgba(11, 91, 255, 0.06), transparent 24%),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 54%, #eef4ff 100%);
  color: var(--text);
}

body {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button {
  cursor: pointer;
}

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

img,
svg,
canvas {
  display: block;
  max-width: 100%;
}

.page-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(16, 40, 79, 0.03) 0.7px, transparent 0.7px);
  background-size: 16px 16px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.75), transparent 85%);
}

.shell {
  width: min(1600px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 22px;
}

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

.brand-mark {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background:
    linear-gradient(160deg, #ffffff 8%, #dce9ff 100%);
  border: 1px solid rgba(11, 91, 255, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 18px 36px rgba(11, 91, 255, 0.14);
  position: relative;
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(11, 91, 255, 0.2), rgba(11, 91, 255, 0.85));
}

.brand-mark::before {
  top: 14px;
  bottom: 26px;
}

.brand-mark::after {
  left: 20px;
  right: 20px;
  top: 22px;
  bottom: 12px;
}

.brand-name {
  font-size: clamp(1.52rem, 2vw, 2.15rem);
  font-weight: 760;
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.brand-copy p {
  margin: 6px 0 0;
  max-width: 34rem;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.5;
  letter-spacing: 0.01em;
}

.topbar-note {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(17, 48, 108, 0.08);
  background: rgba(255, 255, 255, 0.8);
  color: var(--muted);
  box-shadow: var(--shadow-md);
  white-space: nowrap;
}

.topbar-note::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 0 6px rgba(11, 91, 255, 0.1);
}

.layout {
  display: grid;
  grid-template-columns: 392px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.sidebar {
  display: grid;
  gap: 20px;
  position: sticky;
  top: 18px;
}

.workspace {
  min-width: 0;
}

.panel,
.empty-state,
.summary-card,
.topbar-note {
  backdrop-filter: blur(20px);
}

.panel,
.empty-state {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

.panel {
  padding: 24px;
}

.empty-state {
  padding: 42px;
}

.panel-head,
.roll-head,
.score-topbar,
.control-strip,
.transport-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--primary-strong);
}

.section-kicker::before {
  content: "";
  width: 18px;
  height: 1px;
  background: currentColor;
}

.panel h2,
.roll-head h3,
.empty-state h1,
.record-head h3,
.score-title h2 {
  margin: 8px 0 0;
  letter-spacing: -0.03em;
}

.panel h2,
.empty-state h1,
.score-title h2 {
  line-height: 1.22;
}

.panel h2 {
  font-size: clamp(1.12rem, 1vw + 0.92rem, 1.72rem);
}

.empty-state h1 {
  font-size: clamp(1.45rem, 1.35vw + 1rem, 2.2rem);
  max-width: 22ch;
}

.empty-state p,
.source-meta,
.record-status,
.roll-note,
.progress-text,
.field span,
.job-meta,
.source-title,
.topbar-note,
.brand-copy p,
.record-head,
.score-title p,
.page-jump span,
.job-empty,
.note-copy {
  color: var(--muted);
}

.pill,
.empty-badge,
.page-indicator,
.job-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 0.82rem;
  font-weight: 700;
}

.dropzone {
  margin-top: 18px;
  padding: 28px;
  border-radius: 24px;
  border: 1px dashed rgba(11, 91, 255, 0.28);
  background: linear-gradient(180deg, rgba(11, 91, 255, 0.06), rgba(255, 255, 255, 0.78));
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.dropzone:hover,
.dropzone.is-over {
  transform: translateY(-1px);
  border-color: rgba(11, 91, 255, 0.5);
  background: linear-gradient(180deg, rgba(11, 91, 255, 0.1), rgba(255, 255, 255, 0.9));
}

.drop-title {
  font-size: 1.08rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.inline-actions,
.record-actions,
.page-controls,
.zoom-controls,
.transport-controls,
.score-exports {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 14px;
  min-height: 44px;
  padding: 0 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button.primary {
  background: linear-gradient(180deg, #1b74ff, #0b5bff 64%, #0a4fdf);
  color: #fff;
  box-shadow: 0 16px 34px rgba(11, 91, 255, 0.22);
}

.button.secondary {
  background: rgba(11, 91, 255, 0.09);
  color: var(--primary-strong);
  border-color: rgba(11, 91, 255, 0.1);
}

.button.ghost {
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  border-color: rgba(17, 48, 108, 0.1);
}

.button.danger {
  background: rgba(217, 75, 102, 0.1);
  color: var(--danger);
  border-color: rgba(217, 75, 102, 0.12);
}

.button.wide {
  width: 100%;
}

.button.small {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 12px;
}

.source-card,
.record-block,
.status-card,
.progress-card,
.summary-card,
.job-card,
.job-empty {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  border-radius: 20px;
}

.source-card,
.record-block,
.status-card,
.progress-card,
.job-card,
.job-empty {
  margin-top: 16px;
  padding: 18px;
}

.source-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.source-meta {
  margin-top: 6px;
  font-size: 0.94rem;
}

.audio-player {
  width: 100%;
  margin-top: 14px;
}

.record-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}

.record-head h3 {
  font-size: 1rem;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.field {
  display: grid;
  gap: 10px;
}

.field span {
  padding-left: 2px;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.field select,
.field input,
.page-jump input {
  width: 100%;
  min-height: 52px;
  padding: 11px 14px;
  border-radius: 16px;
  border: 1px solid rgba(17, 48, 108, 0.11);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 255, 0.98));
  color: var(--text);
  outline: none;
  font-size: 0.97rem;
  line-height: 1.45;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.field select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 48px;
  background-color: rgba(255, 255, 255, 0.98);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.2 5.8 8 10.6l4.8-4.8' fill='none' stroke='%23687da8' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: right 16px center;
  background-size: 14px 14px;
  background-repeat: no-repeat;
}

.field select::-ms-expand {
  display: none;
}

.field select:focus,
.field input:focus,
.page-jump input:focus {
  border-color: rgba(11, 91, 255, 0.34);
  box-shadow: 0 0 0 4px rgba(11, 91, 255, 0.08);
}

.field-inline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  gap: 12px;
}

.field-inline > * {
  min-width: 0;
}

.field-inline-tight {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
}

.field-wide {
  grid-column: 1 / -1;
}

.toggle-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  min-height: 58px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(17, 48, 108, 0.11);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.settings-panel .field,
.settings-panel .toggle-card {
  position: relative;
}

.settings-panel .field select,
.settings-panel .field input {
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.settings-panel .field select:hover,
.settings-panel .field input:hover,
.toggle-card:hover {
  border-color: rgba(11, 91, 255, 0.18);
  background-color: rgba(248, 251, 255, 0.99);
}

.toggle-card input {
  width: 18px;
  height: 18px;
  margin: 4px 0 0;
  accent-color: var(--primary);
}

.toggle-copy {
  display: grid;
  gap: 4px;
}

.toggle-copy strong {
  font-size: 0.95rem;
  line-height: 1.25;
}

.toggle-copy small {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.slash {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}

.status-card {
  margin-top: 18px;
  line-height: 1.65;
}

.status-card[data-tone="good"] {
  color: var(--success);
  background: rgba(11, 139, 103, 0.08);
  border-color: rgba(11, 139, 103, 0.14);
}

.status-card[data-tone="warn"] {
  color: var(--warn);
  background: rgba(196, 122, 18, 0.08);
  border-color: rgba(196, 122, 18, 0.14);
}

.status-card[data-tone="info"] {
  color: var(--primary-strong);
  background: rgba(11, 91, 255, 0.08);
  border-color: rgba(11, 91, 255, 0.14);
}

.progress-card {
  margin-top: 14px;
}

.progress-bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(17, 48, 108, 0.08);
  overflow: hidden;
}

.progress-bar span {
  display: block;
  height: 100%;
  width: var(--progress);
  border-radius: inherit;
  background: linear-gradient(90deg, #8cb6ff 0%, #0b5bff 70%, #0a4ad0 100%);
  transition: width 0.16s ease;
}

.progress-text {
  margin-top: 10px;
  font-size: 0.94rem;
}

.jobs-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.job-empty {
  padding: 18px;
  text-align: center;
}

.job-card {
  padding: 16px;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.job-card.is-active {
  border-color: rgba(11, 91, 255, 0.28);
  box-shadow: 0 12px 32px rgba(11, 91, 255, 0.12);
}

.job-card:hover {
  transform: translateY(-1px);
}

.job-top,
.job-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.job-top h4 {
  margin: 0;
  font-size: 0.98rem;
}

.job-top p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.job-meta {
  margin-top: 10px;
  font-size: 0.88rem;
}

.job-bar {
  margin-top: 12px;
  height: 8px;
  border-radius: 999px;
  background: rgba(17, 48, 108, 0.08);
  overflow: hidden;
}

.job-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #9dc0ff, #0b5bff);
}

.job-actions {
  flex-wrap: wrap;
  margin-top: 12px;
}

.job-actions button {
  appearance: none;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(17, 48, 108, 0.1);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
}

.empty-state {
  display: grid;
  gap: 14px;
}

.empty-badge {
  justify-self: start;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.summary-card {
  padding: 18px 18px 20px;
  box-shadow: var(--shadow-md);
}

.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
}

.summary-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.28rem;
  letter-spacing: -0.03em;
}

.score-panel {
  padding: 22px;
}

.score-title h2 {
  font-size: clamp(1.2rem, 0.9vw + 1rem, 1.6rem);
}

.control-strip,
.transport-bar {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(17, 48, 108, 0.08);
  align-items: center;
}

.page-controls,
.transport-bar {
  flex-wrap: wrap;
}

.page-jump {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.page-jump input {
  width: 88px;
}

.follow-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.94rem;
}

.transport-time {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.sheet-frame {
  margin-top: 18px;
  border-radius: 24px;
  border: 1px solid rgba(17, 48, 108, 0.08);
  background: linear-gradient(180deg, #f6faff 0%, #eef4ff 100%);
  overflow: hidden;
}

.sheet-host-wrap {
  padding: 24px;
  min-height: 720px;
  overflow: auto;
}

.sheet-host {
  width: fit-content;
  min-width: 100%;
  margin: 0 auto;
}

.sheet-host svg {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 24px 56px rgba(17, 48, 108, 0.16);
  margin: 0 auto;
}

.roll-panel {
  margin-top: 18px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(17, 48, 108, 0.08);
  background: rgba(255, 255, 255, 0.86);
}

.roll-note {
  line-height: 1.6;
}

.roll-canvas {
  width: 100%;
  height: 220px;
  margin-top: 14px;
  border-radius: 18px;
  border: 1px solid rgba(17, 48, 108, 0.08);
  background: #fff;
}

.hidden-sheet-host {
  position: fixed;
  left: -99999px;
  top: 0;
  width: 794px;
  opacity: 0;
  pointer-events: none;
}

.is-hidden {
  display: none !important;
}

@media (max-width: 1280px) {
  .layout {
    grid-template-columns: 360px minmax(0, 1fr);
  }

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

@media (max-width: 980px) {
  .shell {
    width: min(100vw - 24px, 100%);
    padding-top: 16px;
  }

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

  .sidebar {
    position: static;
  }

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

  .field-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100vw - 16px, 100%);
  }

  .panel,
  .empty-state {
    padding: 18px;
    border-radius: 22px;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .button,
  .field select,
  .field input,
  .page-jump input {
    min-height: 46px;
  }

  .sheet-host-wrap {
    padding: 14px;
    min-height: 540px;
  }

  .roll-canvas {
    height: 184px;
  }
}


/* v11 readability updates */
.settings-panel .field-grid {
  grid-template-columns: 1fr;
  gap: 14px;
}

.settings-panel .field {
  gap: 8px;
}

.settings-panel .field span {
  font-size: 0.94rem;
}

.settings-panel .field select,
.settings-panel .field input,
.settings-panel .toggle-card {
  min-height: 56px;
}

.settings-panel .field select,
.settings-panel .field input {
  padding: 14px 16px;
  font-size: 1.02rem;
}

.settings-panel .field-inline {
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}

.settings-panel .field-inline > select:first-child {
  min-width: 132px;
}

.settings-panel .field-inline.field-inline-tight {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
}

.settings-panel .slash {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--muted);
}

.status-card {
  min-height: 68px;
  display: flex;
  align-items: center;
  font-size: 1rem;
}

.progress-card {
  display: grid;
  gap: 12px;
}

.settings-panel .button.wide {
  min-height: 54px;
  font-size: 1.06rem;
}

@media (max-width: 1280px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100vw - 24px, 1600px);
    padding-top: 18px;
  }

  .panel {
    padding: 20px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .settings-panel .field-inline {
    grid-template-columns: 1fr;
  }

  .settings-panel .field-inline.field-inline-tight {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }
}


/* v12 score cursor and readability */
.settings-panel .field-grid {
  grid-template-columns: 1fr;
}

.settings-panel .field-inline {
  grid-template-columns: 140px minmax(0, 1fr);
}

.settings-panel .field-inline.field-inline-tight {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
}

.settings-panel .field select,
.settings-panel .field input,
.settings-panel .toggle-card {
  border-color: rgba(17, 48, 108, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74), 0 4px 14px rgba(18, 40, 90, 0.04);
}

.sheet-host-wrap {
  position: relative;
  overflow: auto;
}

.score-playhead {
  position: absolute;
  transition: transform 70ms linear, width 70ms linear, height 70ms linear;
  top: 0;
  left: 0;
  z-index: 4;
  pointer-events: none;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(11, 91, 255, 0.06), rgba(11, 91, 255, 0.16));
  border: 2px solid rgba(11, 91, 255, 0.92);
  box-shadow: 0 10px 24px rgba(11, 91, 255, 0.14), 0 0 0 6px rgba(11, 91, 255, 0.08);
}

.score-playhead span {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0));
}

.score-playhead.is-hidden {
  display: none;
}

.transport-time {
  font-variant-numeric: tabular-nums;
}

.button.primary.wide {
  position: relative;
  overflow: hidden;
}

.button.primary.wide::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.14), transparent);
  transform: translateX(-110%);
}

.button.primary.wide:hover::after {
  transform: translateX(110%);
  transition: transform 0.7s ease;
}
