:root {
  --paper: #eeeae1;
  --ink: #202c2d;
  --muted: #75807d;
  --rule: #c8cbc4;
  --coral: #e77053;
  --stage: #1b292c;
}

* { box-sizing: border-box; }

html { min-width: 320px; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; }

.page-frame {
  width: min(1600px, 100%);
  min-height: 100vh;
  padding: 0 clamp(22px, 3vw, 52px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.site-header {
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--rule);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
}

.wordmark { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.mark { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border: 1.7px solid var(--ink); border-radius: 50%; transform: rotate(-27deg); }
.mark::before { content: ""; width: 14px; height: 1.7px; background: var(--ink); position: absolute; }
.mark span { width: 4px; height: 4px; background: var(--coral); border-radius: 50%; transform: translate(8px, -5px); }
.header-right { color: #555f5c; display: flex; align-items: center; gap: 9px; }
.header-dot { width: 6px; height: 6px; background: var(--coral); border-radius: 50%; }
.header-divider { margin: 0 4px; color: #a4aaa2; }

.main-grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(300px, .35fr) minmax(0, .65fr);
  gap: clamp(30px, 4vw, 68px);
  padding: clamp(32px, 4.2vw, 64px) 0 36px;
}

.introduction { display: flex; flex-direction: column; justify-content: space-between; min-width: 0; }
.eyebrow { margin: 5px 0 32px; display: flex; align-items: center; gap: 11px; color: #5e6863; font-size: 10px; font-weight: 700; letter-spacing: .19em; }
.eyebrow-line { width: 24px; height: 1px; background: var(--coral); }
h1 { margin: 0; font-family: Georgia, 'Times New Roman', serif; font-size: clamp(58px, 5.55vw, 94px); font-weight: 400; letter-spacing: -.075em; line-height: .97; }
h1 em { color: var(--coral); font-weight: 400; }
.intro-copy { max-width: 342px; margin: 36px 0 40px; color: #56625f; font-size: clamp(15px, 1.12vw, 18px); line-height: 1.65; }
.control-area { width: min(100%, 380px); }
.duration-lockup { display: flex; align-items: center; gap: 14px; padding-bottom: 20px; border-bottom: 1px solid var(--rule); }
.duration-number { font-family: Georgia, 'Times New Roman', serif; font-size: 65px; line-height: .85; letter-spacing: -.08em; }
.duration-unit { color: #66716d; font-size: 10px; font-weight: 700; letter-spacing: .16em; line-height: 1.65; }
.primary-button {
  width: 100%; min-height: 66px; margin-top: 20px; padding: 0 22px;
  display: flex; align-items: center; gap: 16px;
  background: var(--coral); color: #fffaf4; border: 1px solid var(--coral); border-radius: 2px;
  text-align: left; font-size: 14px; font-weight: 700; letter-spacing: .02em; cursor: pointer;
  transition: background .2s, transform .2s, box-shadow .2s;
}
.primary-button:hover { background: #d75d42; transform: translateY(-2px); box-shadow: 0 8px 18px #bd6a5230; }
.primary-button:focus-visible, .text-button:focus-visible, .end-card button:focus-visible { outline: 3px solid #8eb2b0; outline-offset: 3px; }
.play-glyph { width: 24px; height: 24px; border: 1px solid #ffffffa8; border-radius: 50%; display: inline-grid; place-items: center; flex: none; }
.play-glyph::after { content: ""; width: 0; height: 0; margin-left: 2px; border-top: 4px solid transparent; border-bottom: 4px solid transparent; border-left: 6px solid white; }
.primary-button.is-playing .play-glyph::after { width: 6px; height: 8px; margin: 0; border: 0; border-left: 2px solid white; border-right: 2px solid white; }
.button-arrow { margin-left: auto; font-size: 20px; font-weight: 400; }
.utility-row { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; padding-top: 22px; }
.text-button { padding: 0; border: 0; background: transparent; color: #44504d; font-size: 12px; font-weight: 700; cursor: pointer; }
.text-button:hover { color: var(--coral); }
.text-button:disabled { opacity: .35; cursor: default; }
#muteIcon { display: inline-block; min-width: 22px; font-size: 14px; }
.keyboard-hint { margin-left: auto; color: #929a92; font-size: 9px; font-weight: 700; letter-spacing: .11em; white-space: nowrap; }

.machine-section { min-width: 0; }
.machine-panel { height: clamp(470px, calc(100vh - 260px), 700px); min-height: 470px; position: relative; overflow: hidden; background: var(--stage); border-radius: 3px; box-shadow: 0 22px 38px #2733321c; }
#machineCanvas { display: block; width: 100%; height: 100%; }
.panel-top, .panel-bottom { position: absolute; left: clamp(18px, 2.2vw, 32px); right: clamp(18px, 2.2vw, 32px); display: flex; justify-content: space-between; pointer-events: none; color: #acbcb4; font-size: 10px; font-weight: 700; letter-spacing: .14em; }
.panel-top { top: 24px; align-items: center; }
.panel-bottom { bottom: 20px; color: #869994; }
.panel-kicker { display: flex; align-items: center; gap: 9px; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: #788b84; }
.live-dot.is-live { background: #e8b281; box-shadow: 0 0 11px #e8b281ad; animation: livepulse 1.5s infinite; }
@keyframes livepulse { 50% { opacity: .35; } }
.panel-time { color: #e6e8d9; font-size: 13px; font-variant-numeric: tabular-nums; letter-spacing: .07em; }
.time-slash { margin: 0 7px; color: #72847e; }
.idle-message { position: absolute; top: 44%; left: 50%; width: 100%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 14px; color: #b2c1b6; font-size: 9px; font-weight: 700; letter-spacing: .22em; text-align: center; pointer-events: none; transition: opacity .4s; }
.idle-message.is-hidden { opacity: 0; }
.idle-circle { width: 46px; height: 46px; display: grid; place-items: center; border: 1px solid #8d9e95; border-radius: 50%; color: var(--coral); font-size: 25px; font-weight: 400; }
.end-card { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; justify-content: center; align-items: center; background: #1b292ce8; color: #f4f0e7; text-align: center; }
.end-card[hidden] { display: none; }
.end-card p { color: #e3aa8e; font-size: 10px; font-weight: 700; letter-spacing: .2em; }
.end-card h2 { margin: 20px 0 28px; font: 400 clamp(34px, 3.5vw, 56px)/1.09 Georgia, 'Times New Roman', serif; letter-spacing: -.05em; }
.end-card h2 em { color: #e9a48b; font-weight: 400; }
.end-card button { padding: 13px 22px; border: 1px solid #e9a48b; background: transparent; color: #f4f0e7; font-size: 12px; font-weight: 700; cursor: pointer; }
.end-card button:hover { background: #e9a48b; color: var(--stage); }

.transport { margin-top: 28px; }
.progress-heading { display: flex; justify-content: space-between; color: #384742; font-size: 10px; font-weight: 700; letter-spacing: .15em; }
#transportStatus { color: #8a938c; }
.progress-track { height: 3px; margin-top: 16px; position: relative; background: #cbd0c8; }
#progressFill { height: 100%; width: 0; background: var(--coral); transition: width .08s linear; }
.progress-marker { position: absolute; z-index: 1; top: -3px; width: 1px; height: 9px; background: #7f8b83; }
.marker-one { left: 33.333%; }
.marker-two { left: 66.666%; }
.movements { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; padding-top: 18px; }
.movements > div { display: flex; justify-content: space-between; gap: 8px; color: #68746e; font-size: 9px; font-weight: 700; letter-spacing: .1em; }
.movements > div + div { border-left: 1px solid var(--rule); padding-left: 20px; }
.movements > div span:last-child { color: #a0a8a0; }

.site-footer { min-height: 62px; margin-top: auto; border-top: 1px solid var(--rule); display: flex; align-items: center; justify-content: space-between; gap: 20px; color: #858f86; font-size: 9px; font-weight: 700; letter-spacing: .17em; }
.footer-star { margin-left: 7px; color: var(--coral); font-size: 14px; vertical-align: -1px; }

@media (max-width: 1050px) {
  .main-grid { grid-template-columns: minmax(270px, .34fr) minmax(0, .66fr); gap: 28px; }
  h1 { font-size: clamp(53px, 5.8vw, 75px); }
  .keyboard-hint { display: none; }
  .movements > div { flex-direction: column; }
}

@media (max-width: 760px) {
  .page-frame { padding: 0 20px; }
  .site-header { height: 68px; }
  .header-right { font-size: 9px; }
  .main-grid { display: block; padding: 34px 0 32px; }
  .introduction { display: block; }
  .eyebrow { margin-bottom: 22px; }
  h1 { font-size: clamp(62px, 12vw, 90px); }
  .intro-copy { margin: 22px 0 26px; }
  .control-area { width: 100%; display: grid; grid-template-columns: 1fr 1fr; column-gap: 18px; align-items: center; }
  .duration-lockup { border-bottom: 0; padding: 0; }
  .duration-number { font-size: 53px; }
  .duration-unit { font-size: 8px; }
  .primary-button { margin: 0; min-height: 58px; padding: 0 15px; font-size: 12px; gap: 10px; }
  .utility-row { grid-column: 1 / -1; padding: 17px 0 28px; }
  .machine-panel { height: min(70vw, 530px); min-height: 385px; }
  .site-footer { min-height: 60px; }
}

@media (max-width: 520px) {
  .header-right { display: none; }
  .control-area { grid-template-columns: 1fr; }
  .duration-lockup { padding-bottom: 17px; }
  .primary-button { min-height: 60px; }
  .utility-row { padding-bottom: 24px; }
  .machine-panel { min-height: 420px; }
  .panel-top, .panel-bottom { left: 16px; right: 16px; font-size: 8px; }
  .panel-time { font-size: 11px; }
  .movements { gap: 6px; }
  .movements > div + div { padding-left: 8px; }
  .movements > div { font-size: 7px; }
  .site-footer span:last-child { display: none; }
}

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