:root {
  color-scheme: light;
  --ink: #181a17;
  --paper: #fffaf0;
  --panel: #ffffff;
  --green: #dcefe5;
  --yellow: #ffd84d;
  --red: #b42318;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

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

.page-shell {
  width: min(920px, calc(100% - 32px));
  margin: 48px auto 96px;
}

.intro { max-width: 790px; margin-bottom: 30px; }
.eyebrow { margin: 0 0 8px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(2.6rem, 7vw, 5.5rem); line-height: .94; letter-spacing: -.055em; }
.intro > p:not(.eyebrow) { font-size: 1.15rem; line-height: 1.55; }
.privacy { padding: 14px 16px; background: var(--green); border: 2px solid var(--ink); border-radius: 12px; }

.transfer-panel {
  margin-top: 22px;
  padding: 26px;
  background: var(--panel);
  border: 2px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
  border-radius: 18px;
}

.step-heading { display: flex; gap: 16px; align-items: flex-start; }
.step-heading > span {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
  font-weight: 900;
}
h2, h3, p { margin-top: 0; }
h2 { margin-bottom: 6px; font-size: 1.55rem; }
.step-heading p { margin-bottom: 20px; color: #555; line-height: 1.45; }

.connect-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.action-block { padding: 18px; border: 1px solid #b9b9b0; border-radius: 12px; background: #fcfcf8; }
.action-block h3 { margin-bottom: 14px; }
.action-help { margin: 10px 0 0; color: #666; font-size: .92rem; line-height: 1.4; }

.phone-entry {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 24px;
  align-items: center;
  margin-top: 16px;
  padding: 16px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: #fff7d6;
}
.page-qr { display: grid; width: 184px; height: 184px; place-items: center; padding: 8px; background: #fff; border: 1px solid #d4d0c6; }
.page-qr img, .page-qr canvas { display: block; width: 168px !important; height: 168px !important; }
.page-qr.is-waiting span { max-width: 130px; color: #666; font-size: .9rem; line-height: 1.35; text-align: center; }
.mini-step { margin-bottom: 4px !important; color: #805300 !important; font-size: .78rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.phone-entry h3 { margin: 0 0 5px; }
.phone-entry p { margin: 0 0 8px; color: #595959; line-height: 1.45; }
.phone-entry a { color: var(--ink); font-weight: 900; text-underline-offset: 3px; }
label { display: block; margin-bottom: 7px; font-weight: 800; }
.join-row { display: flex; gap: 8px; }
input, button, .file-picker, .download-link {
  min-height: 48px;
  border: 2px solid var(--ink);
  border-radius: 9px;
  font: inherit;
}
input { min-width: 0; padding: 10px 12px; background: white; }
button, .file-picker, .download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  color: var(--ink);
  background: var(--yellow);
  font-weight: 900;
  cursor: pointer;
}
button:disabled { opacity: .45; cursor: not-allowed; }
button:focus-visible, input:focus-visible, .file-picker:focus-within, .download-link:focus-visible { outline: 4px solid #3d73ff; outline-offset: 2px; }
.room-code { margin: 14px 0 0; font: 900 2rem/1 monospace; letter-spacing: .12em; }

.status-line {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-top: 18px;
  padding: 18px 20px;
  border: 2px solid #c8c8c0;
  border-radius: 14px;
  background: #fcfcf8;
}
.status-line strong { display: block; font-size: 1.22rem; }
.status-line p { margin: 4px 0 0; color: #555; line-height: 1.4; }
.connection-picture { display: flex; min-width: 112px; align-items: center; justify-content: center; gap: 7px; }
.device { position: relative; display: block; border: 3px solid var(--ink); background: #fff; }
.computer-device { width: 44px; height: 31px; border-radius: 5px; }
.computer-device::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -8px; height: 4px; border-radius: 3px; background: var(--ink); }
.phone-device { width: 23px; height: 38px; border-radius: 6px; }
.connection-check { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 50%; color: #fff; background: #a4a49c; font-weight: 900; transform: scale(.82); }
.status-line:has([data-state="connected"]) { border-color: #126d49; background: var(--green); box-shadow: 4px 4px 0 #126d49; }
.status-line:has([data-state="connected"]) strong { color: #07553a; }
.status-line:has([data-state="connected"]) .device { border-color: #126d49; }
.status-line:has([data-state="connected"]) .computer-device::after,
.status-line:has([data-state="connected"]) .connection-check { background: #126d49; }
.status-line:has([data-state="connected"]) .connection-check { animation: connection-pop .55s cubic-bezier(.2, .9, .25, 1.35) both; }
.status-line:has([data-state="connecting"]), .status-line:has([data-state="transferring"]) { background: #fff7d6; }
.status-line:has([data-state="connecting"]) .connection-check,
.status-line:has([data-state="transferring"]) .connection-check { background: #d79a00; }
.status-line:has([data-state="failed"]) .connection-check,
.status-line:has([data-state="disconnected"]) .connection-check { background: var(--red); }

@keyframes connection-pop {
  0% { transform: scale(.65); opacity: .2; }
  70% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.connection-details { margin-top: 10px; }
.connection-details summary { cursor: pointer; color: #555; font-weight: 800; }
.manual-connect { margin-top: 14px; padding: 12px 14px; border: 1px solid #c8c8c0; border-radius: 10px; background: #fcfcf8; }
.manual-connect summary { cursor: pointer; color: #555; font-weight: 800; }
.manual-connect > p { margin: 10px 0; color: #666; }
.manual-form { max-width: 470px; margin-top: 14px; }

.connection-readout { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; margin: 10px 0 0; background: #c8c8c0; border: 1px solid #c8c8c0; }
.connection-readout div { padding: 12px; background: white; }
.connection-readout dt { color: #666; font-size: .8rem; font-weight: 800; text-transform: uppercase; }
.connection-readout dd { margin: 4px 0 0; font-weight: 800; }

#file-input { position: absolute; width: 1px; height: 1px; opacity: 0; }
#file-summary { margin: 15px 0 0; overflow-wrap: anywhere; font-weight: 800; }

.drop-zone {
  padding: 34px 18px;
  border: 2px dashed #77776f;
  border-radius: 14px;
  background: #faf9f4;
  text-align: center;
  transition: background-color .16s ease, border-color .16s ease;
}
.drop-zone.is-dragging { border-color: #20845a; background: var(--green); }
.drop-title { margin: 0; font-size: 1.35rem; font-weight: 900; }
.drop-or { margin: 6px 0; color: #666; }
.file-picker { min-width: 160px; }
.send-button { display: flex; width: min(100%, 360px); margin: 16px auto 0; }

.progress-block { margin-top: 22px; }
.progress-label { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
progress { width: 100%; height: 22px; accent-color: #20845a; }
#transfer-detail, #received-detail { margin: 8px 0 0; color: #595959; }
.error { margin: 16px 0 0; padding: 12px; color: var(--red); background: #fff0ef; border-left: 5px solid var(--red); font-weight: 700; }
.received-empty { padding: 22px; border: 2px dashed #aaa; color: #666; text-align: center; }
.download-link { margin-top: 6px; color: var(--ink); text-decoration: none; }

.product-copy { margin-top: 54px; }
.copy-intro { max-width: 760px; }
.copy-intro h2 { margin-bottom: 12px; font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1; letter-spacing: -.045em; }
.copy-intro > p:last-child { font-size: 1.06rem; line-height: 1.65; color: #464a44; }
.steps-grid, .use-grid { display: grid; gap: 14px; margin-top: 24px; }
.steps-grid { grid-template-columns: repeat(4, 1fr); }
.use-grid { grid-template-columns: repeat(3, 1fr); }
.steps-grid article, .use-grid article { padding: 18px; border: 1.5px solid var(--ink); border-radius: 12px; background: #fff; }
.steps-grid article > b { display: grid; width: 29px; height: 29px; place-items: center; margin-bottom: 18px; border: 1.5px solid var(--ink); border-radius: 50%; background: var(--yellow); }
.steps-grid h3, .use-grid h3 { margin-bottom: 7px; }
.steps-grid p, .use-grid p { margin: 0; color: #555951; line-height: 1.5; }
.use-grid a { color: var(--ink); font-weight: 800; text-underline-offset: 3px; }
.privacy-note { margin-top: 16px; padding: 16px 18px; border: 2px solid var(--ink); border-radius: 12px; background: var(--green); line-height: 1.55; }

@media (max-width: 680px) {
  .page-shell { width: min(100% - 20px, 980px); margin-top: 28px; }
  .transfer-panel { padding: 18px; box-shadow: 4px 4px 0 var(--ink); }
  .connect-grid, .connection-readout, .steps-grid, .use-grid { grid-template-columns: 1fr; }
  .phone-entry { grid-template-columns: 1fr; gap: 12px; padding: 16px; text-align: center; }
  .page-qr { width: 184px; height: 184px; margin: 0 auto; }
  .page-qr img, .page-qr canvas { width: 168px !important; height: 168px !important; }
  .status-line { align-items: flex-start; padding: 16px; }
  .connection-picture { min-width: 94px; transform: scale(.86); transform-origin: left top; }
  .join-row { display: grid; grid-template-columns: 1fr; }
  .file-picker, button { width: 100%; }
}

.phone-mode .desktop-intro { display: none; }
.phone-mode .phone-intro { display: block !important; }
.phone-mode .intro h1 { font-size: clamp(2.4rem, 14vw, 4rem); }
.phone-mode .connection-details { display: none; }
.phone-mode .manual-connect { margin-top: 18px; }

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .connection-check { animation: none !important; }
}
