:root {
  color-scheme: dark;
  --page: #080806;
  --case: #11120f;
  --case-2: #171811;
  --screen: #030403;
  --line: rgba(242, 189, 90, 0.25);
  --line-strong: rgba(242, 189, 90, 0.64);
  --amber: #f2bd5a;
  --amber-soft: #ffe1a4;
  --green: #77e6a0;
  --green-soft: #d5ffe2;
  --cyan: #68d9e4;
  --cyan-soft: #c3fbff;
  --danger: #ff7075;
  --text: #f7f5e9;
  --muted: #a9a78e;
  --shadow: rgba(0, 0, 0, 0.44);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background-color: var(--page);
  background-image:
    linear-gradient(rgba(242, 189, 90, 0.024) 1px, transparent 1px),
    linear-gradient(90deg, rgba(242, 189, 90, 0.024) 1px, transparent 1px);
  background-size: 34px 34px;
  color: var(--text);
  font-family: "Noto Sans JP", "Yu Gothic", "Hiragino Kaku Gothic ProN", system-ui, sans-serif;
  line-height: 1.65;
}

button,
select,
input {
  min-width: 0;
  font: inherit;
}

button {
  border: 0;
  letter-spacing: 0;
  cursor: pointer;
}

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

button:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 3px;
}

a {
  color: var(--green-soft);
  text-underline-offset: 3px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

[hidden] {
  display: none !important;
}

.noscript {
  margin: 0;
  padding: 14px;
  background: #54191d;
  color: #fff;
  text-align: center;
}

.page-shell {
  width: min(calc(100% - 36px), 1220px);
  margin: 0 auto;
  padding: 18px 0 32px;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-height: 28px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}

.device-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 24px;
  align-items: end;
  padding: 12px 0 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.series-label,
.section-kicker,
.stage-kicker {
  margin-bottom: 5px;
  color: var(--green);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

h1 {
  margin-bottom: 2px;
  font-size: 40px;
  line-height: 1.25;
  letter-spacing: 0;
}

.device-name {
  margin-bottom: 7px;
  color: var(--amber);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 20px;
  font-weight: 800;
}

.lead {
  margin-bottom: 4px;
  color: #f0e8ca;
  font-size: 17px;
  font-weight: 700;
}

.sub-lead {
  max-width: 760px;
  margin-bottom: 0;
  color: #cbc7ad;
  font-size: 14px;
}

.header-readout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.header-readout span {
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 4px 6px;
  border: 1px solid var(--line);
  background: rgba(242, 189, 90, 0.035);
  color: var(--muted);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}

.header-readout span.active {
  border-color: var(--line-strong);
  color: var(--amber-soft);
}

.device-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 318px;
  gap: 16px;
  margin-top: 16px;
}

.monitor-column,
.side-column {
  min-width: 0;
}

.monitor-panel,
.phase-panel,
.settings-panel,
.log-panel,
.review-section,
.device-notes,
.sibling-panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--case);
  box-shadow: 0 18px 44px var(--shadow);
}

.monitor-panel::before,
.phase-panel::before,
.settings-panel::before,
.log-panel::before,
.review-section::before,
.device-notes::before,
.sibling-panel::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--amber);
  content: "";
  pointer-events: none;
}

.monitor-panel.active::before {
  background: var(--cyan);
}

.monitor-panel.interrupted::before,
.review-section.interrupted::before {
  background: var(--danger);
}

.monitor-head,
.panel-heading,
.timeline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 11px;
  font-weight: 800;
}

.monitor-head span:last-child,
.panel-heading > span,
.timeline-head span:last-child {
  color: var(--amber-soft);
}

.stage-copy {
  min-height: 156px;
  padding: 22px 22px 14px;
  text-align: center;
}

.stage-kicker {
  margin-bottom: 2px;
  color: var(--amber);
}

.stage-copy h2 {
  margin-bottom: 5px;
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.3;
}

.countdown {
  min-height: 44px;
  margin-bottom: 4px;
  color: var(--amber-soft);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.25;
}

.stage-description {
  min-height: 27px;
  margin-bottom: 0;
  color: #cbc7ad;
  font-size: 14px;
}

.meter-screen {
  position: relative;
  min-height: 286px;
  margin: 0 14px 14px;
  overflow: hidden;
  border: 1px solid rgba(104, 217, 228, 0.32);
  background: var(--screen);
}

.screen-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(104, 217, 228, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(104, 217, 228, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
}

.meter-label {
  position: absolute;
  z-index: 1;
  top: 12px;
  right: 14px;
  left: 14px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 11px;
  font-weight: 800;
}

.meter-label strong {
  color: var(--amber);
}

.meter-track {
  position: absolute;
  z-index: 1;
  top: 45px;
  right: 14px;
  left: 14px;
  height: 16px;
  overflow: hidden;
  border: 1px solid rgba(242, 189, 90, 0.34);
  background: #17180f;
}

.meter-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--amber);
  transition: width 120ms linear, background-color 120ms linear;
}

.meter-track i {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.28);
}

.meter-track i:nth-of-type(1) {
  left: 33%;
}

.meter-track i:nth-of-type(2) {
  left: 66%;
}

.meter-track i:nth-of-type(3) {
  right: 0;
}

#waveCanvas,
#timelineCanvas {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: auto;
}

#waveCanvas {
  margin-top: 78px;
}

.meter-value {
  position: absolute;
  z-index: 2;
  right: 14px;
  bottom: 10px;
  color: var(--amber-soft);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 18px;
  font-weight: 800;
}

.meter-value small {
  color: var(--muted);
  font-size: 11px;
}

.session-progress {
  height: 8px;
  margin: 0 14px 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #191a13;
}

.session-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--green);
  transition: width 160ms linear;
}

.monitor-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 0 14px 15px;
}

.monitor-metrics span {
  display: flex;
  min-height: 46px;
  flex-direction: column;
  justify-content: center;
  padding: 5px 8px;
  border: 1px solid rgba(119, 230, 160, 0.2);
  color: var(--muted);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 10px;
  text-align: center;
}

.monitor-metrics strong {
  display: block;
  min-height: 19px;
  color: var(--green-soft);
  font-size: 14px;
  line-height: 1.35;
}

.primary-actions,
.review-actions {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.9fr) minmax(0, 0.8fr);
  gap: 8px;
  margin-top: 12px;
}

.primary-button,
.secondary-button {
  min-height: 48px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
}

.primary-button {
  background: var(--amber);
  color: #17130a;
}

.primary-button:hover:not(:disabled) {
  background: var(--amber-soft);
}

.secondary-button {
  background: #17180f;
  color: var(--amber-soft);
}

.secondary-button:hover:not(:disabled) {
  background: #252516;
}

.privacy-note,
.status-message,
.settings-note {
  font-size: 13px;
}

.privacy-note {
  min-height: 26px;
  margin: 10px 0 7px;
  color: #c4c2aa;
}

.status-message {
  display: flex;
  min-height: 49px;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border: 1px solid rgba(104, 217, 228, 0.26);
  background: rgba(104, 217, 228, 0.04);
  color: var(--cyan-soft);
  text-align: center;
}

.status-message.error {
  border-color: rgba(255, 112, 117, 0.55);
  color: #ffb5b8;
}

.status-message.success {
  border-color: rgba(119, 230, 160, 0.45);
  color: var(--green-soft);
}

.side-column {
  display: grid;
  align-content: start;
  gap: 12px;
}

.phase-panel,
.settings-panel,
.log-panel {
  overflow: hidden;
}

.panel-heading h2 {
  margin: 0;
  color: var(--text);
  font-family: inherit;
  font-size: 17px;
  line-height: 1.3;
}

.phase-list,
.device-log,
.event-list {
  margin: 0;
  padding: 10px 14px 12px 38px;
}

.phase-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1px;
  min-height: 52px;
  padding: 7px 8px;
  border-bottom: 1px solid rgba(242, 189, 90, 0.12);
  color: var(--muted);
}

.phase-list li:last-child {
  border-bottom: 0;
}

.phase-list li strong {
  color: #c2c1a8;
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 11px;
}

.phase-list li small {
  font-size: 12px;
}

.phase-list li.is-current {
  background: rgba(242, 189, 90, 0.1);
  color: var(--amber-soft);
}

.phase-list li.is-current strong {
  color: var(--amber);
}

.phase-list li.is-complete strong {
  color: var(--green);
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 14px 14px 4px;
}

.settings-grid label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.settings-grid select {
  width: 100%;
  min-height: 42px;
  padding: 5px 8px;
  border: 1px solid rgba(242, 189, 90, 0.35);
  border-radius: 3px;
  background: #181910;
  color: var(--text);
}

.settings-note {
  min-height: 46px;
  margin: 8px 14px 14px;
  color: #c4c2aa;
}

.device-log {
  max-height: 180px;
  overflow: auto;
  padding-top: 7px;
  padding-bottom: 10px;
}

.device-log li {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 8px;
  min-height: 33px;
  align-items: start;
  padding: 5px 0;
  border-bottom: 1px solid rgba(242, 189, 90, 0.12);
  color: #c9c7af;
  font-size: 12px;
}

.device-log time {
  color: var(--amber);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 10px;
}

.review-section {
  margin-top: 16px;
  padding: 16px;
}

.review-heading-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  min-height: 48px;
}

.review-heading-row h2,
.device-notes h2,
.sibling-panel h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.3;
}

.review-status {
  min-width: 126px;
  padding: 6px 10px;
  border: 1px solid rgba(119, 230, 160, 0.4);
  color: var(--green-soft);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.review-status.interrupted {
  border-color: rgba(255, 112, 117, 0.55);
  color: #ffb5b8;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.result-readout {
  display: grid;
  gap: 3px;
  min-height: 72px;
  align-content: center;
  padding: 8px 12px;
  border: 1px solid rgba(104, 217, 228, 0.26);
  background: rgba(104, 217, 228, 0.04);
}

.result-readout span {
  color: var(--muted);
  font-size: 12px;
}

.result-readout strong {
  color: var(--cyan-soft);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 21px;
}

.timeline-box {
  margin-top: 14px;
  border: 1px solid rgba(104, 217, 228, 0.28);
  background: var(--screen);
}

#timelineCanvas {
  width: 100%;
}

.review-empty {
  display: grid;
  min-height: 88px;
  align-content: center;
  gap: 3px;
  margin-top: 12px;
  padding: 14px;
  border: 1px dashed rgba(242, 189, 90, 0.35);
  color: var(--muted);
  text-align: center;
}

.review-empty strong {
  color: var(--amber-soft);
  font-family: Consolas, "SFMono-Regular", monospace;
}

.event-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 0;
  list-style: none;
}

.event-item {
  display: grid;
  grid-template-columns: 106px minmax(0, 1fr) 88px;
  gap: 12px;
  align-items: center;
  min-height: 62px;
  padding: 9px 12px;
  border: 1px solid rgba(242, 189, 90, 0.25);
  background: var(--case-2);
}

.event-item.trace {
  border-color: rgba(104, 217, 228, 0.35);
}

.event-item.knock {
  border-color: rgba(242, 189, 90, 0.48);
}

.event-item.impact {
  border-color: rgba(255, 112, 117, 0.52);
}

.event-index {
  color: var(--amber);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 11px;
  font-weight: 800;
}

.event-copy strong,
.event-copy span {
  display: block;
}

.event-copy strong {
  color: var(--text);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 13px;
}

.event-copy span {
  color: var(--muted);
  font-size: 12px;
}

.event-strength {
  color: var(--amber-soft);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 18px;
  font-weight: 800;
  text-align: right;
}

.device-notes,
.sibling-panel {
  margin-top: 16px;
  padding: 16px;
}

.device-notes > div:first-child,
.sibling-panel > h2 {
  margin-bottom: 12px;
}

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

.notes-grid article {
  min-width: 0;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: rgba(242, 189, 90, 0.025);
}

.notes-grid h3 {
  margin-bottom: 5px;
  color: var(--amber-soft);
  font-size: 15px;
}

.notes-grid p {
  margin-bottom: 0;
  color: #c7c5ae;
  font-size: 13px;
}

.sibling-panel h2 {
  margin-bottom: 12px;
}

.sibling-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.sibling-links a {
  display: grid;
  min-height: 66px;
  align-content: center;
  gap: 2px;
  padding: 9px 11px;
  border: 1px solid rgba(119, 230, 160, 0.23);
  background: rgba(119, 230, 160, 0.035);
  text-decoration: none;
}

.sibling-links a:hover {
  border-color: var(--green);
}

.sibling-links strong {
  color: var(--green-soft);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 12px;
}

.sibling-links span {
  color: var(--muted);
  font-size: 12px;
}

.ad-reservation {
  display: grid;
  min-height: 92px;
  margin-top: 16px;
  place-items: center;
  border: 1px dashed rgba(242, 189, 90, 0.2);
  color: rgba(242, 189, 90, 0.5);
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 11px;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px 20px;
  padding-top: 18px;
  color: var(--muted);
  font-size: 12px;
}

.site-footer span {
  font-family: Consolas, "SFMono-Regular", monospace;
}

@media (max-width: 900px) {
  .device-header,
  .device-shell {
    grid-template-columns: 1fr;
  }

  .header-readout {
    max-width: 520px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .side-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .settings-panel {
    grid-column: 1 / -1;
  }

  .log-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .page-shell {
    width: min(calc(100% - 24px), 560px);
    padding-top: 12px;
  }

  .device-header {
    gap: 12px;
    padding-bottom: 13px;
  }

  h1 {
    font-size: 28px;
  }

  .device-name {
    font-size: 17px;
  }

  .lead {
    font-size: 15px;
  }

  .sub-lead {
    font-size: 13px;
  }

  .header-readout {
    max-width: none;
    gap: 5px;
  }

  .header-readout span {
    min-height: 31px;
    padding: 3px 4px;
    font-size: 9px;
  }

  .device-shell {
    gap: 12px;
    margin-top: 12px;
  }

  .stage-copy {
    min-height: 160px;
    padding: 18px 12px 12px;
  }

  .stage-copy h2 {
    font-size: 24px;
  }

  .stage-description {
    min-height: 45px;
    font-size: 13px;
  }

  .meter-screen {
    min-height: 238px;
    margin-right: 9px;
    margin-left: 9px;
  }

  .meter-track {
    right: 9px;
    left: 9px;
  }

  #waveCanvas {
    margin-top: 75px;
  }

  .monitor-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-right: 9px;
    padding-left: 9px;
  }

  .primary-actions,
  .review-actions {
    grid-template-columns: 1fr;
  }

  .primary-button,
  .secondary-button {
    min-height: 50px;
  }

  .side-column {
    display: grid;
    grid-template-columns: 1fr;
  }

  .settings-panel,
  .log-panel {
    grid-column: auto;
  }

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

  .review-section,
  .device-notes,
  .sibling-panel {
    padding: 12px;
  }

  .review-heading-row {
    align-items: start;
    flex-direction: column;
    gap: 8px;
  }

  .review-heading-row h2,
  .device-notes h2,
  .sibling-panel h2 {
    font-size: 24px;
  }

  .review-status {
    width: 100%;
  }

  .result-grid,
  .notes-grid,
  .sibling-links {
    grid-template-columns: 1fr;
  }

  .event-item {
    grid-template-columns: 86px minmax(0, 1fr);
  }

  .event-strength {
    grid-column: 2;
    text-align: left;
  }

  .site-footer {
    display: grid;
  }
}

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