:root{
  --blue:#1b62c9;
  --deep:#0d3478;
  --sky:#eaf5ff;
  --aqua:#20bfcc;
  --line:#dbe8f6;
  --text:#17324d;
  --muted:#64748b;
  --danger:#c2410c;
  --shadow:0 20px 50px rgba(21,80,140,.16);
  --radius:28px;
}
*{box-sizing:border-box}
html,body{margin:0;min-height:100%;font-family:"Yu Gothic UI","Yu Gothic",Meiryo,sans-serif;color:var(--text);background:linear-gradient(135deg,#f8fcff 0%,#e8f5ff 52%,#f9fdff 100%)}
a{color:inherit;text-decoration:none}
button,input,textarea,select{font:inherit}
button{cursor:pointer}
.app-frame{width:100%;min-height:100svh;margin:0 auto;position:relative;overflow:hidden}
@media (min-width:900px) and (orientation:landscape){
  body{display:flex;align-items:center;justify-content:center;overflow:auto;background:#dcefff}
  .app-frame{width:1920px;height:1080px;min-height:1080px;max-width:1920px;box-shadow:0 0 0 1px rgba(15,65,130,.08),0 26px 70px rgba(5,49,105,.18);background:linear-gradient(135deg,#f9fdff,#eaf6ff 48%,#ffffff);}
}
.app-header{display:flex;align-items:center;justify-content:space-between;padding:34px 54px 18px;gap:28px;position:relative;z-index:2}
.hospital-logo{height:82px;max-width:720px;object-fit:contain;object-position:left center}
.touchde-logo{height:86px;max-width:640px;object-fit:contain;object-position:right center}
.start-hero-card{margin:20px 72px 0;min-height:760px;border:1px solid rgba(40,120,200,.12);border-radius:42px;background:rgba(255,255,255,.74);box-shadow:var(--shadow);display:grid;grid-template-columns:1.05fr .95fr;align-items:center;padding:68px 70px;position:relative;overflow:hidden}
.start-hero-card:before{content:"";position:absolute;inset:-30% 45% 35% -10%;background:radial-gradient(circle,rgba(32,191,204,.25),transparent 66%)}
.start-copy{position:relative;z-index:1}.eyebrow{font-size:28px;font-weight:800;color:var(--blue);margin:0 0 18px}.start-copy h1{font-size:94px;line-height:1.02;letter-spacing:-.04em;margin:0;color:#0d2c62}.lead{font-size:30px;line-height:1.75;color:#334155;margin:28px 0 34px;max-width:760px}.notice-box{display:flex;gap:18px;align-items:flex-start;background:#f3faff;border:1px solid #cbe7ff;border-radius:22px;padding:22px 26px;font-size:22px;line-height:1.55;max-width:780px}.notice-box strong{white-space:nowrap;color:var(--deep)}.primary-start{display:inline-flex;align-items:center;justify-content:center;margin-top:38px;width:420px;height:96px;border-radius:999px;background:linear-gradient(135deg,var(--blue),#0c8ddf);color:white;font-size:34px;font-weight:900;box-shadow:0 16px 30px rgba(27,98,201,.28)}.primary-start:active{transform:translateY(2px)}.start-visual img{width:100%;max-height:620px;object-fit:contain;filter:drop-shadow(0 20px 30px rgba(30,95,160,.12))}.app-footer{display:flex;align-items:center;justify-content:flex-end;gap:18px;padding:22px 60px;color:#63758d;font-weight:700}.app-footer img{height:26px;max-width:260px;object-fit:contain}
.form-header{height:114px;display:grid;grid-template-columns:150px 1fr 330px;align-items:center;gap:22px;padding:20px 42px;border-bottom:1px solid rgba(120,164,205,.26);background:rgba(255,255,255,.72);backdrop-filter:blur(10px)}.back-home{height:58px;border-radius:18px;background:#edf7ff;border:1px solid #c8e1fb;display:flex;align-items:center;justify-content:center;font-size:24px;font-weight:800;color:var(--deep)}.form-hospital-logo{height:72px;max-width:690px;object-fit:contain;object-position:left}.form-title{text-align:right}.form-title span{display:block;color:var(--aqua);font-weight:900;font-size:22px}.form-title strong{display:block;font-size:38px;color:var(--deep);line-height:1.1}
.progress-rail{height:94px;display:flex;align-items:center;justify-content:center;gap:34px}.progress-dot{border:0;background:transparent;color:#6b7f96;font-weight:900;font-size:20px;display:flex;align-items:center;gap:10px}.progress-dot span{width:48px;height:48px;border-radius:50%;display:grid;place-items:center;background:#e9f4ff;color:#4876a8;border:2px solid #c9e0f8}.progress-dot.active{color:var(--blue)}.progress-dot.active span{background:var(--blue);border-color:var(--blue);color:#fff;box-shadow:0 8px 20px rgba(27,98,201,.24)}
.question-shell{height:calc(1080px - 114px - 94px);position:relative;padding:0 50px 112px}.question-page{display:none;height:100%;overflow:auto;padding:20px 10px 22px}.question-page.active{display:block}.page-heading{margin:0 auto 22px;max-width:1660px}.page-no{margin:0 0 8px;color:var(--aqua);font-size:22px;font-weight:900;letter-spacing:.08em}.page-heading h1{margin:0;color:#0d2c62;font-size:48px;line-height:1.18}.page-heading p:not(.page-no){font-size:23px;color:var(--muted);margin:12px 0 0}.card-grid{max-width:1660px;margin:0 auto;display:grid;gap:22px}.card-grid.two{grid-template-columns:repeat(2,1fr)}.input-card{background:rgba(255,255,255,.88);border:1px solid var(--line);border-radius:24px;padding:22px 24px;box-shadow:0 12px 26px rgba(29,80,130,.06);display:flex;flex-direction:column;gap:12px}.input-card.wide{grid-column:1/-1;max-width:1660px;margin-left:auto;margin-right:auto}.input-card span,.history-card h2,.schema-title{font-size:24px;font-weight:900;color:#12386e;margin:0}input,textarea,select{width:100%;border:2px solid #d7e8f8;background:#fff;border-radius:16px;padding:18px 20px;font-size:26px;color:#102a43;outline:none}textarea{resize:vertical;line-height:1.55}input:focus,textarea:focus,select:focus{border-color:#2d8cff;box-shadow:0 0 0 4px rgba(45,140,255,.12)}.segmented{display:flex;gap:14px;flex-wrap:wrap}.segmented label{flex:1;min-width:150px}.segmented input{display:none}.segmented b{display:grid;place-items:center;height:64px;border:2px solid #d7e8f8;background:#fff;border-radius:18px;font-size:24px;color:#385a7e}.segmented input:checked+b{background:#e9f7ff;border-color:var(--blue);color:var(--blue);box-shadow:inset 0 0 0 2px rgba(27,98,201,.08)}.segmented.compact b{height:54px;font-size:21px}.symptom-grid{max-width:1660px;margin:0 auto 20px;display:grid;grid-template-columns:repeat(4,1fr);gap:18px}.check-tile{position:relative}.check-tile input{position:absolute;opacity:0;pointer-events:none}.check-tile span{height:92px;border:2px solid #d7e8f8;border-radius:24px;background:#fff;display:flex;align-items:center;padding:0 24px;font-size:25px;font-weight:900;color:#17324d;box-shadow:0 10px 22px rgba(35,80,130,.07)}.check-tile span:before{content:"";width:28px;height:28px;border:3px solid #a8cbe9;border-radius:8px;margin-right:14px;background:#fff}.check-tile input:checked+span{border-color:var(--blue);background:linear-gradient(180deg,#f8fcff,#eaf6ff);color:var(--blue)}.check-tile input:checked+span:before{background:var(--blue);border-color:var(--blue);box-shadow:inset 0 0 0 5px #fff}.body-checks,.mini-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}.body-checks label,.mini-grid label{font-size:22px;font-weight:800;background:#f7fbff;border:1px solid #d9eafa;border-radius:16px;padding:14px 16px;display:flex;gap:10px;align-items:center}.body-checks input,.mini-grid input{width:24px;height:24px}.schema-panel{max-width:1660px;margin:22px auto 0;background:#fff;border:1px solid var(--line);border-radius:28px;padding:24px;box-shadow:0 12px 26px rgba(29,80,130,.06)}.schema-strip{display:grid;grid-template-columns:repeat(6,1fr);gap:14px;margin:18px 0}.schema-strip figure{margin:0;background:#fbfdff;border:1px solid #e1edf8;border-radius:20px;padding:12px;text-align:center}.schema-strip img{width:100%;height:170px;object-fit:contain}.schema-strip figcaption{font-size:17px;font-weight:800;color:#5b7188}.history-list{max-width:1660px;margin:0 auto;display:grid;grid-template-columns:1fr 1fr;gap:18px}.history-card{background:#fff;border:1px solid var(--line);border-radius:24px;padding:20px 22px;box-shadow:0 12px 26px rgba(29,80,130,.06)}.history-card h2{margin-bottom:14px}.history-card textarea{margin-top:12px;font-size:22px}.summary-box{max-width:1660px;margin:0 auto;background:#fff;border:1px solid var(--line);border-radius:26px;padding:28px;min-height:330px;font-size:22px;line-height:1.75;white-space:pre-wrap;box-shadow:0 12px 26px rgba(29,80,130,.06)}.result-panel{max-width:1660px;margin:18px auto 0;display:flex;align-items:flex-start;gap:22px}.secondary-btn{border:0;border-radius:20px;background:linear-gradient(135deg,var(--blue),#0c8ddf);color:white;font-size:25px;font-weight:900;padding:20px 30px;box-shadow:0 12px 24px rgba(27,98,201,.22)}.qr-area{display:grid;grid-template-columns:280px 1fr;gap:18px;align-items:start;flex:1}.qr-area.hidden{display:none}.qr-area canvas{background:#fff;border:1px solid var(--line);border-radius:18px;padding:10px}.qr-area textarea{font-size:18px}.fixed-actions{position:absolute;left:50px;right:50px;bottom:28px;height:72px;display:flex;justify-content:space-between;align-items:center;pointer-events:none}.nav-btn{pointer-events:auto;border:0;border-radius:22px;height:72px;min-width:220px;font-size:26px;font-weight:900}.nav-btn.ghost{background:#fff;border:2px solid #cfe4f8;color:#285982}.nav-btn.primary{background:linear-gradient(135deg,var(--blue),#0c8ddf);color:#fff;box-shadow:0 14px 26px rgba(27,98,201,.24)}.nav-btn:disabled{opacity:.35;cursor:not-allowed}.modal-backdrop{position:fixed;inset:0;background:rgba(3,18,38,.48);display:none;align-items:center;justify-content:center;padding:28px;z-index:50}.modal-backdrop.show{display:flex}.detail-modal{width:min(980px,96vw);max-height:88svh;overflow:auto;background:#fff;border-radius:34px;padding:34px;box-shadow:0 32px 80px rgba(2,10,30,.28);position:relative}.modal-close{position:absolute;right:24px;top:20px;width:54px;height:54px;border:0;border-radius:50%;background:#edf5ff;font-size:34px;color:#12386e}.detail-modal h2{margin:0;color:#0d2c62;font-size:40px}.detail-modal p{font-size:21px;color:#617287}.modal-fields{display:grid;gap:16px;margin-top:18px}.modal-field{display:grid;gap:8px}.modal-field label{font-size:22px;font-weight:900;color:#14386e}.modal-field .inline-options{display:flex;gap:10px;flex-wrap:wrap}.modal-field .inline-options label{font-size:20px;font-weight:800;background:#f7fbff;border:1px solid #d9eafa;border-radius:14px;padding:12px 14px;display:flex;align-items:center;gap:8px}.modal-field input[type=checkbox],.modal-field input[type=radio]{width:22px;height:22px}.modal-actions{text-align:right;margin-top:22px}
@media (max-width:899px),(orientation:portrait){
  body{background:#f4fbff;display:block;overflow:auto}.app-frame{min-height:100svh;background:linear-gradient(180deg,#f9fdff,#eaf6ff)}.app-header{display:block;padding:18px 16px}.hospital-logo{width:100%;height:auto;max-height:70px;object-fit:contain;object-position:left}.service-brand{text-align:center;margin-top:16px}.touchde-logo{width:min(82vw,420px);height:auto}.start-hero-card{margin:10px 14px 0;padding:28px 20px;border-radius:28px;display:flex;flex-direction:column;min-height:auto}.eyebrow{font-size:16px}.start-copy h1{font-size:44px}.lead{font-size:18px;line-height:1.65}.notice-box{font-size:15px;display:block;padding:16px}.notice-box strong{display:block;margin-bottom:6px}.primary-start{width:100%;height:72px;font-size:24px;margin-top:24px}.start-visual{order:-1;text-align:center}.start-visual img{max-height:260px}.app-footer{padding:18px;justify-content:center;font-size:12px}.app-footer img{height:18px}.form-header{height:auto;display:grid;grid-template-columns:72px 1fr;grid-template-areas:"back logo" "title title";padding:12px 14px;gap:10px}.back-home{grid-area:back;height:44px;font-size:16px;border-radius:14px}.form-hospital-logo{grid-area:logo;width:100%;height:auto;max-height:58px}.form-title{grid-area:title;text-align:left;display:flex;align-items:baseline;gap:12px}.form-title span{font-size:14px}.form-title strong{font-size:26px}.progress-rail{height:auto;overflow-x:auto;justify-content:flex-start;padding:12px 14px;gap:12px}.progress-dot{font-size:13px;min-width:max-content}.progress-dot span{width:34px;height:34px}.question-shell{height:auto;min-height:calc(100svh - 150px);padding:0 14px 96px}.question-page{height:auto;overflow:visible;padding:10px 0 20px}.page-no{font-size:14px}.page-heading h1{font-size:28px}.page-heading p:not(.page-no){font-size:16px}.card-grid.two,.symptom-grid,.history-list{grid-template-columns:1fr}.input-card{border-radius:20px;padding:16px}.input-card span,.history-card h2,.schema-title{font-size:18px}input,textarea,select{font-size:18px;padding:14px;border-radius:14px}.segmented b{height:52px;font-size:18px}.check-tile span{height:64px;font-size:18px;border-radius:18px;padding:0 16px}.check-tile span:before{width:22px;height:22px}.body-checks,.mini-grid{grid-template-columns:1fr}.body-checks label,.mini-grid label{font-size:16px}.schema-strip{grid-template-columns:repeat(2,1fr)}.schema-strip img{height:145px}.history-card{padding:16px}.summary-box{font-size:16px;min-height:240px;padding:18px}.result-panel,.qr-area{display:block}.secondary-btn{width:100%;font-size:19px;padding:16px}.qr-area canvas{display:block;margin:16px auto}.qr-area textarea{font-size:14px}.fixed-actions{position:fixed;left:14px;right:14px;bottom:14px;height:60px}.nav-btn{height:58px;min-width:132px;font-size:20px;border-radius:18px}.detail-modal{padding:26px 18px;border-radius:26px}.modal-close{right:14px;top:14px}.detail-modal h2{font-size:28px;padding-right:50px}.detail-modal p{font-size:15px}.modal-field label{font-size:17px}.modal-field .inline-options label{font-size:15px}.modal-actions{text-align:center}
}

/* ==============================
   HNSMHP v3 header layout
   ============================== */
.form-header-v3{
  height:126px;
  display:grid;
  grid-template-columns:520px 1fr 430px;
  align-items:center;
  gap:28px;
  padding:18px 44px;
  border-bottom:1px solid rgba(120,164,205,.26);
  background:rgba(255,255,255,.82);
  backdrop-filter:blur(10px);
}
.header-logo-left,
.header-logo-right{display:flex;align-items:center;min-width:0}
.header-logo-left{justify-content:flex-start}
.header-logo-right{justify-content:flex-end}
.form-header-v3 .form-hospital-logo{
  width:100%;
  max-width:520px;
  height:84px;
  object-fit:contain;
  object-position:left center;
}
.form-touchde-logo{
  width:100%;
  max-width:390px;
  height:74px;
  object-fit:contain;
  object-position:right center;
}
.header-progress{
  height:auto;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:22px;
  min-width:0;
  overflow:visible;
}
.header-progress .progress-dot{
  width:118px;
  min-width:118px;
  height:82px;
  border:2px solid #d7e8f8;
  border-radius:24px;
  background:linear-gradient(180deg,#ffffff,#f3f9ff);
  color:#55708c;
  font-weight:900;
  font-size:22px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:5px;
  box-shadow:0 10px 22px rgba(29,80,130,.06);
}
.header-progress .progress-dot span{
  width:auto;
  height:auto;
  border:0;
  border-radius:0;
  background:transparent;
  color:inherit;
  font-size:25px;
  line-height:1;
  box-shadow:none;
}
.header-progress .progress-dot b{
  display:block;
  font-size:22px;
  line-height:1.1;
  letter-spacing:.04em;
}
.header-progress .progress-dot.active{
  border-color:var(--blue);
  background:linear-gradient(180deg,#f5fbff,#e6f3ff);
  color:var(--blue);
  box-shadow:0 12px 24px rgba(27,98,201,.16);
}
.header-progress .progress-dot.active span{
  color:var(--blue);
  background:transparent;
  border:0;
  box-shadow:none;
}
.form-header-v3 + .question-shell{
  height:calc(1080px - 126px);
  padding-top:18px;
}

@media (max-width:899px),(orientation:portrait){
  .form-header-v3{
    height:auto;
    display:grid;
    grid-template-columns:1fr;
    grid-template-areas:
      "hospital"
      "steps"
      "service";
    gap:10px;
    padding:12px 14px 10px;
  }
  .header-logo-left{grid-area:hospital;justify-content:flex-start}
  .header-progress{grid-area:steps;justify-content:flex-start;overflow-x:auto;gap:8px;padding:4px 0 2px;scrollbar-width:none}
  .header-progress::-webkit-scrollbar{display:none}
  .header-logo-right{grid-area:service;justify-content:flex-end}
  .form-header-v3 .form-hospital-logo{max-width:100%;height:54px}
  .form-touchde-logo{max-width:260px;height:44px}
  .header-progress .progress-dot{
    width:72px;
    min-width:72px;
    height:58px;
    border-radius:18px;
    font-size:14px;
    gap:3px;
  }
  .header-progress .progress-dot span{font-size:17px}
  .header-progress .progress-dot b{font-size:14px}
  .form-header-v3 + .question-shell{
    height:auto;
    min-height:calc(100svh - 160px);
    padding-top:8px;
  }
}


/* ==============================
   HNSMHP v4 behavior & layout overrides
   ============================== */

.page-form .app-frame{overflow:visible}
@media (min-width:900px) and (orientation:landscape){
  .page-form .app-frame{height:auto;min-height:1080px;overflow:visible}
}
.logo-home-trigger{
  appearance:none;
  border:0;
  background:transparent;
  padding:0;
  margin:0;
  display:flex;
  align-items:center;
  justify-content:flex-start;
  width:100%;
}
.logo-home-trigger:focus-visible{outline:4px solid rgba(27,98,201,.24);border-radius:18px}
.logo-home-trigger .form-hospital-logo{cursor:pointer}
.page-form .question-shell{
  height:auto;
  min-height:calc(1080px - 126px);
  padding:18px 50px 36px;
}
.page-form .question-page{
  height:auto;
  overflow:visible;
  padding:20px 10px 12px;
}
.page-form .fixed-actions{
  position:static;
  left:auto;
  right:auto;
  bottom:auto;
  max-width:1660px;
  margin:28px auto 34px;
  height:auto;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:18px;
  pointer-events:auto;
}
.page-form .nav-btn{pointer-events:auto}
.header-progress .progress-dot{transition:all .2s ease}
.header-progress .progress-dot.locked{
  border-color:#dfe8f1;
  background:linear-gradient(180deg,#f8fafc,#f1f5f9);
  color:#96a5b4;
  box-shadow:none;
  opacity:.78;
  cursor:not-allowed;
}
.header-progress .progress-dot.locked span{color:#96a5b4}
.header-progress .progress-dot.unlocked:not(.active):not(.done){
  border-color:#b8daf9;
  background:linear-gradient(180deg,#ffffff,#eef7ff);
  color:#2a5fa9;
}
.header-progress .progress-dot.done{
  border-color:#1b62c9;
  background:linear-gradient(180deg,#3276d6,#1b62c9);
  color:#ffffff;
  box-shadow:0 14px 24px rgba(27,98,201,.18);
}
.header-progress .progress-dot.done span,
.header-progress .progress-dot.done b{color:#ffffff}
.header-progress .progress-dot.active{
  transform:translateY(-2px);
}
.header-progress .progress-dot.active b{font-weight:900}
.header-progress .progress-dot:disabled{pointer-events:none}
@media (max-width:899px),(orientation:portrait){
  .page-form .question-shell{padding:8px 14px 18px;min-height:calc(100svh - 160px)}
  .page-form .question-page{padding:10px 0 8px}
  .page-form .fixed-actions{
    position:static;
    margin:18px 0 24px;
    gap:12px;
  }
  .page-form .nav-btn{flex:1;height:58px;min-width:0}
  .logo-home-trigger{justify-content:flex-start}
}


/* ==============================
   HNSMHP v5 updates
   ============================== */
.header-progress .progress-dot{
  width:104px;
  min-width:104px;
}
.patient-no-card{
  border-color:#9fcef7;
  background:linear-gradient(180deg,#ffffff,#f5fbff);
}
.required-mark{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  margin-left:10px;
  padding:3px 10px;
  border-radius:999px;
  background:#fff1f2;
  color:#be123c;
  font-size:17px;
  font-style:normal;
  vertical-align:middle;
}
.patient-no-row{
  display:grid;
  grid-template-columns:1fr 190px;
  gap:12px;
  align-items:center;
}
.unknown-btn{
  height:66px;
  border:0;
  border-radius:18px;
  background:linear-gradient(180deg,#eaf6ff,#d9eeff);
  color:#0d3478;
  font-size:22px;
  font-weight:900;
  box-shadow:inset 0 0 0 2px #b9dcf8;
}
.patient-no-card small{
  color:#64748b;
  font-size:17px;
  font-weight:700;
}
.qr-manual-btn{
  display:none;
}
.result-panel{
  align-items:stretch;
}
.result-panel .qr-area{
  width:100%;
}
@media (max-width:899px),(orientation:portrait){
  .header-progress .progress-dot{
    width:64px;
    min-width:64px;
  }
  .patient-no-row{
    grid-template-columns:1fr;
  }
  .unknown-btn{
    height:54px;
    font-size:18px;
  }
  .patient-no-card small{
    font-size:14px;
  }
}


/* ==============================
   HNSMHP v6 QR display updates
   ============================== */
.summary-box{display:none}
.qr-stack{
  max-width:1660px;
  margin:0 auto;
  display:grid;
  grid-template-columns:1fr;
  gap:24px;
}
.qr-card{
  background:#ffffff;
  border:1px solid #cfe4f8;
  border-radius:26px;
  padding:24px;
  box-shadow:0 12px 26px rgba(29,80,130,.06);
}
.qr-card-head{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:18px;
  margin-bottom:18px;
}
.qr-card-head h2{
  margin:0;
  color:#0d2c62;
  font-size:32px;
  line-height:1.2;
}
.qr-card-head p{
  margin:0;
  color:#64748b;
  font-size:18px;
  font-weight:700;
}
.qr-card-body{
  display:grid;
  grid-template-columns:280px 1fr;
  gap:20px;
  align-items:start;
}
.qr-card canvas{
  width:260px;
  height:260px;
  background:#fff;
  border:1px solid var(--line);
  border-radius:18px;
  padding:10px;
}
.qr-card textarea{
  min-height:260px;
  font-size:20px;
  line-height:1.65;
  white-space:pre-wrap;
}
.qr-manual-btn{
  max-width:1660px;
  margin:22px auto 0;
  display:none;
}
@media (max-width:899px),(orientation:portrait){
  .qr-stack{gap:16px}
  .qr-card{padding:16px;border-radius:20px}
  .qr-card-head{display:block;margin-bottom:12px}
  .qr-card-head h2{font-size:24px}
  .qr-card-head p{font-size:14px;margin-top:4px}
  .qr-card-body{display:block}
  .qr-card canvas{display:block;margin:0 auto 14px;width:240px;height:240px}
  .qr-card textarea{min-height:190px;font-size:15px}
}


/* ==============================
   HNSMHP v7 refinements
   ============================== */
.female-only-card[hidden],
.female-only-card.is-hidden{display:none !important}
.detail-layout{
  max-width:1660px;
  margin:0 auto;
  display:grid;
  gap:22px;
}
.detail-row{
  display:grid;
  gap:22px;
}
.injury-row,
.location-row{
  grid-template-columns:1fr 1fr;
}
.main-detail-row{
  grid-template-columns:minmax(420px,.78fr) minmax(560px,1.22fr);
  align-items:stretch;
}
.detail-card{height:100%}
.wound-card textarea{min-height:136px}
.neuro-card .body-checks{
  grid-template-columns:repeat(3,minmax(0,1fr));
  align-content:start;
}
.neuro-card .body-checks label{
  min-height:58px;
  justify-content:flex-start;
}
.qr-card.patient-qr-card .qr-card-body{
  grid-template-columns:280px 1fr;
}
.qr-card.patient-qr-card textarea,
.qr-card.interview-qr-card textarea{
  background:#fbfdff;
}
.nav-btn.primary:not(:disabled){box-shadow:0 14px 26px rgba(27,98,201,.24)}
@media (max-width:899px),(orientation:portrait){
  .injury-row,.location-row,.main-detail-row{grid-template-columns:1fr}
  .detail-layout{gap:14px}
  .neuro-card .body-checks{grid-template-columns:1fr}
}


/* ==============================
   HNSMHP v8 admin/history/screenshot
   ============================== */
.admin-logo-trigger{
  appearance:none;
  border:0;
  background:transparent;
  padding:0;
  margin:0;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  width:100%;
}
.admin-logo-trigger:focus-visible{outline:4px solid rgba(27,98,201,.24);border-radius:18px}
.confirm-tool-row{
  max-width:1660px;
  margin:22px auto 0;
  display:flex;
  justify-content:flex-end;
  gap:16px;
  flex-wrap:wrap;
}
.confirm-tool-row .secondary-btn{width:auto}
.screenshot-btn{background:linear-gradient(135deg,#0f766e,#20bfcc)}
.qr-card.patient-qr-card textarea{
  user-select:text;
}
.admin-backdrop{z-index:70}
.admin-login-modal{width:min(720px,96vw)}
.admin-list-modal{width:min(1500px,96vw);max-height:90svh}
.admin-error{min-height:24px;color:#be123c;font-weight:900;font-size:18px;margin:4px 0 0}
.admin-toolbar{
  display:flex;
  justify-content:space-between;
  align-items:end;
  gap:16px;
  margin:18px 0;
}
.admin-toolbar label{font-size:18px;font-weight:900;color:#14386e;display:grid;gap:6px}
.admin-toolbar select{font-size:19px;padding:12px 14px;min-width:260px}
.small-btn{font-size:18px;padding:14px 20px;border-radius:16px;width:auto}
.admin-table-wrap{max-height:52svh;overflow:auto;border:1px solid #d7e8f8;border-radius:18px;background:#fff}
.admin-table{width:100%;border-collapse:collapse;font-size:18px}
.admin-table th,
.admin-table td{padding:14px 16px;border-bottom:1px solid #e5f0fb;text-align:left;vertical-align:top}
.admin-table th{position:sticky;top:0;background:#edf7ff;color:#0d3478;font-weight:900;z-index:1}
.admin-table tbody tr{cursor:pointer}
.admin-table tbody tr:hover,
.admin-table tbody tr:focus{background:#f0f8ff;outline:none}
.admin-empty{display:none;text-align:center;color:#64748b;font-size:20px;font-weight:900;padding:26px}
.detail-layout{grid-template-columns:1fr;align-items:stretch}
.detail-row{width:100%}
.injury-row,.location-row,.main-detail-row{grid-template-columns:1fr 1fr}
.wound-card textarea{min-height:128px}
.neuro-card .body-checks{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.neuro-card .body-checks label{min-height:60px}
@media (max-width:899px),(orientation:portrait){
  .confirm-tool-row{display:grid;grid-template-columns:1fr;gap:10px}
  .confirm-tool-row .secondary-btn{width:100%}
  .admin-toolbar{display:grid;align-items:stretch}
  .admin-toolbar select{min-width:0;width:100%}
  .admin-table{font-size:14px}
  .admin-table th,.admin-table td{padding:10px 8px}
  .injury-row,.location-row,.main-detail-row{grid-template-columns:1fr}
  .neuro-card .body-checks{grid-template-columns:1fr}
}


/* ==============================
   HNSMHP v9 top-admin and save layout
   ============================== */
.start-admin-trigger{width:auto;justify-content:flex-end}
.fixed-actions-right{display:flex;align-items:center;justify-content:flex-end;gap:18px}
.save-screen-btn{
  background:linear-gradient(135deg,#0f8f8f,#20bfcc);
  color:#fff;
  box-shadow:0 14px 26px rgba(15,143,143,.22);
  display:none;
  align-items:center;
  justify-content:center;
  text-align:center;
  line-height:1;
  padding:0 28px;
}
.page-form .fixed-actions{align-items:center}
@media (max-width:899px),(orientation:portrait){
  .fixed-actions-right{display:flex;gap:10px;flex:1}
  .fixed-actions-right .nav-btn{flex:1}
  .save-screen-btn{font-size:18px}
  .start-admin-trigger{width:100%;justify-content:center}
}


/* ==============================
   HNSMHP v10 button text centering
   ============================== */
.save-screen-btn,
.nav-btn.save-screen-btn{
  align-items:center;
  justify-content:center;
  text-align:center;
  line-height:1;
}


/* ==============================
   HNSMHP v11 tablet / smartphone compact layout
   ============================== */
@media (min-width:900px) and (max-width:1366px) and (orientation:landscape){
  body{display:block;overflow:auto;background:#eaf6ff}
  .app-frame,
  .page-form .app-frame{
    width:100%;
    max-width:none;
    height:auto;
    min-height:100svh;
    box-shadow:none;
    overflow:visible;
  }
  .app-header{padding:14px 20px 8px;gap:14px}
  .hospital-logo{height:48px;max-width:360px}
  .touchde-logo{height:50px;max-width:340px}
  .start-hero-card{margin:10px 22px 0;min-height:calc(100svh - 110px);padding:28px 34px;border-radius:28px;grid-template-columns:1.08fr .92fr}
  .eyebrow{font-size:18px;margin-bottom:10px}
  .start-copy h1{font-size:56px}
  .lead{font-size:18px;line-height:1.55;margin:16px 0 18px;max-width:580px}
  .notice-box{font-size:15px;padding:14px 16px;border-radius:16px;gap:10px;max-width:590px}
  .primary-start{width:300px;height:64px;font-size:23px;margin-top:20px}
  .start-visual img{max-height:420px}
  .app-footer{padding:10px 22px;font-size:12px}.app-footer img{height:18px}

  .form-header-v3{
    height:86px;
    grid-template-columns:270px minmax(0,1fr) 190px;
    gap:10px;
    padding:8px 16px;
  }
  .form-header-v3 .form-hospital-logo{height:50px;max-width:270px}
  .form-touchde-logo{height:40px;max-width:190px}
  .header-progress{gap:7px;justify-content:center;overflow:hidden}
  .header-progress .progress-dot{
    width:72px;
    min-width:72px;
    height:52px;
    border-radius:16px;
    font-size:14px;
    gap:2px;
  }
  .header-progress .progress-dot span{font-size:16px}
  .header-progress .progress-dot b{font-size:13px;letter-spacing:0}
  .form-header-v3 + .question-shell,
  .page-form .question-shell{
    min-height:calc(100svh - 86px);
    padding:10px 20px 14px;
  }
  .page-form .question-page{padding:8px 0 6px}
  .page-heading{margin-bottom:12px;max-width:100%}
  .page-no{font-size:14px;margin-bottom:4px}
  .page-heading h1{font-size:30px;line-height:1.14}
  .page-heading p:not(.page-no){font-size:15px;margin-top:8px}
  .card-grid,.symptom-grid,.history-list,.detail-layout,.qr-stack,.page-form .fixed-actions{max-width:100%}
  .card-grid{gap:12px}.card-grid.two{grid-template-columns:repeat(2,minmax(0,1fr))}
  .input-card,.history-card,.qr-card{border-radius:16px;padding:12px 14px;gap:8px}
  .input-card span,.history-card h2,.schema-title{font-size:16px}
  input,textarea,select{font-size:17px;padding:10px 12px;border-radius:12px}
  .segmented{gap:8px}.segmented label{min-width:90px}.segmented b{height:42px;font-size:16px;border-radius:12px}.segmented.compact b{height:38px;font-size:15px}
  .patient-no-row{grid-template-columns:1fr 120px;gap:8px}.unknown-btn{height:46px;font-size:16px;border-radius:12px}.patient-no-card small{font-size:12px}
  .symptom-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin-bottom:12px}
  .check-tile span{height:54px;border-radius:14px;padding:0 12px;font-size:16px}.check-tile span:before{width:18px;height:18px;border-width:2px;border-radius:5px;margin-right:8px}
  .detail-layout{gap:12px}.detail-row{gap:12px}.injury-row,.location-row,.main-detail-row{grid-template-columns:1fr 1fr}.wound-card textarea{min-height:74px}.neuro-card .body-checks{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.neuro-card .body-checks label{min-height:40px}
  .body-checks,.mini-grid{gap:8px}.body-checks label,.mini-grid label{font-size:15px;padding:9px 10px;border-radius:12px}.body-checks input,.mini-grid input{width:18px;height:18px}
  .history-list{gap:10px}.history-card textarea{font-size:16px;margin-top:8px}
  .schema-panel{max-width:100%;margin-top:12px;padding:14px;border-radius:18px}.schema-strip{gap:8px;margin:10px 0;grid-template-columns:repeat(6,minmax(0,1fr))}.schema-strip img{height:112px}.schema-strip figcaption{font-size:12px}
  .qr-stack{gap:14px}.qr-card-head{margin-bottom:10px}.qr-card-head h2{font-size:22px}.qr-card-head p{font-size:13px}.qr-card-body{grid-template-columns:210px 1fr;gap:14px}.qr-card canvas{width:200px;height:200px}.qr-card textarea{min-height:200px;font-size:14px;line-height:1.5}
  .page-form .fixed-actions{margin:14px auto 14px;gap:12px}.fixed-actions-right{gap:12px}.nav-btn{height:54px;min-width:150px;font-size:20px;border-radius:16px}.save-screen-btn{font-size:20px;padding:0 22px}.secondary-btn{font-size:18px;padding:13px 18px;border-radius:14px}
  .modal-field label{font-size:16px}.modal-field .inline-options label{font-size:14px;padding:9px 10px}.detail-modal h2{font-size:28px}.detail-modal p{font-size:15px}
}

@media (max-width:899px),(orientation:portrait){
  .app-header{padding:10px 12px 6px}.hospital-logo{max-height:42px}.touchde-logo{max-width:240px;max-height:38px}
  .start-hero-card{margin:6px 10px 0;padding:18px 14px;border-radius:22px}.eyebrow{font-size:13px}.start-copy h1{font-size:34px}.lead{font-size:14px;line-height:1.5;margin:12px 0}.notice-box{font-size:12px;padding:10px;border-radius:14px}.primary-start{height:56px;font-size:19px;margin-top:16px}.start-visual img{max-height:190px}.app-footer{padding:10px;font-size:10px}
  .form-header-v3{gap:6px;padding:8px 10px 6px}.form-header-v3 .form-hospital-logo{height:38px}.form-touchde-logo{max-width:190px;height:32px}
  .header-progress{gap:5px;padding:2px 0;overflow-x:auto}.header-progress .progress-dot{width:54px;min-width:54px;height:44px;border-radius:13px;font-size:12px;gap:1px}.header-progress .progress-dot span{font-size:13px}.header-progress .progress-dot b{font-size:11px;letter-spacing:0}
  .form-header-v3 + .question-shell,.page-form .question-shell{padding:6px 10px 10px;min-height:calc(100svh - 122px)}.page-form .question-page{padding:6px 0 4px}.page-heading{margin-bottom:10px}.page-no{font-size:12px;margin-bottom:3px}.page-heading h1{font-size:22px;line-height:1.16}.page-heading p:not(.page-no){font-size:13px;margin-top:6px}
  .card-grid{gap:9px}.input-card,.history-card,.qr-card{padding:10px 12px;border-radius:15px;gap:7px}.input-card span,.history-card h2,.schema-title{font-size:15px}input,textarea,select{font-size:15px;padding:9px 10px;border-radius:11px}.segmented{gap:7px}.segmented b{height:38px;font-size:15px;border-radius:11px}.segmented.compact b{height:36px;font-size:14px}
  .unknown-btn{height:40px;font-size:15px}.patient-no-card small{font-size:11px}.required-mark{font-size:11px;padding:2px 7px}
  .symptom-grid{gap:8px}.check-tile span{height:46px;font-size:14px;border-radius:13px;padding:0 10px}.check-tile span:before{width:16px;height:16px;border-width:2px;border-radius:5px;margin-right:7px}
  .detail-layout,.detail-row{gap:9px}.wound-card textarea{min-height:64px}.body-checks,.mini-grid{gap:7px}.body-checks label,.mini-grid label{font-size:13px;padding:8px 9px;border-radius:11px}.body-checks input,.mini-grid input{width:16px;height:16px}
  .schema-panel{padding:10px;border-radius:15px;margin-top:8px}.schema-strip{gap:6px;margin:8px 0}.schema-strip img{height:100px}.schema-strip figcaption{font-size:11px}
  .qr-card-head h2{font-size:19px}.qr-card-head p{font-size:11px}.qr-card canvas{width:190px;height:190px}.qr-card textarea{font-size:12px;min-height:150px}
  .page-form .fixed-actions{margin:12px 0 12px}.nav-btn{height:48px;font-size:17px;border-radius:14px}.fixed-actions-right{gap:8px}.save-screen-btn{font-size:16px}.secondary-btn{font-size:16px;padding:11px 14px;border-radius:12px}
}


/* ==============================
   HNSMHP v12 smartphone PC-site / compact viewport tuning
   ============================== */
html.phone-pc-wide body{background:#eaf6ff}

/* Smartphone landscape / browser PC-site: use 1366px virtual width and compact UI. */
@media (min-width:900px) and (max-width:1366px) and (orientation:landscape) and (max-height:560px){
  body{display:block;overflow:auto;background:#eaf6ff}
  .app-frame,.page-form .app-frame{width:100%;max-width:none;min-height:100svh;height:auto;box-shadow:none;overflow:visible}

  .app-header{padding:8px 14px 4px;gap:8px}
  .hospital-logo{height:34px;max-width:260px}
  .touchde-logo{height:34px;max-width:230px}
  .start-hero-card{margin:4px 14px 0;min-height:calc(100svh - 62px);padding:16px 22px;border-radius:22px;grid-template-columns:1.15fr .85fr}
  .eyebrow{font-size:14px;margin-bottom:6px}.start-copy h1{font-size:40px}.lead{font-size:13px;line-height:1.45;margin:10px 0 12px;max-width:520px}.notice-box{font-size:12px;padding:10px 12px;border-radius:12px;gap:8px;max-width:520px}.primary-start{width:230px;height:48px;font-size:18px;margin-top:12px}.start-visual img{max-height:270px}.app-footer{padding:6px 14px;font-size:10px}.app-footer img{height:14px}

  .form-header-v3{height:62px;grid-template-columns:220px minmax(0,1fr) 150px;gap:6px;padding:5px 10px}
  .form-header-v3 .form-hospital-logo{height:38px;max-width:220px}.form-touchde-logo{height:30px;max-width:150px}
  .header-progress{gap:4px;justify-content:center;overflow:hidden;padding:0}
  .header-progress .progress-dot{width:58px;min-width:58px;height:42px;border-radius:12px;font-size:12px;gap:1px;border-width:1px}
  .header-progress .progress-dot span{font-size:13px}.header-progress .progress-dot b{font-size:10px;letter-spacing:0}
  .form-header-v3 + .question-shell,.page-form .question-shell{min-height:calc(100svh - 62px);padding:6px 14px 8px}
  .page-form .question-page{padding:4px 0 2px}.page-heading{margin-bottom:8px}.page-no{font-size:11px;margin-bottom:2px}.page-heading h1{font-size:23px;line-height:1.12}.page-heading p:not(.page-no){font-size:12px;margin-top:4px}

  .card-grid,.symptom-grid,.history-list,.detail-layout,.qr-stack,.page-form .fixed-actions{max-width:100%}.card-grid{gap:8px}.card-grid.two{grid-template-columns:repeat(3,minmax(0,1fr))}.input-card,.history-card,.qr-card{border-radius:12px;padding:8px 10px;gap:5px}.input-card span,.history-card h2,.schema-title{font-size:13px}input,textarea,select{font-size:13px;padding:7px 8px;border-radius:9px;border-width:1px}.segmented{gap:6px}.segmented label{min-width:70px}.segmented b{height:32px;font-size:13px;border-radius:9px}.segmented.compact b{height:30px;font-size:12px}
  .patient-no-row{grid-template-columns:1fr 92px;gap:6px}.unknown-btn{height:33px;font-size:12px;border-radius:9px}.patient-no-card small{font-size:9px;line-height:1.25}.required-mark{font-size:9px;padding:1px 5px}

  .symptom-grid{grid-template-columns:repeat(6,minmax(0,1fr));gap:6px;margin-bottom:8px}.check-tile span{height:36px;border-radius:10px;padding:0 7px;font-size:12px}.check-tile span:before{width:13px;height:13px;border-width:2px;border-radius:4px;margin-right:5px}
  .input-card.wide{max-width:100%}.input-card.wide textarea{min-height:48px}

  .detail-layout{gap:8px}.detail-row{gap:8px}.injury-row,.main-detail-row,.location-row{grid-template-columns:repeat(2,minmax(0,1fr))}.wound-card textarea{min-height:48px}.neuro-card .body-checks{grid-template-columns:repeat(5,minmax(0,1fr));gap:5px}.neuro-card .body-checks label{min-height:32px}.body-checks,.mini-grid{gap:5px}.body-checks label,.mini-grid label{font-size:11px;padding:6px 7px;border-radius:8px}.body-checks input,.mini-grid input{width:13px;height:13px}
  .history-list{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.history-card textarea{font-size:12px;margin-top:5px;min-height:42px}
  .schema-panel{max-width:100%;margin-top:8px;padding:9px;border-radius:12px}.schema-strip{gap:5px;margin:6px 0;grid-template-columns:repeat(6,minmax(0,1fr))}.schema-strip img{height:74px}.schema-strip figcaption{font-size:9px}.schema-panel textarea{min-height:42px}
  .qr-stack{gap:8px}.qr-card-head{margin-bottom:6px}.qr-card-head h2{font-size:17px}.qr-card-head p{font-size:10px}.qr-card-body{grid-template-columns:140px 1fr;gap:10px}.qr-card canvas{width:132px;height:132px}.qr-card textarea{min-height:132px;font-size:10px;line-height:1.35}
  .page-form .fixed-actions{margin:8px auto 8px;gap:8px}.fixed-actions-right{gap:8px}.nav-btn{height:40px;min-width:112px;font-size:15px;border-radius:11px}.save-screen-btn{font-size:15px;padding:0 16px}.secondary-btn{font-size:13px;padding:9px 12px;border-radius:10px}
  .detail-modal{padding:18px;border-radius:18px}.detail-modal h2{font-size:22px}.detail-modal p{font-size:12px}.modal-fields{gap:9px;margin-top:10px}.modal-field label{font-size:13px}.modal-field .inline-options label{font-size:11px;padding:7px 8px}.modal-actions{margin-top:12px}
}

/* Smartphone / tablet portrait: slightly smaller text and controls than v11. */
@media (max-width:899px),(orientation:portrait){
  .app-header{padding:8px 10px 4px}.hospital-logo{max-height:34px}.touchde-logo{max-width:200px;max-height:32px}.start-hero-card{padding:14px 12px}.start-copy h1{font-size:30px}.lead{font-size:13px}.notice-box{font-size:11px}.primary-start{height:50px;font-size:17px}
  .form-header-v3{gap:4px;padding:6px 8px 5px}.form-header-v3 .form-hospital-logo{height:31px}.form-touchde-logo{max-width:160px;height:27px}.header-progress{gap:4px}.header-progress .progress-dot{width:48px;min-width:48px;height:39px;border-radius:11px}.header-progress .progress-dot span{font-size:12px}.header-progress .progress-dot b{font-size:10px}
  .form-header-v3 + .question-shell,.page-form .question-shell{padding:5px 8px 8px;min-height:calc(100svh - 108px)}.page-heading{margin-bottom:8px}.page-no{font-size:11px}.page-heading h1{font-size:20px}.page-heading p:not(.page-no){font-size:12px;margin-top:4px}.input-card,.history-card,.qr-card{padding:8px 10px}.input-card span,.history-card h2,.schema-title{font-size:14px}input,textarea,select{font-size:14px;padding:8px 9px}.segmented b{height:34px;font-size:14px}.unknown-btn{height:36px;font-size:13px}.check-tile span{height:41px;font-size:13px}.body-checks label,.mini-grid label{font-size:12px;padding:7px 8px}.page-form .fixed-actions{margin:9px 0}.nav-btn{height:44px;font-size:15px}.save-screen-btn{font-size:14px}
}


/* ==============================
   HNSMHP v13 tablet / smartphone PC-site fit tuning
   ============================== */
/* Tablet landscape: keep the TOP page inside one screen, especially iPad Air. */
@media (min-width:900px) and (max-width:1366px) and (orientation:landscape){
  body:not(.page-form){overflow:hidden}
  body:not(.page-form) .app-frame{
    height:100svh;
    min-height:100svh;
    overflow:hidden;
  }
  body:not(.page-form) .app-header{
    height:62px;
    padding:8px 18px 4px;
  }
  body:not(.page-form) .hospital-logo{height:42px;max-width:320px}
  body:not(.page-form) .touchde-logo{height:42px;max-width:300px}
  body:not(.page-form) .start-hero-card{
    height:calc(100svh - 100px);
    min-height:0;
    margin:6px 18px 0;
    padding:22px 30px;
    border-radius:26px;
    overflow:hidden;
  }
  body:not(.page-form) .eyebrow{font-size:16px;margin-bottom:8px}
  body:not(.page-form) .start-copy h1{font-size:50px;line-height:1.02}
  body:not(.page-form) .lead{font-size:16px;line-height:1.48;margin:13px 0 14px;max-width:560px}
  body:not(.page-form) .notice-box{font-size:13px;line-height:1.42;padding:12px 14px;max-width:560px}
  body:not(.page-form) .primary-start{width:280px;height:58px;font-size:21px;margin-top:16px}
  body:not(.page-form) .start-visual img{max-height:360px}
  body:not(.page-form) .app-footer{height:32px;padding:6px 18px;font-size:11px}
  body:not(.page-form) .app-footer img{height:16px}
}

/* Smartphone landscape PC-site: v12's 1366px was too wide, so use the 1180px virtual width and fit tighter. */
html.phone-pc-wide,
html.phone-pc-wide body{overflow:hidden;background:#eaf6ff}
@media (min-width:900px) and (max-width:1180px) and (orientation:landscape) and (max-height:560px){
  body:not(.page-form) .app-frame{
    height:100svh;
    min-height:100svh;
    overflow:hidden;
  }
  body:not(.page-form) .app-header{
    height:44px;
    padding:5px 10px 2px;
  }
  body:not(.page-form) .hospital-logo{height:28px;max-width:220px}
  body:not(.page-form) .touchde-logo{height:28px;max-width:190px}
  body:not(.page-form) .start-hero-card{
    height:calc(100svh - 68px);
    min-height:0;
    margin:3px 10px 0;
    padding:12px 18px;
    border-radius:18px;
    grid-template-columns:1.2fr .8fr;
    overflow:hidden;
  }
  body:not(.page-form) .eyebrow{font-size:12px;margin-bottom:4px}
  body:not(.page-form) .start-copy h1{font-size:32px;line-height:1.02}
  body:not(.page-form) .lead{font-size:11px;line-height:1.36;margin:7px 0 8px;max-width:450px}
  body:not(.page-form) .notice-box{font-size:10px;line-height:1.35;padding:7px 9px;border-radius:10px;max-width:450px;gap:6px}
  body:not(.page-form) .primary-start{width:190px;height:38px;font-size:15px;margin-top:8px}
  body:not(.page-form) .start-visual img{max-height:210px}
  body:not(.page-form) .app-footer{height:21px;padding:3px 10px;font-size:9px}
  body:not(.page-form) .app-footer img{height:12px}

  .page-form .form-header-v3{height:56px;grid-template-columns:200px minmax(0,1fr) 135px;padding:4px 8px;gap:5px}
  .page-form .form-header-v3 .form-hospital-logo{height:34px;max-width:200px}
  .page-form .form-touchde-logo{height:27px;max-width:135px}
  .page-form .header-progress{gap:3px}
  .page-form .header-progress .progress-dot{width:52px;min-width:52px;height:38px;border-radius:10px}
  .page-form .header-progress .progress-dot span{font-size:12px}
  .page-form .header-progress .progress-dot b{font-size:9px}
  .page-form .form-header-v3 + .question-shell,
  .page-form .question-shell{min-height:calc(100svh - 56px);padding:5px 10px 7px}
  .page-form .page-heading h1{font-size:21px}
  .page-form .page-heading p:not(.page-no){font-size:11px}
}

/* ==============================
   HNSMHP v14 schema drawing
   ============================== */
.schema-draw-panel{padding:20px}
.schema-workspace{display:grid;grid-template-columns:260px 1fr;gap:20px;align-items:stretch}
.schema-picker{display:grid;grid-template-columns:1fr;gap:12px;align-content:start}
.schema-thumb{border:2px solid #d7e8f8;border-radius:18px;background:#fff;padding:10px;display:grid;grid-template-columns:76px 1fr;gap:10px;align-items:center;text-align:left;color:#17324d;font-weight:900;box-shadow:0 8px 18px rgba(29,80,130,.06)}
.schema-thumb img{width:76px;height:70px;object-fit:contain;background:#f8fbff;border-radius:12px}
.schema-thumb span{font-size:18px;line-height:1.2}
.schema-thumb.active{border-color:var(--blue);background:linear-gradient(180deg,#f8fcff,#e6f3ff);color:var(--blue)}
.schema-canvas-card{background:#fff;border:1px solid #dbe8f6;border-radius:24px;padding:18px;box-shadow:0 10px 22px rgba(29,80,130,.06)}
.schema-toolbar{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:14px}
.schema-toolbar .schema-title{font-size:26px;color:#0d2c62}
.schema-toolbar p{margin:4px 0 0;color:#64748b;font-size:18px;font-weight:800}
.schema-tools{display:flex;gap:10px;flex-wrap:wrap;justify-content:flex-end}
.schema-tool-btn{border:2px solid #cfe4f8;background:#fff;color:#285982;border-radius:16px;padding:12px 16px;font-size:18px;font-weight:900;line-height:1}
.schema-tool-btn.active{background:linear-gradient(135deg,var(--blue),#0c8ddf);border-color:var(--blue);color:#fff}
.schema-tool-btn.danger{border-color:#fecaca;color:#b91c1c;background:#fff7f7}
.schema-canvas-wrap{background:#fff;border:2px solid #d7e8f8;border-radius:22px;display:grid;place-items:center;overflow:hidden;touch-action:none}
#schemaCanvas{width:100%;height:auto;display:block;touch-action:none;cursor:crosshair;background:#fff}
.schema-help{margin:12px 4px 0;color:#64748b;font-size:17px;font-weight:700}
.schema-note-card{margin-top:16px}
.schema-qr-card{border-color:#dceafe}
@media (min-width:900px) and (max-width:1366px) and (orientation:landscape){
  .schema-workspace{grid-template-columns:190px 1fr;gap:12px}
  .schema-draw-panel{padding:14px}
  .schema-picker{gap:8px}
  .schema-thumb{grid-template-columns:56px 1fr;border-radius:14px;padding:7px;gap:7px}
  .schema-thumb img{width:56px;height:48px;border-radius:10px}
  .schema-thumb span{font-size:14px}
  .schema-canvas-card{padding:12px;border-radius:18px}
  .schema-toolbar{margin-bottom:10px;gap:10px}
  .schema-toolbar .schema-title{font-size:20px}
  .schema-toolbar p{font-size:14px}
  .schema-tool-btn{font-size:14px;border-radius:12px;padding:9px 11px}
  #schemaCanvas{max-height:420px}
  .schema-help{font-size:13px;margin-top:8px}
  .schema-note-card{margin-top:10px}
}
@media (max-width:899px),(orientation:portrait){
  .schema-draw-panel{padding:12px}
  .schema-workspace{grid-template-columns:1fr;gap:12px}
  .schema-picker{grid-template-columns:repeat(3,1fr);gap:8px}
  .schema-thumb{grid-template-columns:1fr;text-align:center;place-items:center;border-radius:14px;padding:8px;gap:4px}
  .schema-thumb img{width:100%;height:48px}
  .schema-thumb span{font-size:12px}
  .schema-canvas-card{padding:10px;border-radius:18px}
  .schema-toolbar{display:block;margin-bottom:8px}
  .schema-toolbar .schema-title{font-size:18px}
  .schema-toolbar p{font-size:13px;margin:2px 0 8px}
  .schema-tools{justify-content:flex-start;gap:6px}
  .schema-tool-btn{font-size:12px;border-radius:10px;padding:8px 9px}
  #schemaCanvas{max-height:330px}
  .schema-help{font-size:12px;margin-top:8px}
  .schema-note-card{margin-top:10px}
}


/* ==============================
   HNSMHP v15 schema hit-layout
   ============================== */
.schema-hit-panel{padding:20px}.schema-hit-workspace{display:grid;grid-template-columns:250px 1fr;gap:22px;align-items:stretch}.schema-hit-picker{display:grid;grid-template-columns:1fr;gap:12px;align-content:start;max-height:680px;overflow:auto;padding-right:4px}.schema-edit-area{display:grid;grid-template-columns:minmax(500px,1.1fr) minmax(390px,.9fr);gap:18px;align-items:stretch;min-width:0}.schema-touch-card,.schema-detail-panel{min-width:0;background:#fff;border:1px solid #dbe8f6;border-radius:24px;box-shadow:0 10px 22px rgba(29,80,130,.06)}.schema-touch-card{padding:18px;display:flex;flex-direction:column}.schema-detail-panel{padding:20px;align-self:stretch}.schema-hit-toolbar{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:12px}.schema-hit-actions{justify-content:flex-end}.schema-hit-canvas-wrap{flex:1;min-height:430px;background:#fff;border:2px solid #d7e8f8;border-radius:22px;display:grid;place-items:center;overflow:hidden;touch-action:none}#schemaCanvas{width:100%;height:auto;max-height:560px;display:block;touch-action:none;cursor:pointer;background:#fff}.selected-part{font-size:22px;font-weight:900;color:var(--blue);margin:0 0 18px;padding:0 0 14px;border-bottom:1px solid #e6eef8;line-height:1.5}.section-title{font-size:20px;font-weight:900;color:#12386e;margin:0 0 12px;display:flex;align-items:baseline;gap:8px}.section-title.no-margin{margin:0}.section-title .sub{font-size:14px;color:#64748b;font-weight:800}.schema-symptom-types{display:flex;flex-wrap:wrap;gap:10px;margin-bottom:22px}.schema-symptom-types label{display:inline-flex}.schema-symptom-types input{display:none}.type-btn{display:inline-flex;align-items:center;justify-content:center;min-height:46px;padding:10px 18px;border:2px solid #d7e8f8;border-radius:999px;background:#fff;color:var(--blue);font-size:18px;font-weight:900}.schema-symptom-types input:checked+.type-btn{background:linear-gradient(135deg,var(--blue),#0c8ddf);border-color:var(--blue);color:#fff}.slider-header{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:6px 0 12px}.slider-value{font-size:28px;font-weight:900;color:#0d2c62}.slider-value small{font-size:18px;color:#64748b}.slider-labels{display:flex;justify-content:space-between;margin:6px 0 18px;font-size:15px;color:#285982;font-weight:900}#schemaIntensity{appearance:none;width:100%;height:10px;background:#e0eaf6;border-radius:999px;outline:none;padding:0;border:0}#schemaIntensity::-webkit-slider-thumb{appearance:none;width:32px;height:32px;border-radius:50%;background:var(--blue);box-shadow:0 3px 8px rgba(0,0,0,.2)}#schemaIntensity::-moz-range-thumb{width:32px;height:32px;border:0;border-radius:50%;background:var(--blue);box-shadow:0 3px 8px rgba(0,0,0,.2)}.schema-note-card-inline{box-shadow:none;margin:0;padding:0;border:0;background:transparent}.schema-note-card-inline span{font-size:20px}.schema-note-card-inline textarea{font-size:20px;min-height:98px}
@media (min-width:900px) and (max-width:1366px) and (orientation:landscape){.schema-hit-workspace{grid-template-columns:190px 1fr;gap:12px}.schema-edit-area{grid-template-columns:minmax(360px,1fr) minmax(300px,.85fr);gap:12px}.schema-hit-panel{padding:12px}.schema-hit-picker{gap:8px;max-height:520px}.schema-touch-card,.schema-detail-panel{padding:12px;border-radius:18px}.schema-hit-canvas-wrap{min-height:330px;border-radius:18px}#schemaCanvas{max-height:430px}.selected-part{font-size:16px;margin-bottom:10px;padding-bottom:8px}.section-title{font-size:15px;margin-bottom:8px}.section-title .sub{font-size:11px}.schema-symptom-types{gap:6px;margin-bottom:12px}.type-btn{min-height:34px;padding:7px 11px;font-size:13px}.slider-value{font-size:20px}.slider-value small{font-size:13px}.slider-labels{font-size:11px;margin-bottom:10px}.schema-note-card-inline span{font-size:15px}.schema-note-card-inline textarea{font-size:14px;min-height:58px}.schema-hit-toolbar{margin-bottom:8px}.schema-tool-btn{font-size:12px;padding:7px 9px}#schemaIntensity{height:8px}#schemaIntensity::-webkit-slider-thumb{width:26px;height:26px}}
@media (max-width:899px),(orientation:portrait){.schema-hit-workspace{grid-template-columns:1fr;gap:10px}.schema-hit-picker{grid-template-columns:repeat(3,1fr);gap:6px;max-height:none;overflow:visible;padding-right:0}.schema-edit-area{grid-template-columns:1fr;gap:10px}.schema-hit-panel{padding:10px}.schema-touch-card,.schema-detail-panel{padding:10px;border-radius:18px}.schema-hit-canvas-wrap{min-height:250px;border-radius:16px}#schemaCanvas{max-height:320px}.selected-part{font-size:14px;margin-bottom:8px;padding-bottom:8px}.section-title{font-size:14px;margin-bottom:7px}.section-title .sub{font-size:10px}.schema-symptom-types{gap:6px;margin-bottom:10px}.type-btn{min-height:32px;padding:6px 10px;font-size:12px}.slider-value{font-size:18px}.slider-value small{font-size:12px}.slider-labels{font-size:10px;margin-bottom:8px}.schema-note-card-inline span{font-size:14px}.schema-note-card-inline textarea{font-size:13px;min-height:52px}.schema-hit-toolbar{display:flex;margin-bottom:8px}.schema-hit-toolbar .schema-title{font-size:16px}.schema-hit-toolbar p{font-size:12px}.schema-tool-btn{font-size:11px;padding:7px 8px;border-radius:9px}}


.schema-multi-workspace{grid-template-columns:minmax(240px,32%) minmax(0,68%);align-items:start}
.schema-side-picker{max-height:none;overflow:visible;padding-right:0}
.schema-multi-edit-area{grid-template-columns:1fr;gap:16px}
.schema-multi-canvas-card{min-height:0}
.schema-entry-editor{display:grid;gap:16px}
.schema-entry-actions{display:flex;flex-wrap:wrap;gap:10px;margin-top:4px}
.schema-action-btn{border:2px solid #cfe4f8;background:#fff;color:#285982;border-radius:16px;padding:12px 16px;font-size:18px;font-weight:900;line-height:1;min-height:48px}
.schema-action-btn.primary{background:linear-gradient(135deg,var(--blue),#0c8ddf);border-color:var(--blue);color:#fff}
.schema-action-btn.ghost{background:#f8fbff}
.schema-action-btn.danger{border-color:#fecaca;color:#b91c1c;background:#fff7f7}
.schema-action-btn:disabled{opacity:.45;cursor:not-allowed}
.schema-entry-list-card{border-top:1px solid #e6eef8;padding-top:16px}
.schema-entry-list{display:grid;gap:10px}
.schema-entry-empty{border:1px dashed #c9dff5;border-radius:16px;padding:14px 16px;background:#f8fbff;color:#5b7188;font-size:16px;font-weight:700}
.schema-entry-item{display:grid;grid-template-columns:1fr auto;gap:10px;align-items:center;border:1px solid #d9eafa;border-radius:18px;padding:10px;background:#fbfdff}
.schema-entry-item.active{border-color:var(--blue);background:linear-gradient(180deg,#f8fcff,#eaf6ff)}
.schema-entry-select{border:0;background:transparent;padding:0;display:grid;grid-template-columns:42px 1fr;gap:12px;align-items:center;text-align:left;color:#12386e}
.schema-entry-badge{display:grid;place-items:center;width:42px;height:42px;border-radius:50%;background:#0b49a5;color:#fff;font-size:18px;font-weight:900}
.schema-entry-text{display:grid;gap:4px;min-width:0}
.schema-entry-text strong{font-size:18px;color:#12386e}
.schema-entry-text small{font-size:14px;color:#5b7188;line-height:1.45}
.schema-entry-delete{border:2px solid #fecaca;background:#fff7f7;color:#b91c1c;border-radius:12px;padding:10px 12px;font-size:14px;font-weight:900;line-height:1;align-self:center}
@media (max-width:1366px){
  .schema-multi-workspace{grid-template-columns:minmax(180px,28%) minmax(0,72%);gap:14px}
  .schema-entry-actions{gap:8px}
  .schema-action-btn{font-size:15px;padding:10px 12px;border-radius:12px;min-height:42px}
  .schema-entry-text strong{font-size:15px}
  .schema-entry-text small{font-size:12px}
}
@media (max-width:899px),(orientation:portrait){
  .schema-multi-workspace{grid-template-columns:1fr;gap:10px}
  .schema-side-picker{display:grid;grid-template-columns:repeat(3,1fr);gap:6px}
  .schema-entry-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px}
  .schema-action-btn{font-size:12px;padding:8px 9px;border-radius:10px;min-height:38px}
  .schema-entry-item{grid-template-columns:1fr;gap:8px}
  .schema-entry-delete{justify-self:end;font-size:12px;padding:8px 10px}
  .schema-entry-badge{width:34px;height:34px;font-size:14px}
  .schema-entry-select{grid-template-columns:34px 1fr;gap:8px}
  .schema-entry-text strong{font-size:13px}
  .schema-entry-text small{font-size:11px}
  .schema-entry-empty{font-size:12px;padding:10px 12px}
}


.schema-view-selector{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:12px;margin-bottom:16px}
.schema-view-btn{display:flex;align-items:center;justify-content:center;min-height:56px;padding:10px 14px;border-radius:999px;border:2px solid var(--blue);background:#fff;color:var(--blue);font-weight:900;text-align:center;box-shadow:none;grid-template-columns:none}
.schema-view-btn img{display:none}
.schema-view-btn span{font-size:22px;line-height:1}
.schema-view-btn.active{background:linear-gradient(135deg,var(--blue),#0c8ddf);color:#fff;border-color:var(--blue)}
.schema-v17-workspace{grid-template-columns:minmax(260px,32%) minmax(0,68%);align-items:start}
.schema-registered-panel{background:#fff;border:1px solid #d8e7f7;border-radius:20px;padding:16px;min-height:100%}
.schema-registered-title{font-size:24px;font-weight:900;color:#12386e;margin-bottom:14px}
.schema-registered-views{display:grid;gap:12px;align-content:start}
.schema-registered-empty{border:1px dashed #c9dff5;border-radius:18px;padding:18px 14px;background:#f8fbff;color:#5b7188;font-size:16px;font-weight:700;line-height:1.6}
.schema-registered-card{display:grid;grid-template-columns:72px 1fr;gap:12px;align-items:center;border:2px solid #d7e8f8;border-radius:18px;background:#fff;padding:10px;text-align:left;color:#17324d;box-shadow:0 8px 18px rgba(29,80,130,.06)}
.schema-registered-card img{width:72px;height:72px;object-fit:contain;background:#f8fbff;border-radius:12px}
.schema-registered-meta{display:grid;gap:4px}
.schema-registered-meta strong{font-size:18px;color:#12386e}
.schema-registered-meta small{font-size:14px;color:#5b7188}
.schema-registered-card.active{border-color:var(--blue);background:linear-gradient(180deg,#f8fcff,#e6f3ff)}
@media (max-width:1366px){
  .schema-view-selector{gap:10px}
  .schema-view-btn{min-height:48px;padding:8px 10px}
  .schema-view-btn span{font-size:18px}
  .schema-registered-title{font-size:18px}
  .schema-registered-card{grid-template-columns:56px 1fr;padding:8px;border-radius:14px}
  .schema-registered-card img{width:56px;height:56px}
  .schema-registered-meta strong{font-size:15px}
  .schema-registered-meta small{font-size:12px}
}
@media (max-width:899px),(orientation:portrait){
  .schema-view-selector{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin-bottom:10px}
  .schema-view-btn{min-height:40px;padding:8px 6px}
  .schema-view-btn span{font-size:14px}
  .schema-v17-workspace{grid-template-columns:1fr;gap:10px}
  .schema-registered-panel{padding:10px;border-radius:14px}
  .schema-registered-title{font-size:15px;margin-bottom:8px}
  .schema-registered-views{grid-template-columns:1fr 1fr;gap:8px}
  .schema-registered-card{grid-template-columns:42px 1fr;gap:8px;padding:6px;border-radius:12px}
  .schema-registered-card img{width:42px;height:42px;border-radius:8px}
  .schema-registered-meta strong{font-size:12px}
  .schema-registered-meta small{font-size:10px}
  .schema-registered-empty{font-size:12px;padding:12px 10px}
}


.schema-v18-workspace{display:block}
.schema-v18-edit-area{grid-template-columns:minmax(500px,1.05fr) minmax(420px,.95fr);gap:18px;align-items:start}
.schema-selected-top{display:grid;grid-template-columns:minmax(0,1fr) 280px;gap:16px;align-items:start;margin:0 0 16px;padding:0 0 14px;border-bottom:1px solid #e6eef8}
.schema-selected-top .selected-part{margin:0;padding:0;border:0;min-height:56px;display:flex;align-items:center}
.schema-inline-registered{min-width:0}
.schema-inline-title{font-size:15px;font-weight:900;color:#12386e;margin-bottom:8px}
.schema-inline-registered-views{display:grid;grid-template-columns:1fr;gap:8px;max-height:220px;overflow:auto;padding-right:2px}
.schema-inline-registered-views .schema-registered-card{grid-template-columns:46px 1fr;gap:10px;padding:8px 10px;border-radius:14px;box-shadow:0 4px 12px rgba(29,80,130,.05)}
.schema-inline-registered-views .schema-registered-card img{width:46px;height:46px;border-radius:8px}
.schema-inline-registered-views .schema-registered-meta strong{font-size:15px}
.schema-inline-registered-views .schema-registered-meta small{font-size:12px}
.schema-inline-registered-views .schema-registered-empty{font-size:13px;padding:12px 10px;border-radius:12px}
@media (min-width:900px) and (max-width:1366px) and (orientation:landscape){
  .schema-v18-edit-area{grid-template-columns:minmax(380px,1fr) minmax(320px,.92fr);gap:12px}
  .schema-selected-top{grid-template-columns:minmax(0,1fr) 220px;gap:12px;margin-bottom:10px;padding-bottom:10px}
  .schema-selected-top .selected-part{min-height:44px}
  .schema-inline-title{font-size:12px;margin-bottom:6px}
  .schema-inline-registered-views{gap:6px;max-height:160px}
  .schema-inline-registered-views .schema-registered-card{grid-template-columns:36px 1fr;padding:6px 8px;border-radius:12px}
  .schema-inline-registered-views .schema-registered-card img{width:36px;height:36px}
  .schema-inline-registered-views .schema-registered-meta strong{font-size:12px}
  .schema-inline-registered-views .schema-registered-meta small{font-size:10px}
}
@media (max-width:899px),(orientation:portrait){
  .schema-v18-edit-area{grid-template-columns:1fr;gap:10px}
  .schema-selected-top{grid-template-columns:1fr;gap:8px;margin-bottom:8px;padding-bottom:8px}
  .schema-selected-top .selected-part{min-height:auto}
  .schema-inline-title{font-size:12px;margin-bottom:5px}
  .schema-inline-registered-views{grid-template-columns:1fr 1fr;gap:6px;max-height:none;overflow:visible}
  .schema-inline-registered-views .schema-registered-card{grid-template-columns:34px 1fr;padding:5px 6px;border-radius:10px}
  .schema-inline-registered-views .schema-registered-card img{width:34px;height:34px}
  .schema-inline-registered-views .schema-registered-meta strong{font-size:11px}
  .schema-inline-registered-views .schema-registered-meta small{font-size:9px}
  .schema-inline-registered-views .schema-registered-empty{font-size:11px;padding:10px 8px}
}


.schema-view-btn{position:relative;overflow:hidden}
.schema-view-btn.has-entry{border-color:#18a17a;background:linear-gradient(180deg,#f0fffa,#e3fff5);color:#0f7e63;box-shadow:0 0 0 2px rgba(24,161,122,.08) inset}
.schema-view-btn.has-entry.active{background:linear-gradient(135deg,#0a8fc8,#1ebc8e);border-color:#0a8fc8;color:#fff}
.schema-view-btn.has-entry::after{content:attr(data-count);position:absolute;right:10px;top:7px;font-size:12px;font-weight:900;line-height:1;padding:5px 8px;border-radius:999px;background:rgba(24,161,122,.12);color:#0f7e63}
.schema-view-btn.has-entry.active::after{background:rgba(255,255,255,.22);color:#fff}
.schema-selected-top{grid-template-columns:minmax(0,1fr) 240px}
.schema-inline-title{font-size:14px}
.schema-inline-registered-views{display:flex;flex-direction:column;gap:8px;max-height:190px;overflow:auto}
.schema-inline-registered-views .schema-registered-card{min-height:62px}
.schema-inline-registered-views .schema-registered-empty{background:#f8fbff;border:1px dashed #c9dff7;color:#6a819a}
@media (min-width:900px) and (max-width:1366px) and (orientation:landscape){
  .schema-view-btn.has-entry::after{right:7px;top:6px;font-size:10px;padding:4px 6px}
  .schema-selected-top{grid-template-columns:minmax(0,1fr) 190px}
  .schema-inline-registered-views{max-height:140px;gap:6px}
  .schema-inline-registered-views .schema-registered-card{min-height:48px}
}
@media (max-width:899px),(orientation:portrait){
  .schema-view-btn.has-entry::after{right:6px;top:5px;font-size:9px;padding:3px 5px}
  .schema-selected-top{grid-template-columns:1fr;gap:8px}
  .schema-inline-registered-views{display:grid;grid-template-columns:1fr 1fr;gap:6px;max-height:none;overflow:visible}
  .schema-inline-registered-views .schema-registered-card{min-height:42px}
}


.schema-inline-registered{display:none !important}
.schema-selected-top{display:block !important;margin:0 0 10px !important;padding:0 0 8px !important;border-bottom:1px solid #e6eef8 !important}
.schema-selected-top .selected-part{min-height:auto !important;margin:0 !important;padding:0 !important;border:0 !important}
.schema-view-btn.has-entry{border-color:#18a17a;background:linear-gradient(180deg,#f0fffa,#e3fff5);color:#0f7e63;box-shadow:0 0 0 2px rgba(24,161,122,.08) inset}
.schema-view-btn.has-entry.active{background:linear-gradient(135deg,#0a8fc8,#1ebc8e);border-color:#0a8fc8;color:#fff}


.qr-card.hidden{display:none!important}


@media (min-width:900px) and (max-width:1366px) and (orientation:landscape){
  body{overflow:auto}
  .page-form .app-frame{
    width:100%;
    min-width:0;
    height:auto;
    min-height:100svh;
    transform:none;
    transform-origin:top left;
    overflow:visible;
  }
  .form-header-v3{
    height:58px;
    padding:5px 12px;
    grid-template-columns:minmax(190px,290px) minmax(420px,1fr) minmax(120px,180px);
    gap:10px;
  }
  .form-hospital-logo{max-height:42px;width:auto;max-width:280px}
  .form-touchde-logo{max-height:36px;width:auto;max-width:170px}
  .header-progress{gap:6px;justify-content:center}
  .header-progress .progress-dot{
    min-width:66px;
    height:42px;
    padding:4px 7px;
    border-radius:13px;
    gap:4px;
  }
  .header-progress .progress-dot span{
    width:22px;height:22px;font-size:12px;
  }
  .header-progress .progress-dot b{font-size:12px}
  .page-form .question-shell{
    min-height:calc(100svh - 58px);
    padding:7px 18px 10px;
  }
  .page-heading{
    max-width:1180px;
    margin:0 auto 8px;
  }
  .page-no{font-size:13px;margin-bottom:3px}
  .page-heading h1{font-size:27px;line-height:1.12}
  .page-heading p:not(.page-no){font-size:14px;margin-top:5px}
  .card-grid{max-width:1180px;gap:8px}
  .card-grid.two{grid-template-columns:repeat(2,minmax(0,1fr))}
  .input-card,.history-card,.qr-card{
    padding:10px 12px;
    border-radius:16px;
    gap:7px;
  }
  .input-card span,.history-card h2,.schema-title{font-size:15px}
  input,textarea,select{
    font-size:15px;
    padding:8px 10px;
    border-radius:10px;
    border-width:1px;
  }
  textarea{line-height:1.35}
  .segmented{gap:6px}
  .segmented label{min-width:70px}
  .segmented b{height:34px;font-size:13px;border-radius:10px}
  .segmented.compact b{height:30px;font-size:12px}
  .patient-no-row{grid-template-columns:1fr 110px;gap:7px}
  .unknown-btn{height:38px;font-size:13px;border-radius:10px}
  .patient-no-card small{font-size:10px;line-height:1.25}
  .required-mark{font-size:10px;padding:2px 6px}
  .symptom-grid{
    max-width:1180px;
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:8px;
    margin-bottom:8px;
  }
  .check-tile span{
    height:43px;
    font-size:13px;
    border-radius:12px;
    padding:0 10px;
  }
  .check-tile span:before{
    width:17px;height:17px;border-width:2px;border-radius:5px;margin-right:7px;
  }
  .body-checks,.mini-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
  .body-checks label,.mini-grid label{
    font-size:12px;
    padding:7px 8px;
    border-radius:9px;
    gap:6px;
  }
  .body-checks input,.mini-grid input{width:16px;height:16px}
  .detail-grid{max-width:1180px;gap:8px}
  .detail-row{gap:8px}
  .history-list{
    max-width:1180px;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:8px;
  }
  .history-card textarea{font-size:13px;margin-top:7px}
  .page-form .fixed-actions{
    max-width:1180px;
    margin:9px auto 12px;
    gap:10px;
  }
  .nav-btn{
    min-width:145px;
    height:46px;
    font-size:16px;
    border-radius:14px;
  }
  .save-screen-btn{
    min-width:145px;
    height:46px;
    font-size:15px;
    border-radius:14px;
  }
  .schema-panel{
    max-width:1180px;
    padding:9px 10px;
    border-radius:16px;
    margin-top:8px;
  }
  .schema-view-selector{
    grid-template-columns:repeat(6,minmax(0,1fr));
    gap:7px;
    margin-bottom:8px;
  }
  .schema-view-btn{
    min-height:36px;
    padding:6px 8px;
    border-radius:999px;
  }
  .schema-view-btn span{font-size:14px}
  .schema-view-btn.has-entry::after{
    right:5px;top:4px;
    font-size:9px;
    padding:3px 5px;
  }
  .schema-v18-edit-area{
    grid-template-columns:minmax(430px,1.05fr) minmax(340px,.95fr);
    gap:9px;
  }
  .schema-touch-card,.schema-detail-panel{
    padding:9px;
    border-radius:14px;
  }
  .schema-hit-toolbar{margin-bottom:6px;gap:8px}
  .schema-hit-toolbar .schema-title{font-size:16px}
  .schema-hit-toolbar p{font-size:11px;margin:2px 0 0}
  .schema-tool-btn{font-size:11px;padding:6px 8px;border-radius:9px}
  .schema-hit-canvas-wrap{min-height:270px;border-radius:14px}
  #schemaCanvas{max-height:350px}
  .schema-help{font-size:11px;margin-top:6px;line-height:1.35}
  .schema-selected-top{
    grid-template-columns:1fr;
    gap:4px;
    margin-bottom:7px;
    padding-bottom:7px;
  }
  .schema-selected-top .selected-part{
    min-height:auto;
    font-size:14px;
    line-height:1.3;
  }
  .schema-inline-registered{display:none!important}
  .section-title{font-size:13px;margin-bottom:5px}
  .section-title .sub{font-size:9px}
  .schema-symptom-types{
    gap:5px;
    margin-bottom:8px;
  }
  .type-btn{
    min-height:29px;
    padding:5px 9px;
    font-size:12px;
  }
  .slider-header{margin:4px 0 6px}
  .slider-value{font-size:17px}
  .slider-value small{font-size:11px}
  #schemaIntensity{height:7px}
  #schemaIntensity::-webkit-slider-thumb{width:22px;height:22px}
  #schemaIntensity::-moz-range-thumb{width:22px;height:22px}
  .slider-labels{font-size:9px;margin:4px 0 7px}
  .schema-note-card-inline span{font-size:13px}
  .schema-note-card-inline textarea{
    min-height:42px;
    font-size:12px;
    padding:7px 8px;
  }
  .schema-entry-actions{
    gap:5px;
    margin-top:2px;
  }
  .schema-action-btn{
    min-height:32px;
    padding:6px 8px;
    font-size:11px;
    border-radius:9px;
  }
  .schema-entry-list-card{padding-top:8px}
  .schema-entry-list{gap:5px}
  .schema-entry-empty{font-size:11px;padding:8px;border-radius:10px}
  .schema-entry-item{grid-template-columns:1fr auto;gap:6px;padding:6px;border-radius:10px}
  .schema-entry-select{grid-template-columns:28px 1fr;gap:7px}
  .schema-entry-badge{width:28px;height:28px;font-size:12px}
  .schema-entry-text strong{font-size:12px}
  .schema-entry-text small{font-size:9px;line-height:1.25}
  .schema-entry-delete{font-size:10px;padding:6px 8px;border-radius:8px}
  .qr-layout,.qr-list{
    max-width:1180px;
    gap:8px;
  }
  .qr-card h2{font-size:17px}
  .qr-row{grid-template-columns:190px 1fr;gap:10px}
  .qr-row canvas{width:170px!important;height:170px!important}
  .qr-row textarea{font-size:12px;min-height:150px}
}

@media (min-width:900px) and (max-width:1180px) and (orientation:landscape){
  .form-header-v3{
    height:52px;
    grid-template-columns:minmax(165px,250px) minmax(360px,1fr) minmax(100px,150px);
  }
  .form-hospital-logo{max-height:36px;max-width:240px}
  .form-touchde-logo{max-height:30px;max-width:140px}
  .header-progress .progress-dot{
    min-width:58px;height:36px;padding:3px 5px;border-radius:11px;
  }
  .header-progress .progress-dot span{width:19px;height:19px;font-size:10px}
  .header-progress .progress-dot b{font-size:10px}
  .page-form .question-shell{min-height:calc(100svh - 52px);padding:5px 14px 8px}
  .page-heading{margin-bottom:6px}
  .page-no{font-size:11px}
  .page-heading h1{font-size:22px}
  .page-heading p:not(.page-no){font-size:12px;margin-top:3px}
  .card-grid,.history-list,.symptom-grid,.schema-panel,.page-form .fixed-actions{max-width:1040px}
  .input-card,.history-card,.qr-card{padding:8px 10px;border-radius:13px}
  input,textarea,select{font-size:13px;padding:7px 8px}
  .input-card span,.history-card h2,.schema-title{font-size:13px}
  .check-tile span{height:37px;font-size:12px}
  .schema-panel{padding:7px 8px;margin-top:6px}
  .schema-view-selector{gap:6px;margin-bottom:6px}
  .schema-view-btn{min-height:32px}
  .schema-view-btn span{font-size:12px}
  .schema-v18-edit-area{grid-template-columns:minmax(380px,1.05fr) minmax(305px,.95fr);gap:7px}
  .schema-touch-card,.schema-detail-panel{padding:7px;border-radius:12px}
  .schema-hit-canvas-wrap{min-height:230px}
  #schemaCanvas{max-height:300px}
  .schema-help{font-size:10px;margin-top:4px}
  .type-btn{min-height:25px;font-size:10px;padding:4px 7px}
  .schema-symptom-types{margin-bottom:6px}
  .schema-note-card-inline textarea{min-height:34px;font-size:11px}
  .schema-action-btn{min-height:28px;font-size:10px;padding:5px 7px}
  .schema-entry-list-card{padding-top:6px}
  .nav-btn,.save-screen-btn{height:40px;min-width:130px;font-size:14px}
}

/* ==============================
   HNSMHP v27 smartphone layout refinements
   ============================== */
@media screen and (max-width:600px) and (orientation:portrait){
  html,body{overflow-x:hidden;background:#f4fbff}

  /* Start page */
  .page-start .app-header{
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    align-items:center;
    gap:12px;
    padding:calc(12px + env(safe-area-inset-top)) 14px 8px;
  }
  .page-start .hospital-brand,
  .page-start .service-brand{min-width:0}
  .page-start .service-brand{
    margin-top:0;
    text-align:right;
  }
  .page-start .start-admin-trigger{
    width:auto;
    justify-content:flex-end;
  }
  .page-start .hospital-logo{
    width:100%;
    max-width:240px;
    max-height:48px;
    height:auto;
  }
  .page-start .touchde-logo{
    width:132px;
    max-width:132px;
    max-height:none;
    height:auto;
  }
  .page-start .start-hero-card{
    margin:8px 12px 0;
    padding:18px 16px 20px;
    border-radius:24px;
    gap:12px;
  }
  .page-start .start-visual{
    order:-1;
    text-align:center;
  }
  .page-start .start-visual img{
    max-height:180px;
  }
  .page-start .eyebrow{
    font-size:14px;
    margin:2px 0 8px;
  }
  .page-start .start-copy h1{
    font-size:30px;
    line-height:1.12;
    letter-spacing:-.02em;
  }
  .page-start .lead{
    font-size:16px;
    line-height:1.55;
    margin:10px 0 14px;
  }
  .page-start .notice-box{
    padding:12px 14px;
    border-radius:16px;
    font-size:14px;
    line-height:1.55;
  }
  .page-start .notice-box strong{
    font-size:14px;
    margin-bottom:4px;
  }
  .page-start .primary-start{
    width:100%;
    height:58px;
    font-size:22px;
    margin-top:18px;
  }
  .page-start .app-footer{
    flex-wrap:wrap;
    justify-content:center;
    gap:8px 12px;
    padding:12px 14px 22px;
    font-size:11px;
  }
  .page-start .app-footer img{
    height:16px;
    max-width:190px;
  }

  /* Form page header */
  .page-form .form-header-v3{
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    grid-template-areas:
      "hospital service"
      "steps steps";
    align-items:center;
    gap:10px;
    padding:calc(10px + env(safe-area-inset-top)) 12px 10px;
  }
  .page-form .header-logo-left{
    grid-area:hospital;
    justify-content:flex-start;
  }
  .page-form .header-logo-right{
    grid-area:service;
    justify-content:flex-end;
  }
  .page-form .header-progress{
    grid-area:steps;
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:8px;
    padding:0;
    overflow:visible;
    justify-content:stretch;
  }
  .page-form .form-header-v3 .form-hospital-logo{
    max-width:100%;
    height:42px;
  }
  .page-form .form-touchde-logo{
    max-width:132px;
    height:28px;
  }
  .page-form .header-progress .progress-dot{
    width:100%;
    min-width:0;
    height:52px;
    padding:4px 6px;
    border-radius:16px;
    gap:2px;
  }
  .page-form .header-progress .progress-dot span{
    font-size:16px;
  }
  .page-form .header-progress .progress-dot b{
    font-size:14px;
    letter-spacing:0;
  }
  .page-form .form-header-v3 + .question-shell,
  .page-form .question-shell{
    min-height:calc(100svh - 180px);
    padding:8px 12px 18px;
  }
  .page-form .question-page{
    padding:8px 0 6px;
  }
  .page-form .page-heading{
    margin-bottom:12px;
  }
  .page-form .page-no{
    font-size:13px;
    margin-bottom:4px;
  }
  .page-form .page-heading h1{
    font-size:24px;
    line-height:1.18;
  }
  .page-form .page-heading p:not(.page-no){
    font-size:15px;
    line-height:1.55;
    margin-top:6px;
  }

  /* Form page content */
  .page-form .card-grid,
  .page-form .history-list,
  .page-form .symptom-grid,
  .page-form .schema-panel,
  .page-form .qr-stack,
  .page-form .page-form .fixed-actions{
    max-width:100%;
  }
  .page-form .card-grid,
  .page-form .history-list,
  .page-form .symptom-grid,
  .page-form .detail-layout,
  .page-form .detail-row,
  .page-form .qr-stack{
    gap:10px;
  }
  .page-form .card-grid.two,
  .page-form .history-list,
  .page-form .injury-row,
  .page-form .location-row,
  .page-form .main-detail-row,
  .page-form .schema-v18-edit-area,
  .page-form .qr-card-body{
    grid-template-columns:1fr;
  }
  .page-form .input-card,
  .page-form .history-card,
  .page-form .qr-card{
    padding:14px;
    border-radius:18px;
    gap:8px;
  }
  .page-form .input-card span,
  .page-form .history-card h2,
  .page-form .schema-title{
    font-size:16px;
  }
  .page-form input,
  .page-form textarea,
  .page-form select{
    font-size:16px;
    padding:12px 12px;
    border-radius:13px;
  }
  .page-form .segmented{
    gap:8px;
  }
  .page-form .segmented b{
    height:46px;
    font-size:17px;
    border-radius:13px;
  }
  .page-form .segmented.compact b{
    height:40px;
    font-size:15px;
  }
  .page-form .patient-no-row{
    grid-template-columns:1fr;
    gap:8px;
  }
  .page-form .unknown-btn{
    height:44px;
    font-size:16px;
    border-radius:12px;
  }
  .page-form .patient-no-card small{
    font-size:12px;
    line-height:1.45;
  }
  .page-form .required-mark{
    font-size:12px;
    padding:2px 8px;
  }
  .page-form .symptom-grid{
    grid-template-columns:1fr 1fr;
  }
  .page-form .check-tile span{
    height:50px;
    padding:0 12px;
    font-size:15px;
    border-radius:14px;
  }
  .page-form .check-tile span:before{
    width:18px;
    height:18px;
    margin-right:8px;
  }
  .page-form .body-checks,
  .page-form .mini-grid{
    grid-template-columns:1fr;
  }
  .page-form .body-checks label,
  .page-form .mini-grid label{
    font-size:14px;
    padding:10px 11px;
    border-radius:12px;
  }
  .page-form .body-checks input,
  .page-form .mini-grid input{
    width:17px;
    height:17px;
  }

  /* Schema page */
  .page-form .schema-panel{
    padding:12px;
    border-radius:18px;
    margin-top:10px;
  }
  .page-form .schema-view-selector{
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:8px;
    margin-bottom:12px;
  }
  .page-form .schema-view-btn{
    min-height:42px;
    padding:8px 6px;
  }
  .page-form .schema-view-btn span{
    font-size:14px;
  }
  .page-form .schema-touch-card,
  .page-form .schema-detail-panel{
    padding:12px;
    border-radius:16px;
  }
  .page-form .schema-hit-canvas-wrap{
    min-height:240px;
    border-radius:14px;
  }
  .page-form #schemaCanvas{
    max-height:320px;
  }
  .page-form .schema-help{
    font-size:12px;
    line-height:1.45;
    margin-top:8px;
  }
  .page-form .selected-part{
    font-size:15px;
  }
  .page-form .section-title{
    font-size:14px;
  }
  .page-form .section-title .sub{
    font-size:11px;
  }
  .page-form .type-btn{
    min-height:36px;
    padding:6px 10px;
    font-size:13px;
  }
  .page-form .slider-value{
    font-size:20px;
  }
  .page-form .slider-value small{
    font-size:12px;
  }
  .page-form .slider-labels{
    font-size:11px;
    margin-bottom:10px;
  }
  .page-form .schema-note-card-inline span{
    font-size:14px;
  }
  .page-form .schema-note-card-inline textarea{
    min-height:62px;
    font-size:16px;
  }
  .page-form .schema-entry-actions{
    display:grid;
    grid-template-columns:1fr;
    gap:8px;
  }
  .page-form .schema-action-btn{
    min-height:42px;
    font-size:13px;
    border-radius:12px;
    padding:9px 12px;
  }
  .page-form .schema-entry-list-card{
    padding-top:12px;
  }
  .page-form .schema-entry-empty{
    font-size:12px;
    padding:10px 12px;
  }
  .page-form .schema-entry-item{
    grid-template-columns:1fr;
    gap:8px;
  }
  .page-form .schema-entry-delete{
    justify-self:end;
  }

  /* QR / confirm */
  .page-form .qr-card-head h2{
    font-size:20px;
  }
  .page-form .qr-card canvas{
    display:block;
    margin:0 auto 14px;
    width:220px;
    height:220px;
  }
  .page-form .qr-card textarea{
    min-height:170px;
    font-size:14px;
    line-height:1.55;
  }

  /* Footer action buttons */
  .page-form .fixed-actions{
    position:static;
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:10px;
    margin:16px 0 12px;
    height:auto;
  }
  .page-form .fixed-actions-right{
    display:grid;
    grid-template-columns:1fr;
    gap:10px;
  }
  .page-form .nav-btn,
  .page-form .save-screen-btn{
    min-width:0;
    width:100%;
    height:50px;
    font-size:17px;
    border-radius:15px;
  }
}

@media screen and (max-width:390px) and (orientation:portrait){
  .page-start .hospital-logo{max-width:210px;max-height:42px}
  .page-start .touchde-logo{width:118px;max-width:118px}
  .page-start .start-copy h1{font-size:28px}
  .page-start .lead{font-size:15px}

  .page-form .form-header-v3 .form-hospital-logo{height:38px}
  .page-form .form-touchde-logo{max-width:118px;height:24px}
  .page-form .header-progress{gap:6px}
  .page-form .header-progress .progress-dot{height:48px;border-radius:14px}
  .page-form .header-progress .progress-dot span{font-size:15px}
  .page-form .header-progress .progress-dot b{font-size:12px}
  .page-form .page-heading h1{font-size:22px}
  .page-form .symptom-grid{grid-template-columns:1fr}
  .page-form .check-tile span{font-size:14px}
}


/* ==============================
   HNSMHP v28 final mobile/tablet/input refinements
   1) iPhone portrait: tighter and cleaner
   2) Tablet portrait/landscape: dedicated layout
   3) Input cards: clearer grouping and visual hierarchy
   ============================== */

/* Input item organization common */
.page-form .input-card,
.page-form .history-card,
.page-form .detail-card,
.page-form .qr-card{
  transition:border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.page-form .input-card:focus-within,
.page-form .history-card:focus-within,
.page-form .detail-card:focus-within{
  border-color:#9acbf5;
  box-shadow:0 0 0 3px rgba(27,98,201,.08),0 10px 24px rgba(29,80,130,.06);
}
.page-form .input-card span,
.page-form .history-card h2{
  display:flex;
  align-items:center;
  gap:8px;
}
.page-form .input-card span::before,
.page-form .history-card h2::before{
  content:"";
  display:inline-block;
  width:5px;
  height:1.15em;
  border-radius:999px;
  background:linear-gradient(180deg,var(--aqua),var(--blue));
  flex:none;
}
.page-form .patient-no-card span::before{
  background:linear-gradient(180deg,#fb7185,#be123c);
}

/* Smartphone portrait: make it feel like a native mobile form */
@media screen and (max-width:600px) and (orientation:portrait){
  body{
    background:#f3fbff;
    -webkit-text-size-adjust:100%;
  }
  .app-frame{
    min-height:100svh;
    background:linear-gradient(180deg,#fbfeff 0%,#eef8ff 100%);
  }

  /* Start screen is shorter and centered */
  .page-start .app-header{
    padding:calc(8px + env(safe-area-inset-top)) 12px 6px;
    gap:8px;
  }
  .page-start .hospital-logo{
    max-width:220px;
    max-height:42px;
  }
  .page-start .touchde-logo{
    width:116px;
    max-width:116px;
  }
  .page-start .start-hero-card{
    margin:6px 10px 0;
    padding:14px 14px 16px;
    border-radius:22px;
    box-shadow:0 10px 26px rgba(21,80,140,.10);
  }
  .page-start .start-visual img{
    max-height:150px;
  }
  .page-start .eyebrow{
    font-size:12px;
    margin:0 0 6px;
  }
  .page-start .start-copy h1{
    font-size:28px;
    line-height:1.08;
  }
  .page-start .lead{
    font-size:14px;
    line-height:1.52;
    margin:9px 0 11px;
  }
  .page-start .notice-box{
    font-size:13px;
    padding:10px 12px;
    line-height:1.5;
  }
  .page-start .notice-box strong{
    font-size:13px;
  }
  .page-start .primary-start{
    height:54px;
    font-size:20px;
    margin-top:14px;
  }
  .page-start .app-footer{
    padding:10px 12px 18px;
  }

  /* Header: no horizontal overflow, compact two-tier layout */
  .page-form .form-header-v3{
    grid-template-columns:minmax(0,1fr) auto;
    grid-template-areas:"hospital service" "steps steps";
    gap:8px;
    padding:calc(8px + env(safe-area-inset-top)) 10px 8px;
    border-bottom:1px solid rgba(120,164,205,.22);
  }
  .page-form .form-header-v3 .form-hospital-logo{
    height:36px;
    max-width:100%;
  }
  .page-form .form-touchde-logo{
    width:108px;
    max-width:108px;
    height:auto;
  }
  .page-form .header-progress{
    display:grid;
    grid-template-columns:repeat(6,minmax(0,1fr));
    gap:5px;
    width:100%;
  }
  .page-form .header-progress .progress-dot{
    height:42px;
    border-radius:12px;
    padding:3px 2px;
    border-width:2px;
  }
  .page-form .header-progress .progress-dot span{
    font-size:14px;
    line-height:1;
  }
  .page-form .header-progress .progress-dot b{
    font-size:10px;
    line-height:1.05;
  }

  .page-form .question-shell{
    padding:8px 10px 14px;
    min-height:calc(100svh - 116px);
  }
  .page-form .page-heading{
    margin-bottom:10px;
  }
  .page-form .page-no{
    font-size:12px;
    margin-bottom:3px;
  }
  .page-form .page-heading h1{
    font-size:22px;
    line-height:1.15;
    letter-spacing:-.02em;
  }
  .page-form .page-heading p:not(.page-no){
    font-size:13px;
    line-height:1.45;
    margin-top:5px;
  }

  .page-form .card-grid,
  .page-form .history-list,
  .page-form .detail-layout,
  .page-form .qr-stack{
    gap:8px;
  }
  .page-form .input-card,
  .page-form .history-card,
  .page-form .qr-card{
    padding:11px 12px;
    border-radius:16px;
    gap:7px;
    box-shadow:0 6px 16px rgba(29,80,130,.045);
  }
  .page-form .input-card span,
  .page-form .history-card h2,
  .page-form .schema-title{
    font-size:15px;
  }
  .page-form input,
  .page-form textarea,
  .page-form select{
    font-size:16px;
    min-height:44px;
    padding:10px 11px;
    border-radius:12px;
    border-width:2px;
  }
  .page-form textarea{
    min-height:72px;
  }
  .page-form .segmented b{
    height:42px;
    font-size:16px;
  }

  .page-form .patient-no-card{
    border-width:2px;
  }
  .page-form .unknown-btn{
    height:42px;
    font-size:15px;
  }
  .page-form .patient-no-card small{
    display:none;
  }

  /* Symptoms: two columns but avoid cramped long labels */
  .page-form .symptom-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:7px;
  }
  .page-form .check-tile span{
    min-height:46px;
    height:auto;
    font-size:13px;
    line-height:1.25;
    padding:8px 9px;
    border-radius:13px;
  }
  .page-form .check-tile span:before{
    width:16px;
    height:16px;
    min-width:16px;
    margin-right:7px;
  }

  /* Detail and history cards */
  .page-form .detail-row,
  .page-form .history-list{
    gap:8px;
  }
  .page-form .body-checks label,
  .page-form .mini-grid label{
    min-height:38px;
    font-size:13px;
    padding:8px 9px;
  }
  .page-form .history-card textarea{
    min-height:56px;
  }

  /* Schema mobile */
  .page-form .schema-panel{
    padding:10px;
    border-radius:16px;
  }
  .page-form .schema-view-selector{
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:6px;
    margin-bottom:8px;
  }
  .page-form .schema-view-btn{
    min-height:36px;
    padding:6px 5px;
  }
  .page-form .schema-view-btn span{
    font-size:12px;
  }
  .page-form .schema-touch-card,
  .page-form .schema-detail-panel{
    padding:10px;
    border-radius:14px;
  }
  .page-form .schema-hit-canvas-wrap{
    min-height:205px;
  }
  .page-form #schemaCanvas{
    max-height:260px;
  }
  .page-form .schema-help{
    font-size:11px;
    margin-top:6px;
  }
  .page-form .schema-selected-top{
    margin-bottom:6px;
    padding-bottom:6px;
  }
  .page-form .selected-part{
    font-size:13px;
    line-height:1.35;
  }
  .page-form .schema-symptom-types{
    gap:5px;
    margin-bottom:7px;
  }
  .page-form .type-btn{
    min-height:30px;
    font-size:12px;
    padding:5px 8px;
  }
  .page-form .slider-header{
    margin:3px 0 5px;
  }
  .page-form #schemaIntensity::-webkit-slider-thumb{
    width:24px;
    height:24px;
  }
  .page-form .schema-note-card-inline textarea{
    min-height:50px;
  }
  .page-form .schema-entry-list-card{
    padding-top:8px;
  }

  /* Confirmation QR */
  .page-form .qr-card{
    padding:12px;
  }
  .page-form .qr-card-head{
    margin-bottom:8px;
  }
  .page-form .qr-card-head h2{
    font-size:18px;
  }
  .page-form .qr-card canvas{
    width:190px;
    height:190px;
    margin-bottom:10px;
  }
  .page-form .qr-card textarea{
    min-height:130px;
    font-size:13px;
  }

  .page-form .fixed-actions{
    grid-template-columns:96px 1fr;
    gap:8px;
    margin:12px 0 8px;
  }
  .page-form .fixed-actions-right{
    gap:8px;
  }
  .page-form .nav-btn,
  .page-form .save-screen-btn{
    height:46px;
    font-size:15px;
    border-radius:13px;
  }
}

/* Very narrow iPhone class */
@media screen and (max-width:390px) and (orientation:portrait){
  .page-start .hospital-logo{max-width:196px}
  .page-start .touchde-logo{width:104px;max-width:104px}
  .page-start .start-visual img{max-height:132px}
  .page-start .start-copy h1{font-size:26px}
  .page-start .lead{font-size:13px}
  .page-start .primary-start{height:50px;font-size:18px}

  .page-form .form-header-v3 .form-hospital-logo{height:32px}
  .page-form .form-touchde-logo{width:96px;max-width:96px}
  .page-form .header-progress{gap:4px}
  .page-form .header-progress .progress-dot{height:39px;border-radius:10px}
  .page-form .header-progress .progress-dot span{font-size:13px}
  .page-form .header-progress .progress-dot b{font-size:9px}
  .page-form .question-shell{padding-left:8px;padding-right:8px}
  .page-form .page-heading h1{font-size:21px}
  .page-form .input-card,
  .page-form .history-card,
  .page-form .qr-card{padding:10px}
  .page-form .symptom-grid{grid-template-columns:1fr}
  .page-form .check-tile span{font-size:14px}
}

/* Tablet portrait: not phone, not desktop. Give it a 2-column mobile-friendly form. */
@media screen and (min-width:601px) and (max-width:899px) and (orientation:portrait){
  .page-start .app-header{
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    gap:18px;
    padding:24px 32px 12px;
  }
  .page-start .hospital-logo{max-width:420px;max-height:64px}
  .page-start .touchde-logo{width:220px;max-width:220px}
  .page-start .start-hero-card{
    margin:16px 34px 0;
    padding:28px 30px;
    display:grid;
    grid-template-columns:1fr;
  }
  .page-start .start-visual img{max-height:330px}
  .page-start .start-copy h1{font-size:54px}
  .page-start .lead{font-size:22px}
  .page-start .notice-box{font-size:17px}
  .page-start .primary-start{height:76px;font-size:28px}

  .page-form .form-header-v3{
    grid-template-columns:minmax(0,1fr) auto;
    grid-template-areas:"hospital service" "steps steps";
    padding:20px 26px 14px;
    gap:14px;
  }
  .page-form .form-header-v3 .form-hospital-logo{height:58px}
  .page-form .form-touchde-logo{width:230px;max-width:230px;height:auto}
  .page-form .header-progress{
    display:grid;
    grid-template-columns:repeat(6,minmax(0,1fr));
    gap:8px;
  }
  .page-form .header-progress .progress-dot{
    width:100%;
    min-width:0;
    height:62px;
    border-radius:18px;
  }
  .page-form .header-progress .progress-dot span{font-size:18px}
  .page-form .header-progress .progress-dot b{font-size:14px}
  .page-form .question-shell{padding:14px 26px 22px}
  .page-form .page-heading h1{font-size:34px}
  .page-form .page-heading p:not(.page-no){font-size:18px}
  .page-form .card-grid.two{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  .page-form .symptom-grid{
    grid-template-columns:repeat(3,minmax(0,1fr));
  }
  .page-form .history-list{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  .page-form .injury-row,
  .page-form .location-row,
  .page-form .main-detail-row{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  .page-form .body-checks,
  .page-form .mini-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
  .page-form .schema-v18-edit-area{
    grid-template-columns:1fr;
  }
}

/* Tablet landscape: keep PC layout but use denser cards and smaller type */
@media screen and (min-width:900px) and (max-width:1366px) and (orientation:landscape){
  .page-form .card-grid.two{
    grid-template-columns:repeat(3,minmax(0,1fr));
  }
  .page-form .patient-no-card{
    grid-column:span 2;
  }
  .page-form .symptom-grid{
    grid-template-columns:repeat(5,minmax(0,1fr));
  }
  .page-form .check-tile span{
    min-height:40px;
    height:auto;
    line-height:1.2;
    padding-top:7px;
    padding-bottom:7px;
  }
  .page-form .history-list{
    grid-template-columns:repeat(3,minmax(0,1fr));
  }
  .page-form .schema-v18-edit-area{
    grid-template-columns:minmax(420px,1fr) minmax(310px,.86fr);
  }
  .page-form .schema-hit-canvas-wrap{
    min-height:250px;
  }
  .page-form .schema-note-card-inline textarea{
    min-height:38px;
  }
  .page-form .schema-entry-list{
    max-height:140px;
    overflow:auto;
  }
}


/* v31: schema QR is not displayed. Schema registration is included in the interview QR. */
.schema-qr-card{display:none!important}


/* v32: QR display fix and smartphone 3-button action row */
.schema-qr-card{display:none!important}

@media screen and (max-width:600px) and (orientation:portrait){
  .page-form .fixed-actions{
    display:flex!important;
    flex-direction:row!important;
    align-items:stretch!important;
    justify-content:space-between!important;
    gap:6px!important;
    margin:12px 0 8px!important;
    height:auto!important;
  }
  .page-form .fixed-actions > .nav-btn{
    flex:1 1 0!important;
  }
  .page-form .fixed-actions-right{
    display:flex!important;
    flex-direction:row!important;
    gap:6px!important;
    flex:2 1 0!important;
    min-width:0!important;
  }
  .page-form .fixed-actions-right .nav-btn{
    flex:1 1 0!important;
  }
  .page-form .nav-btn,
  .page-form .save-screen-btn{
    width:auto!important;
    min-width:0!important;
    height:44px!important;
    padding:0 4px!important;
    font-size:13px!important;
    border-radius:12px!important;
    white-space:nowrap!important;
  }
}

@media screen and (max-width:390px) and (orientation:portrait){
  .page-form .fixed-actions,
  .page-form .fixed-actions-right{
    gap:4px!important;
  }
  .page-form .nav-btn,
  .page-form .save-screen-btn{
    height:42px!important;
    font-size:12px!important;
    padding:0 3px!important;
  }
}


/* v33: user-friendly schema registration modal */
.schema-entry-editor > .section-title,
.schema-entry-editor > .schema-symptom-types,
.schema-entry-editor > .slider-header,
.schema-entry-editor > #schemaIntensity,
.schema-entry-editor > .slider-labels,
.schema-entry-editor > .schema-note-card-inline,
.schema-entry-editor > .schema-entry-actions{
  display:none!important;
}
.schema-help::after{
  content:" 画像をタップすると登録画面が開きます。";
  font-weight:900;
  color:var(--blue);
}
.schema-entry-modal{
  width:min(760px,94vw);
}
.schema-modal-selected{
  margin:14px 0 18px;
  padding:14px 16px;
  border-radius:16px;
  background:linear-gradient(180deg,#f8fcff,#edf7ff);
  border:1px solid #cfe4f8;
  color:#0d3478;
  font-size:20px;
  font-weight:900;
}
.schema-modal-fields{
  gap:18px;
}
.schema-modal-fields .modal-field label small{
  font-size:14px;
  color:#64748b;
}
.schema-modal-types{
  display:grid;
  grid-template-columns:repeat(5,minmax(0,1fr));
  gap:10px;
}
.schema-modal-types label{
  display:block;
}
.schema-modal-types input{
  position:absolute;
  opacity:0;
  pointer-events:none;
}
.schema-modal-types span{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:52px;
  border:2px solid #d7e8f8;
  border-radius:999px;
  background:#fff;
  color:var(--blue);
  font-size:18px;
  font-weight:900;
}
.schema-modal-types input:checked + span{
  background:linear-gradient(135deg,var(--blue),#0c8ddf);
  border-color:var(--blue);
  color:#fff;
}
.schema-modal-range-field input[type=range]{
  padding:0;
  border:0;
}
.schema-modal-range-field label{
  display:flex;
  justify-content:space-between;
  align-items:center;
}
.schema-modal-range-field strong{
  color:var(--blue);
}
#schemaModalMemo{
  min-height:110px;
}
.schema-modal-actions{
  display:grid;
  grid-template-columns:1fr auto;
  gap:12px;
}
.schema-modal-actions .secondary-btn{
  width:100%;
}
.schema-modal-delete{
  background:linear-gradient(135deg,#b91c1c,#ef4444);
}
@media screen and (max-width:600px) and (orientation:portrait){
  .schema-entry-modal{
    width:calc(100vw - 22px);
    padding:22px 14px 16px;
    border-radius:22px;
  }
  .schema-entry-modal h2{
    font-size:24px;
  }
  .schema-entry-modal p{
    font-size:13px;
    line-height:1.45;
  }
  .schema-modal-selected{
    font-size:15px;
    padding:10px 12px;
    margin:10px 0 12px;
    border-radius:13px;
  }
  .schema-modal-types{
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:8px;
  }
  .schema-modal-types span{
    min-height:42px;
    font-size:15px;
  }
  #schemaModalMemo{
    min-height:82px;
    font-size:16px;
  }
  .schema-modal-actions{
    grid-template-columns:1fr;
    gap:8px;
  }
  .schema-modal-actions .secondary-btn{
    height:48px;
    font-size:17px;
    padding:0 12px;
  }
}


/* v34: Step 2 other symptom checkbox and compact symptom layout */
.symptom-other-memo[hidden],
.symptom-other-memo.is-hidden{
  display:none!important;
}
.symptom-other-block{
  max-width:1660px;
  margin:0 auto;
  display:grid;
  grid-template-columns:minmax(180px,260px) 1fr;
  gap:14px;
  align-items:stretch;
}
.symptom-other-block .symptom-other-check span{
  height:72px;
}
.symptom-other-block .symptom-other-memo{
  margin:0;
}
.symptom-other-block .symptom-other-memo textarea{
  min-height:72px;
}

@media screen and (max-width:600px) and (orientation:portrait){
  .page-form .question-page[data-page="1"]{
    padding-top:2px;
  }
  .page-form .question-page[data-page="1"] .page-heading{
    margin-bottom:6px;
  }
  .page-form .question-page[data-page="1"] .page-no{
    font-size:11px;
    margin-bottom:2px;
  }
  .page-form .question-page[data-page="1"] .page-heading h1{
    font-size:18px;
    line-height:1.12;
  }
  .page-form .question-page[data-page="1"] .page-heading p:not(.page-no){
    display:none;
  }
  .page-form .question-page[data-page="1"] .symptom-grid{
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:5px!important;
    margin-bottom:6px!important;
  }
  .page-form .question-page[data-page="1"] .check-tile span{
    min-height:34px!important;
    height:auto!important;
    padding:5px 6px!important;
    border-radius:10px!important;
    font-size:11px!important;
    line-height:1.16!important;
    letter-spacing:-.03em;
  }
  .page-form .question-page[data-page="1"] .check-tile span:before{
    width:13px!important;
    height:13px!important;
    min-width:13px!important;
    margin-right:4px!important;
    border-radius:4px!important;
    border-width:2px!important;
  }
  .page-form .question-page[data-page="1"] .symptom-other-block{
    grid-template-columns:1fr;
    gap:6px;
  }
  .page-form .question-page[data-page="1"] .symptom-other-block .symptom-other-check span{
    min-height:34px!important;
    height:auto!important;
    justify-content:center;
  }
  .page-form .question-page[data-page="1"] .symptom-other-memo{
    padding:9px 10px!important;
    border-radius:13px!important;
  }
  .page-form .question-page[data-page="1"] .symptom-other-memo span{
    font-size:13px!important;
  }
  .page-form .question-page[data-page="1"] .symptom-other-memo textarea{
    min-height:48px!important;
    font-size:16px!important;
    padding:8px 9px!important;
  }
  .page-form .question-page[data-page="1"] + .fixed-actions,
  .page-form .fixed-actions{
    margin-top:10px;
  }
}

@media screen and (max-width:390px) and (orientation:portrait){
  .page-form .question-page[data-page="1"] .symptom-grid{
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:4px!important;
  }
  .page-form .question-page[data-page="1"] .check-tile span{
    min-height:32px!important;
    padding:4px 5px!important;
    font-size:10px!important;
  }
  .page-form .question-page[data-page="1"] .check-tile span:before{
    width:12px!important;
    height:12px!important;
    min-width:12px!important;
    margin-right:3px!important;
  }
}

/* Tablet / compact landscape: keep Step 2 short enough to see the bottom buttons */
@media screen and (min-width:601px) and (max-width:1366px){
  .page-form .question-page[data-page="1"] .page-heading{
    margin-bottom:8px;
  }
  .page-form .question-page[data-page="1"] .page-heading p:not(.page-no){
    display:none;
  }
  .page-form .question-page[data-page="1"] .symptom-grid{
    grid-template-columns:repeat(5,minmax(0,1fr));
    gap:8px;
    margin-bottom:8px;
  }
  .page-form .question-page[data-page="1"] .check-tile span{
    min-height:42px;
    height:auto;
    padding:7px 9px;
    font-size:14px;
    line-height:1.18;
    border-radius:13px;
  }
  .page-form .question-page[data-page="1"] .check-tile span:before{
    width:16px;
    height:16px;
    min-width:16px;
    margin-right:6px;
  }
  .symptom-other-block{
    grid-template-columns:minmax(150px,220px) 1fr;
    gap:10px;
  }
  .symptom-other-block .symptom-other-check span,
  .symptom-other-block .symptom-other-memo textarea{
    min-height:54px;
    height:auto;
  }
}


/* v35: birthday and age selection */
.age-card input[readonly]{
  cursor:pointer;
  background:#ffffff;
}
.age-card input[readonly]::placeholder{
  color:#7890a7;
}
.birthday-card input{
  min-height:56px;
}
.age-select-modal{
  width:min(720px,94vw);
}
.age-decade-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:12px;
  margin-top:20px;
}
.age-decade-grid button{
  min-height:64px;
  border:2px solid #d7e8f8;
  border-radius:18px;
  background:linear-gradient(180deg,#ffffff,#f3f9ff);
  color:#0d3478;
  font-size:24px;
  font-weight:900;
}
.age-decade-grid button:active{
  transform:translateY(1px);
}
.age-modal-actions{
  margin-top:18px;
  display:flex;
  justify-content:flex-end;
}
.age-clear-btn{
  width:auto;
  background:linear-gradient(135deg,#64748b,#334155);
}
@media screen and (max-width:600px) and (orientation:portrait){
  .age-decade-grid{
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:8px;
  }
  .age-decade-grid button{
    min-height:48px;
    border-radius:14px;
    font-size:18px;
  }
  .age-select-modal{
    width:calc(100vw - 22px);
    padding:22px 14px 16px;
    border-radius:22px;
  }
  .age-select-modal h2{
    font-size:24px;
  }
  .age-select-modal p{
    font-size:13px;
    line-height:1.45;
  }
  .age-modal-actions{
    display:grid;
    grid-template-columns:1fr;
  }
  .age-clear-btn{
    width:100%;
    height:46px;
    font-size:16px;
  }
}


/* v36: other symptom uses standard detail modal and compact schema page */
.symptom-other-block,
.symptom-other-memo{
  display:none!important;
}
.schema-hit-actions,
#schemaClearBtn{
  display:none!important;
}

/* Compact symptom page so next button is easier to reach */
.question-page[data-page="1"] .page-heading{
  margin-bottom:8px;
}
.question-page[data-page="1"] .page-heading p:not(.page-no){
  margin-top:4px;
}
.question-page[data-page="1"] .symptom-grid{
  gap:10px;
}
.question-page[data-page="1"] .check-tile span{
  min-height:50px;
  height:auto;
  padding-top:8px;
  padding-bottom:8px;
}

/* Compact schema layout */
.question-page[data-page="3"] .page-heading{
  margin-bottom:8px;
}
.question-page[data-page="3"] .schema-panel{
  margin-top:8px;
  padding:12px;
}
.question-page[data-page="3"] .schema-view-selector{
  margin-bottom:8px;
  gap:8px;
}
.question-page[data-page="3"] .schema-view-btn{
  min-height:40px;
  padding:6px 8px;
}
.question-page[data-page="3"] .schema-view-btn span{
  font-size:16px;
}
.question-page[data-page="3"] .schema-v18-edit-area{
  gap:10px;
}
.question-page[data-page="3"] .schema-touch-card,
.question-page[data-page="3"] .schema-detail-panel{
  padding:10px;
}
.question-page[data-page="3"] .schema-hit-toolbar{
  margin-bottom:6px;
}
.question-page[data-page="3"] .schema-hit-toolbar p{
  margin:2px 0 0;
}
.question-page[data-page="3"] .schema-hit-canvas-wrap{
  min-height:300px;
}
.question-page[data-page="3"] #schemaCanvas{
  max-height:360px;
}
.question-page[data-page="3"] .schema-help{
  margin-top:5px;
  font-size:13px;
  line-height:1.35;
}
.question-page[data-page="3"] .schema-entry-list-card{
  padding-top:8px;
}
.question-page[data-page="3"] .schema-entry-list{
  max-height:150px;
  overflow:auto;
  gap:6px;
}
.question-page[data-page="3"] .schema-entry-empty{
  padding:10px 12px;
  font-size:13px;
}
.question-page[data-page="3"] .schema-entry-item{
  padding:7px;
}
.question-page[data-page="3"] .schema-entry-badge{
  width:32px;
  height:32px;
  font-size:13px;
}
.question-page[data-page="3"] .schema-entry-select{
  grid-template-columns:32px 1fr;
}
.question-page[data-page="3"] .schema-entry-text strong{
  font-size:14px;
}
.question-page[data-page="3"] .schema-entry-text small{
  font-size:11px;
  line-height:1.25;
}

@media screen and (min-width:900px) and (max-width:1366px) and (orientation:landscape){
  .question-page[data-page="3"] .schema-hit-canvas-wrap{min-height:220px}
  .question-page[data-page="3"] #schemaCanvas{max-height:280px}
  .question-page[data-page="3"] .schema-entry-list{max-height:110px}
  .question-page[data-page="3"] .schema-view-btn{min-height:32px}
  .question-page[data-page="3"] .schema-view-btn span{font-size:12px}
}

@media screen and (max-width:600px) and (orientation:portrait){
  .question-page[data-page="1"] .page-heading h1{
    font-size:20px;
  }
  .question-page[data-page="1"] .page-heading p:not(.page-no){
    display:none;
  }
  .question-page[data-page="1"] .symptom-grid{
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:5px;
  }
  .question-page[data-page="1"] .check-tile span{
    min-height:38px;
    font-size:12px;
    line-height:1.15;
    padding:6px 5px;
    border-radius:11px;
  }
  .question-page[data-page="1"] .check-tile span:before{
    width:13px;
    height:13px;
    min-width:13px;
    border-width:2px;
    border-radius:4px;
    margin-right:4px;
  }

  .question-page[data-page="3"] .page-heading h1{
    font-size:20px;
  }
  .question-page[data-page="3"] .page-heading p:not(.page-no){
    display:none;
  }
  .question-page[data-page="3"] .schema-panel{
    padding:8px;
    margin-top:6px;
  }
  .question-page[data-page="3"] .schema-view-selector{
    grid-template-columns:repeat(6,minmax(0,1fr));
    gap:4px;
    margin-bottom:6px;
  }
  .question-page[data-page="3"] .schema-view-btn{
    min-height:32px;
    padding:4px 2px;
    border-width:1px;
  }
  .question-page[data-page="3"] .schema-view-btn span{
    font-size:10px;
  }
  .question-page[data-page="3"] .schema-touch-card,
  .question-page[data-page="3"] .schema-detail-panel{
    padding:8px;
  }
  .question-page[data-page="3"] .schema-hit-toolbar{
    margin-bottom:4px;
  }
  .question-page[data-page="3"] .schema-title{
    font-size:14px;
  }
  .question-page[data-page="3"] .schema-hit-toolbar p{
    font-size:11px;
  }
  .question-page[data-page="3"] .schema-hit-canvas-wrap{
    min-height:178px;
  }
  .question-page[data-page="3"] #schemaCanvas{
    max-height:220px;
  }
  .question-page[data-page="3"] .schema-help{
    font-size:10px;
    margin-top:4px;
  }
  .question-page[data-page="3"] .schema-help::after{
    content:"";
  }
  .question-page[data-page="3"] .selected-part{
    font-size:12px;
  }
  .question-page[data-page="3"] .section-title{
    font-size:12px;
    margin-bottom:5px;
  }
  .question-page[data-page="3"] .schema-entry-list{
    max-height:92px;
    gap:5px;
  }
  .question-page[data-page="3"] .schema-entry-list-card{
    padding-top:6px;
  }
  .question-page[data-page="3"] .schema-entry-empty{
    font-size:11px;
    padding:8px;
  }
  .question-page[data-page="3"] .schema-entry-item{
    padding:5px;
    border-radius:10px;
  }
  .question-page[data-page="3"] .schema-entry-badge{
    width:26px;
    height:26px;
    font-size:11px;
  }
  .question-page[data-page="3"] .schema-entry-select{
    grid-template-columns:26px 1fr;
    gap:6px;
  }
  .question-page[data-page="3"] .schema-entry-text strong{
    font-size:11px;
  }
  .question-page[data-page="3"] .schema-entry-text small{
    font-size:9px;
  }
}

@media screen and (max-width:390px) and (orientation:portrait){
  .question-page[data-page="1"] .symptom-grid{
    gap:4px;
  }
  .question-page[data-page="1"] .check-tile span{
    min-height:36px;
    font-size:11px;
    padding:5px 4px;
  }
  .question-page[data-page="3"] .schema-hit-canvas-wrap{
    min-height:160px;
  }
  .question-page[data-page="3"] #schemaCanvas{
    max-height:200px;
  }
}


/* v37: restore schema image height/aspect so the figure is not vertically crushed */
.page-form .schema-hit-canvas-wrap{
  min-height:300px!important;
}
.page-form #schemaCanvas{
  height:auto!important;
  max-height:420px!important;
  aspect-ratio:auto!important;
}
.page-form .schema-touch-card{
  min-height:auto!important;
}

@media screen and (max-width:600px) and (orientation:portrait){
  .page-form .schema-hit-canvas-wrap{
    min-height:235px!important;
  }
  .page-form #schemaCanvas{
    height:auto!important;
    max-height:310px!important;
    aspect-ratio:auto!important;
  }
  .page-form .schema-touch-card{
    padding:10px!important;
  }
}

@media screen and (max-width:390px) and (orientation:portrait){
  .page-form .schema-hit-canvas-wrap{
    min-height:220px!important;
  }
  .page-form #schemaCanvas{
    max-height:290px!important;
  }
}

@media screen and (min-width:601px) and (max-width:899px) and (orientation:portrait){
  .page-form .schema-hit-canvas-wrap{
    min-height:340px!important;
  }
  .page-form #schemaCanvas{
    max-height:480px!important;
  }
}

@media screen and (min-width:900px) and (orientation:landscape){
  .page-form .schema-hit-canvas-wrap{
    min-height:300px!important;
  }
  .page-form #schemaCanvas{
    max-height:430px!important;
  }
}


/* v38: fix birthday date input overflow in STEP1 */
.page-form .input-card,
.page-form .birthday-card,
.page-form .age-card{
  min-width:0;
  box-sizing:border-box;
}
.page-form .input-card input,
.page-form .input-card select,
.page-form .input-card textarea{
  width:100%;
  max-width:100%;
  min-width:0;
  box-sizing:border-box;
}
.page-form .birthday-card input[type="date"]{
  display:block;
  width:100%;
  max-width:100%;
  min-width:0;
  box-sizing:border-box;
  -webkit-appearance:none;
  appearance:none;
  overflow:hidden;
}

/* iOS/Safari date control tends to reserve inner width. Keep it inside the card. */
.page-form .birthday-card input[type="date"]::-webkit-date-and-time-value{
  min-width:0;
  text-align:left;
}
.page-form .birthday-card input[type="date"]::-webkit-calendar-picker-indicator{
  margin-left:2px;
  padding:0;
}

@media screen and (max-width:600px) and (orientation:portrait){
  .page-form .birthday-card input[type="date"]{
    height:44px!important;
    min-height:44px!important;
    padding:8px 8px!important;
    font-size:15px!important;
    line-height:1.2!important;
  }
  .page-form .birthday-card input[type="date"]::-webkit-date-and-time-value{
    font-size:15px;
  }
  .page-form .birthday-card input[type="date"]::-webkit-calendar-picker-indicator{
    width:18px;
    height:18px;
  }
}

@media screen and (max-width:390px) and (orientation:portrait){
  .page-form .birthday-card input[type="date"]{
    padding-left:7px!important;
    padding-right:6px!important;
    font-size:14px!important;
  }
  .page-form .birthday-card input[type="date"]::-webkit-date-and-time-value{
    font-size:14px;
  }
}


/* v39: relax symptom checkbox spacing on STEP2 */
.page-form .symptom-grid{
  gap:14px!important;
  align-content:start;
}
.page-form .symptom-grid .check-tile{
  min-height:auto!important;
}
.page-form .symptom-grid .check-tile span{
  min-height:72px!important;
  padding:18px 16px!important;
  line-height:1.35!important;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  text-align:center!important;
}

/* Tablet landscape / iPad */
@media screen and (min-width:900px) and (max-width:1366px){
  .page-form .symptom-grid{
    gap:14px!important;
  }
  .page-form .symptom-grid .check-tile span{
    min-height:68px!important;
    padding:16px 14px!important;
    font-size:20px!important;
  }
}

/* Tablet portrait */
@media screen and (min-width:601px) and (max-width:899px), 
       screen and (min-width:768px) and (max-width:1024px) and (orientation:portrait){
  .page-form .symptom-grid{
    gap:12px!important;
  }
  .page-form .symptom-grid .check-tile span{
    min-height:62px!important;
    padding:14px 12px!important;
    font-size:18px!important;
  }
}

/* Smartphone portrait */
@media screen and (max-width:600px) and (orientation:portrait){
  .page-form .symptom-grid{
    gap:10px!important;
  }
  .page-form .symptom-grid .check-tile span{
    min-height:56px!important;
    padding:12px 8px!important;
    font-size:15px!important;
    border-radius:16px!important;
  }
}

/* Very narrow phones */
@media screen and (max-width:390px) and (orientation:portrait){
  .page-form .symptom-grid .check-tile span{
    min-height:52px!important;
    padding:10px 7px!important;
    font-size:14px!important;
  }
}


/* v40: STEP3 body-part checkboxes back to left-aligned single-line style */
.page-form .body-checks{
  align-items:start!important;
  gap:10px 14px!important;
}
.page-form .body-checks label{
  display:flex!important;
  align-items:center!important;
  justify-content:flex-start!important;
  text-align:left!important;
  white-space:nowrap!important;
  line-height:1.2!important;
  padding:6px 0!important;
  font-size:20px!important;
}
.page-form .body-checks input[type="checkbox"]{
  flex:0 0 auto!important;
  margin:0 8px 0 0!important;
}
.page-form .mini-grid label{
  justify-content:flex-start!important;
  text-align:left!important;
}

@media screen and (max-width:899px){
  .page-form .body-checks label{
    font-size:17px!important;
    padding:5px 0!important;
  }
}

@media screen and (max-width:600px) and (orientation:portrait){
  .page-form .body-checks{
    gap:8px 10px!important;
  }
  .page-form .body-checks label{
    font-size:15px!important;
    white-space:nowrap!important;
  }
}

/* v40: show schema image without changing aspect ratio (no flattening) */
.page-form .schema-hit-workspace{
  align-items:start!important;
}
.page-form .schema-hit-canvas-wrap{
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  overflow:hidden!important;
}
.page-form #schemaCanvas{
  display:block!important;
  width:auto!important;
  max-width:100%!important;
  height:auto!important;
  max-height:420px!important;
  aspect-ratio:auto!important;
}

@media screen and (min-width:900px) and (max-width:1366px){
  .page-form #schemaCanvas{
    max-height:400px!important;
  }
}
@media screen and (min-width:601px) and (max-width:899px){
  .page-form #schemaCanvas{
    max-height:430px!important;
  }
}
@media screen and (max-width:600px) and (orientation:portrait){
  .page-form #schemaCanvas{
    max-height:320px!important;
  }
}


/* v41: enlarge STEP4 schema image, especially for iPad Pro where lower space remains */
.page-form .schema-hit-canvas-wrap{
  min-height:500px!important;
}
.page-form #schemaCanvas{
  max-height:520px!important;
}

/* iPad Pro / larger tablets in landscape */
@media screen and (min-width:1024px) and (max-width:1366px) and (orientation:landscape){
  .page-form .schema-hit-canvas-wrap{
    min-height:560px!important;
  }
  .page-form #schemaCanvas{
    max-height:620px!important;
  }
}

/* iPad / tablets portrait */
@media screen and (min-width:768px) and (max-width:1024px) and (orientation:portrait){
  .page-form .schema-hit-canvas-wrap{
    min-height:560px!important;
  }
  .page-form #schemaCanvas{
    max-height:620px!important;
  }
}

/* mid-size tablets */
@media screen and (min-width:601px) and (max-width:899px){
  .page-form .schema-hit-canvas-wrap{
    min-height:500px!important;
  }
  .page-form #schemaCanvas{
    max-height:560px!important;
  }
}

/* smartphone portrait: keep current usable compact size */
@media screen and (max-width:600px) and (orientation:portrait){
  .page-form .schema-hit-canvas-wrap{
    min-height:235px!important;
  }
  .page-form #schemaCanvas{
    max-height:320px!important;
  }
}


/* v42: STEP2 symptom checkboxes left aligned and visually unified as list rows */
.page-form .symptom-grid .check-tile span{
  justify-content:flex-start!important;
  align-items:center!important;
  text-align:left!important;
  line-height:1.25!important;
  padding:0 20px!important;
}
.page-form .symptom-grid .check-tile span:before{
  flex:0 0 28px!important;
  margin-right:14px!important;
}
.page-form .symptom-grid .check-tile{
  width:100%!important;
}

/* keep grid but make every cell look like the same left-aligned checkbox row */
@media screen and (min-width:900px){
  .page-form .symptom-grid{
    grid-template-columns:repeat(4,minmax(0,1fr))!important;
  }
}
@media screen and (min-width:601px) and (max-width:899px){
  .page-form .symptom-grid{
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
  }
  .page-form .symptom-grid .check-tile span{
    font-size:18px!important;
    min-height:62px!important;
  }
}
@media screen and (max-width:600px){
  .page-form .symptom-grid{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
  .page-form .symptom-grid .check-tile span{
    font-size:15px!important;
    min-height:56px!important;
    padding:0 12px!important;
  }
  .page-form .symptom-grid .check-tile span:before{
    width:22px!important;
    height:22px!important;
    margin-right:10px!important;
  }
}

/* v42: STEP4 selector text tweak for new labels */
.page-form .schema-view-btn span{
  white-space:nowrap!important;
}


/* v43: STEP3 body checks layout fix */
.page-form .body-checks{
  display:grid!important;
  align-items:start!important;
  gap:12px 14px!important;
}
.page-form .body-checks label{
  display:flex!important;
  flex-direction:row!important;
  align-items:center!important;
  justify-content:flex-start!important;
  gap:10px!important;
  min-height:58px!important;
  padding:14px 16px!important;
  text-align:left!important;
  line-height:1.25!important;
  white-space:nowrap!important;
  overflow:hidden!important;
}
.page-form .body-checks input[type="checkbox"]{
  appearance:auto!important;
  -webkit-appearance:checkbox!important;
  width:22px!important;
  min-width:22px!important;
  max-width:22px!important;
  height:22px!important;
  min-height:22px!important;
  max-height:22px!important;
  flex:0 0 22px!important;
  margin:0!important;
  padding:0!important;
  border:0!important;
  border-radius:0!important;
  box-shadow:none!important;
  background:transparent!important;
}

@media screen and (max-width:899px){
  .page-form .body-checks label{
    min-height:52px!important;
    padding:11px 13px!important;
    font-size:16px!important;
  }
  .page-form .body-checks input[type="checkbox"]{
    width:18px!important;
    min-width:18px!important;
    max-width:18px!important;
    height:18px!important;
    min-height:18px!important;
    max-height:18px!important;
    flex-basis:18px!important;
  }
}

/* v43: TOP hero card should blend into page background */
.start-hero-card{
  border-color:transparent!important;
  background:transparent!important;
  box-shadow:none!important;
}
.start-hero-card:before{
  opacity:.7!important;
}
@media (min-width:900px) and (orientation:landscape){
  .start-frame .start-hero-card{
    background:transparent!important;
  }
}

/* mobile top page also remove visible card feel */
.page-start .start-hero-card{
  border-color:transparent!important;
  background:transparent!important;
  box-shadow:none!important;
}


/* v44: allergy details only when "ある" is selected */
.allergy-detail-area[hidden],
.allergy-detail-area.is-hidden{
  display:none!important;
}
.allergy-detail-area{
  display:grid;
  gap:12px;
  margin-top:12px;
}
.allergy-help{
  margin:0;
  color:#4b647d;
  font-size:16px;
  font-weight:800;
  line-height:1.45;
}
.allergy-type-grid{
  margin-top:0;
}
.allergy-card textarea[name="allergy_note"]{
  min-height:86px;
}
@media screen and (max-width:600px) and (orientation:portrait){
  .allergy-detail-area{gap:8px;margin-top:8px}
  .allergy-help{font-size:13px}
  .allergy-card textarea[name="allergy_note"]{min-height:62px}
}


/* ==============================
   HNSMHP v45 responsive TOP for iPad / variable tablet sizes
   ============================== */
body.page-start{
  min-height:100svh;
  overflow:hidden;
  background:linear-gradient(135deg,#f8fcff 0%,#e8f5ff 52%,#f9fdff 100%)!important;
}
body.page-start .start-frame,
.page-start .start-frame{
  width:100vw!important;
  max-width:none!important;
  height:100svh!important;
  min-height:100svh!important;
  box-shadow:none!important;
  display:flex!important;
  flex-direction:column!important;
  overflow:hidden!important;
  background:linear-gradient(135deg,#f8fcff 0%,#e8f5ff 52%,#f9fdff 100%)!important;
}
.page-start .app-header{
  flex:0 0 auto!important;
  display:flex!important;
  align-items:center!important;
  justify-content:space-between!important;
  gap:clamp(12px,2vw,32px)!important;
  padding:clamp(18px,3.1vh,34px) clamp(24px,4vw,64px) clamp(8px,1.5vh,18px)!important;
}
.page-start .hospital-logo{
  width:auto!important;
  height:clamp(52px,7.8vh,82px)!important;
  max-width:min(52vw,720px)!important;
  max-height:none!important;
  object-fit:contain!important;
  object-position:left center!important;
}
.page-start .touchde-logo{
  width:auto!important;
  height:clamp(48px,7.5vh,86px)!important;
  max-width:min(36vw,520px)!important;
  max-height:none!important;
  object-fit:contain!important;
  object-position:right center!important;
}
.page-start .start-hero-card{
  flex:1 1 auto!important;
  min-height:0!important;
  height:auto!important;
  max-height:none!important;
  margin:clamp(8px,1.7vh,20px) clamp(24px,4.5vw,72px) 0!important;
  padding:clamp(28px,5.4vh,68px) clamp(30px,4.6vw,70px)!important;
  display:grid!important;
  grid-template-columns:minmax(0,1.02fr) minmax(260px,.98fr)!important;
  align-items:center!important;
  gap:clamp(20px,4vw,60px)!important;
  border-color:transparent!important;
  background:transparent!important;
  box-shadow:none!important;
  border-radius:0!important;
  overflow:hidden!important;
}
.page-start .start-hero-card:before{
  opacity:.65!important;
  inset:-25% 48% 36% -12%!important;
}
.page-start .start-copy{
  min-width:0!important;
}
.page-start .eyebrow{
  font-size:clamp(18px,2.1vw,28px)!important;
  margin:0 0 clamp(10px,1.8vh,18px)!important;
}
.page-start .start-copy h1{
  font-size:clamp(52px,6.3vw,94px)!important;
  line-height:1.04!important;
  letter-spacing:-.04em!important;
}
.page-start .lead{
  font-size:clamp(19px,2.05vw,30px)!important;
  line-height:1.65!important;
  margin:clamp(16px,2.6vh,28px) 0 clamp(18px,3vh,34px)!important;
  max-width:min(56vw,780px)!important;
}
.page-start .notice-box{
  display:flex!important;
  gap:clamp(10px,1.5vw,18px)!important;
  align-items:flex-start!important;
  max-width:min(58vw,780px)!important;
  padding:clamp(14px,2.2vh,22px) clamp(16px,2.4vw,26px)!important;
  font-size:clamp(16px,1.55vw,22px)!important;
  line-height:1.55!important;
}
.page-start .primary-start{
  width:clamp(300px,24vw,420px)!important;
  height:clamp(70px,9vh,96px)!important;
  margin-top:clamp(22px,3.7vh,38px)!important;
  font-size:clamp(26px,2.5vw,34px)!important;
}
.page-start .start-visual{
  min-width:0!important;
  text-align:center!important;
}
.page-start .start-visual img{
  width:100%!important;
  max-width:min(44vw,720px)!important;
  max-height:min(56svh,620px)!important;
  object-fit:contain!important;
}
.page-start .app-footer{
  flex:0 0 auto!important;
  padding:clamp(8px,1.7vh,22px) clamp(24px,4vw,60px) clamp(16px,2.4vh,26px)!important;
  gap:clamp(8px,1.3vw,18px)!important;
  justify-content:flex-end!important;
}
.page-start .app-footer img{
  height:clamp(18px,2.7vh,26px)!important;
  max-width:min(28vw,260px)!important;
}

@media (min-width:900px) and (orientation:landscape){
  body.page-start{
    display:block!important;
    align-items:initial!important;
    justify-content:initial!important;
    overflow:hidden!important;
  }
  body.page-start .app-frame{
    width:100vw!important;
    height:100svh!important;
    min-height:100svh!important;
    max-width:none!important;
  }
}

/* iPad mini / Air / Pro portrait: use vertical composition and fill height naturally */
@media screen and (min-width:600px) and (orientation:portrait){
  body.page-start{overflow:hidden!important;}
  .page-start .app-header{
    padding:clamp(22px,3.2vh,34px) clamp(28px,5vw,54px) clamp(8px,1.2vh,14px)!important;
  }
  .page-start .hospital-logo{
    height:clamp(54px,7.4vh,76px)!important;
    max-width:min(58vw,620px)!important;
  }
  .page-start .touchde-logo{
    height:clamp(46px,6.6vh,68px)!important;
    max-width:min(34vw,360px)!important;
  }
  .page-start .start-hero-card{
    grid-template-columns:1fr!important;
    grid-template-rows:auto 1fr!important;
    gap:clamp(12px,2.4vh,26px)!important;
    margin:clamp(10px,1.4vh,18px) clamp(28px,5vw,56px) 0!important;
    padding:clamp(18px,3vh,34px) clamp(30px,5vw,58px)!important;
    text-align:left!important;
  }
  .page-start .start-visual{
    order:-1!important;
    text-align:center!important;
  }
  .page-start .start-visual img{
    max-width:min(82vw,680px)!important;
    max-height:clamp(240px,32svh,420px)!important;
  }
  .page-start .start-copy h1{
    font-size:clamp(54px,8.2vw,82px)!important;
  }
  .page-start .lead{
    font-size:clamp(20px,2.75vw,26px)!important;
    max-width:100%!important;
    margin:clamp(14px,2vh,22px) 0 clamp(14px,2.2vh,24px)!important;
  }
  .page-start .notice-box{
    max-width:100%!important;
    font-size:clamp(16px,2.05vw,20px)!important;
  }
  .page-start .primary-start{
    width:min(100%,420px)!important;
    height:clamp(68px,8.2vh,86px)!important;
  }
  .page-start .app-footer{
    justify-content:flex-end!important;
    padding:clamp(8px,1.2vh,16px) clamp(28px,5vw,56px) clamp(18px,2.5vh,30px)!important;
  }
}

/* iPad mini portrait and narrow tablets: compress gently, keep full-screen */
@media screen and (min-width:600px) and (max-width:820px) and (orientation:portrait){
  .page-start .start-hero-card{
    margin-left:24px!important;
    margin-right:24px!important;
    padding-left:28px!important;
    padding-right:28px!important;
  }
  .page-start .start-copy h1{
    font-size:clamp(48px,8.6vw,64px)!important;
  }
  .page-start .start-visual img{
    max-height:clamp(220px,30svh,340px)!important;
  }
  .page-start .notice-box{
    display:block!important;
  }
  .page-start .notice-box strong{
    display:block!important;
    margin-bottom:6px!important;
  }
}

/* phones stay compact and scroll-safe */
@media screen and (max-width:599px){
  body.page-start{overflow:auto!important;}
  body.page-start .start-frame,
  .page-start .start-frame{
    height:auto!important;
    min-height:100svh!important;
    overflow:visible!important;
  }
}


/* v46: history popup controls */
.history-popup-area{
  display:grid;
  gap:10px;
  margin-top:12px;
}
.history-popup-area[hidden],
.history-popup-area.is-hidden{display:none!important}
.history-popup-btn{
  width:100%;
  min-height:48px;
  border:2px solid #cfe4f8;
  border-radius:14px;
  background:linear-gradient(180deg,#fff,#f2f9ff);
  color:var(--blue);
  font-size:18px;
  font-weight:900;
}
.history-summary{
  min-height:42px;
  border:1px solid #dbe8f6;
  background:#f8fcff;
  border-radius:12px;
  padding:10px 12px;
  font-size:15px;
  font-weight:800;
  color:#285982;
  line-height:1.45;
}
.history-modal{
  width:min(760px,94vw);
}
.history-check-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:10px;
}
.history-check-grid label{
  display:block;
}
.history-check-grid input{
  position:absolute;
  opacity:0;
  pointer-events:none;
}
.history-check-grid span{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:48px;
  border:2px solid #d7e8f8;
  border-radius:999px;
  background:#fff;
  color:var(--blue);
  font-size:16px;
  font-weight:900;
}
.history-check-grid input:checked + span{
  background:linear-gradient(135deg,var(--blue),#0c8ddf);
  border-color:var(--blue);
  color:#fff;
}
.relation-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:12px;
  margin-top:18px;
}
.relation-grid button{
  min-height:58px;
  border:2px solid #d7e8f8;
  border-radius:16px;
  background:#fff;
  color:#0d3478;
  font-size:20px;
  font-weight:900;
}
.temperature-select-row{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
}
.temperature-select-row select{
  min-height:52px;
}

@media screen and (max-width:600px) and (orientation:portrait){
  .history-check-grid,
  .relation-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:8px;
  }
  .history-check-grid span,
  .relation-grid button{
    min-height:42px;
    font-size:15px;
  }
  .history-popup-btn{
    min-height:44px;
    font-size:16px;
  }
  .history-summary{
    font-size:13px;
    padding:8px 10px;
  }
  .temperature-select-row{
    grid-template-columns:1fr 1fr;
    gap:8px;
  }
}


/* v47: admin login modal footer version display */
.admin-version-footer{
  margin-top:18px;
  padding-top:14px;
  border-top:1px solid #dbe8f6;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:12px;
  color:#64748b;
  font-size:15px;
  font-weight:900;
}
.admin-version-footer img{
  width:150px;
  max-width:45%;
  height:auto;
  object-fit:contain;
}
.admin-version-footer span{
  white-space:nowrap;
}
@media screen and (max-width:600px) and (orientation:portrait){
  .admin-version-footer{
    margin-top:14px;
    gap:8px;
    font-size:13px;
  }
  .admin-version-footer img{
    width:124px;
  }
}


/* v48: allergy summary instead of register button, and STEP2 detail summaries */
.history-summary-clickable{
  cursor:pointer;
}
.history-summary-clickable:after{
  content:"（タップで編集）";
  margin-left:.5em;
  color:var(--blue);
  font-size:.9em;
}
.allergy-card .history-popup-area{
  margin-top:10px;
}

.check-tile .symptom-detail-summary{
  margin-top:8px;
  padding:8px 10px;
  border:1px solid #dbe8f6;
  border-radius:12px;
  background:#f8fcff;
  color:#285982;
  font-size:13px;
  font-weight:800;
  line-height:1.35;
  text-align:left;
  overflow:hidden;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
}
@media screen and (min-width:900px){
  .check-tile .symptom-detail-summary{
    font-size:15px;
    padding:10px 12px;
  }
}
@media screen and (max-width:600px){
  .check-tile .symptom-detail-summary{
    font-size:12px;
    padding:7px 8px;
    -webkit-line-clamp:2;
  }
}


/* v49: surgery history age/part selectable */
.surgery-other-part-field[hidden],
.surgery-other-part-field.is-hidden{
  display:none!important;
}
.history-modal select{
  min-height:52px;
}
@media screen and (max-width:600px) and (orientation:portrait){
  .history-modal select{
    min-height:46px;
    font-size:16px;
  }
}


/* v50: admin entry moved from Touchde logo to SYSTEMDRIVE footer logo */
.systemdrive-admin-trigger{
  appearance:none;
  border:0;
  background:transparent;
  padding:0;
  margin:0;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
}
.systemdrive-admin-trigger img{
  display:block;
}
.systemdrive-admin-trigger:focus-visible{
  outline:4px solid rgba(27,98,201,.24);
  border-radius:10px;
}
.page-start .touchde-logo{
  cursor:default;
}


/* v51: surgery uses summary tap like allergy; family explanatory spacing */
.history-help{
  margin:8px 0 12px;
  color:#64748b;
  font-size:15px;
  font-weight:800;
  line-height:1.55;
}
.family-card .family-disease-grid{
  margin-top:10px;
}
.family-card .history-summary{
  margin-top:12px;
}
.surgery-card .history-summary-clickable{
  cursor:pointer;
}
@media screen and (max-width:600px) and (orientation:portrait){
  .history-help{
    margin:6px 0 10px;
    font-size:13px;
  }
  .family-card .family-disease-grid{
    margin-top:8px;
  }
  .family-card .history-summary{
    margin-top:10px;
  }
}


/* v52: top page start content centered, remove hospital eyebrow */
.page-start .start-hero-card-centered{
  margin:20px 72px 0;
  min-height:760px;
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  position:relative;
  overflow:hidden;
  padding:68px 70px;
}
.page-start .start-hero-card-centered:before{
  content:"";
  position:absolute;
  inset:-15% 10% auto 10%;
  height:52%;
  background:radial-gradient(circle,rgba(32,191,204,.14),transparent 68%);
}
.page-start .start-hero-card-centered .start-copy{
  position:relative;
  z-index:2;
  width:min(100%, 980px);
  margin:0 auto;
  display:flex;
  flex-direction:column;
  align-items:center;
}
.page-start .start-hero-card-centered .start-copy h1{
  font-size:94px;
  line-height:1.04;
  text-align:center;
  margin:0;
}
.page-start .start-hero-card-centered .lead{
  max-width:860px;
  text-align:center;
  margin:26px auto 30px;
}
.page-start .start-hero-card-centered .notice-box{
  max-width:860px;
  text-align:left;
  margin:0 auto;
}
.page-start .start-hero-card-centered .primary-start{
  margin:36px auto 0;
}
.page-start .start-hero-card-centered .start-visual{
  position:absolute;
  right:28px;
  bottom:18px;
  width:min(34vw, 520px);
  pointer-events:none;
  opacity:.28;
  z-index:1;
}
.page-start .start-hero-card-centered .start-visual img{
  width:100%;
  max-height:none;
  object-fit:contain;
  filter:drop-shadow(0 20px 30px rgba(39,94,178,.10));
}
@media (max-width:899px),(orientation:portrait){
  .page-start .start-hero-card-centered{
    min-height:calc(100svh - 180px);
    margin:10px 14px 0;
    padding:28px 20px;
    justify-content:center;
  }
  .page-start .start-hero-card-centered .start-copy{
    width:100%;
  }
  .page-start .start-hero-card-centered .start-copy h1{
    font-size:44px;
  }
  .page-start .start-hero-card-centered .lead{
    font-size:18px;
    margin:12px auto 16px;
  }
  .page-start .start-hero-card-centered .notice-box{
    max-width:100%;
  }
  .page-start .start-hero-card-centered .start-visual{
    position:static;
    order:-1;
    width:min(100%, 360px);
    opacity:1;
    margin:0 auto 8px;
    text-align:center;
  }
  .page-start .start-hero-card-centered .start-visual img{
    max-height:240px;
  }
}
@media screen and (max-width:600px) and (orientation:portrait){
  .page-start .start-hero-card-centered{
    min-height:calc(100svh - 148px);
    padding:18px 16px 20px;
    gap:12px;
  }
  .page-start .start-hero-card-centered .start-visual{
    width:min(100%, 250px);
    margin:0 auto 4px;
  }
  .page-start .start-hero-card-centered .start-copy h1{
    font-size:30px;
    line-height:1.12;
  }
  .page-start .start-hero-card-centered .lead{
    font-size:16px;
    line-height:1.55;
    margin:10px auto 14px;
  }
  .page-start .start-hero-card-centered .primary-start{
    margin-top:18px;
  }
}


/* v53: family history popup unified and README restoration */
.family-card .history-popup-area{
  margin-top:10px;
}
.family-history-modal{
  width:min(1040px,96vw);
}
.family-modal-fields{
  gap:14px;
}
.family-modal-row{
  display:grid;
  grid-template-columns:minmax(220px, 1fr) minmax(220px, 300px);
  gap:14px;
  align-items:center;
  padding:14px 16px;
  border:1px solid #dbe8f6;
  border-radius:18px;
  background:#f8fbff;
}
.family-modal-check{
  display:flex;
  align-items:center;
  gap:12px;
  margin:0;
  font-size:22px;
  font-weight:900;
  color:#12386e;
}
.family-modal-check input[type=checkbox]{
  width:24px;
  height:24px;
}
.family-modal-check span{
  display:inline-block;
}
.family-modal-relation{
  min-height:54px;
}
@media screen and (max-width:899px),(orientation:portrait){
  .family-modal-row{
    grid-template-columns:1fr;
    gap:10px;
    padding:12px 14px;
  }
  .family-modal-check{
    font-size:18px;
  }
  .family-modal-relation{
    min-height:48px;
    font-size:16px;
  }
}


/* v54: top page keep 2-column hero, center CTA below, plain inline note */
.page-start .start-hero-card-split{
  margin:20px 72px 0;
  min-height:760px;
  display:grid;
  grid-template-columns:minmax(0,1.02fr) minmax(320px,.98fr);
  grid-template-rows:auto auto;
  align-items:center;
  justify-items:stretch;
  column-gap:40px;
  row-gap:26px;
  padding:58px 64px 48px;
  text-align:left;
}
.page-start .start-hero-card-split:before{
  inset:-18% 8% auto 8%;
  height:48%;
}
.page-start .start-hero-card-split .start-copy{
  width:100%;
  max-width:none;
  margin:0;
  display:block;
  align-items:initial;
  text-align:left;
}
.page-start .start-hero-card-split .start-copy h1{
  text-align:left;
  font-size:88px;
}
.page-start .start-hero-card-split .lead{
  max-width:820px;
  text-align:left;
  margin:24px 0 0;
}
.page-start .start-hero-card-split .start-visual{
  position:relative;
  right:auto;
  bottom:auto;
  width:100%;
  opacity:1;
  text-align:center;
  pointer-events:auto;
}
.page-start .start-hero-card-split .start-visual img{
  width:100%;
  max-height:460px;
  object-fit:contain;
}
.page-start .start-hero-card-split .start-bottom-cta{
  grid-column:1 / -1;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:14px;
  padding-top:6px;
  text-align:center;
}
.page-start .start-hero-card-split .primary-start{
  margin:0 auto;
}
.page-start .start-hero-card-split .start-inline-note{
  margin:0;
  max-width:980px;
  font-size:20px;
  line-height:1.65;
  color:#4b647d;
  font-weight:700;
}
@media (max-width:1199px){
  .page-start .start-hero-card-split{
    margin:16px 28px 0;
    padding:42px 38px 36px;
    column-gap:28px;
    row-gap:22px;
  }
  .page-start .start-hero-card-split .start-copy h1{font-size:64px;}
  .page-start .start-hero-card-split .lead{font-size:24px;line-height:1.7;}
  .page-start .start-hero-card-split .start-visual img{max-height:380px;}
}
@media (max-width:899px),(orientation:portrait){
  .page-start .start-hero-card-split{
    min-height:calc(100svh - 180px);
    margin:10px 14px 0;
    padding:26px 20px 24px;
    grid-template-columns:1fr;
    grid-template-rows:auto auto auto;
    row-gap:16px;
    text-align:center;
  }
  .page-start .start-hero-card-split .start-copy{
    text-align:center;
  }
  .page-start .start-hero-card-split .start-copy h1{
    font-size:44px;
    text-align:center;
  }
  .page-start .start-hero-card-split .lead{
    font-size:18px;
    line-height:1.6;
    margin:12px auto 0;
    text-align:center;
  }
  .page-start .start-hero-card-split .start-visual{
    order:-1;
    width:min(100%,360px);
    margin:0 auto;
  }
  .page-start .start-hero-card-split .start-visual img{
    max-height:240px;
  }
  .page-start .start-hero-card-split .start-bottom-cta{
    gap:10px;
    padding-top:2px;
  }
  .page-start .start-hero-card-split .start-inline-note{
    max-width:100%;
    font-size:15px;
    line-height:1.6;
  }
}
@media screen and (max-width:600px) and (orientation:portrait){
  .page-start .start-hero-card-split{
    min-height:calc(100svh - 148px);
    padding:18px 16px 20px;
    row-gap:12px;
  }
  .page-start .start-hero-card-split .start-visual{
    width:min(100%,250px);
  }
  .page-start .start-hero-card-split .start-copy h1{
    font-size:30px;
    line-height:1.12;
  }
  .page-start .start-hero-card-split .lead{
    font-size:16px;
    line-height:1.55;
  }
  .page-start .start-hero-card-split .primary-start{
    margin-top:2px;
  }
  .page-start .start-hero-card-split .start-inline-note{
    font-size:13px;
    line-height:1.55;
  }
}


/* v55: keep TOP pre-input note on one line on iPad Pro 11 landscape */
@media screen and (min-width:900px) and (orientation:landscape){
  .page-start .start-hero-card-split .start-bottom-cta{
    width:min(1120px, calc(100vw - 96px));
    max-width:none;
    justify-self:center;
  }
  .page-start .start-hero-card-split .start-inline-note{
    width:100%;
    max-width:none;
    white-space:nowrap;
    font-size:16px;
    line-height:1.5;
    letter-spacing:-.01em;
  }
}

/* Keep smaller portrait / phone layouts readable even if they need to wrap */
@media screen and (max-width:899px), screen and (orientation:portrait){
  .page-start .start-hero-card-split .start-inline-note{
    white-space:normal;
  }
}


/* v57: remove TOP note; keep CTA centered without extra gap */
.page-start .start-hero-card-split .start-bottom-cta{
  gap:0;
}


/* v58: non-native confirm dialog and Safari toolbar collapse support */
html, body{
  min-height:calc(100svh + 2px);
}
body.page-start{
  min-height:calc(100svh + 2px)!important;
  overflow-y:auto!important;
}
.app-confirm-backdrop{
  z-index:120;
}
.app-confirm-modal{
  width:min(720px,92vw);
  text-align:center;
}
.app-confirm-modal h2{
  font-size:34px;
  margin-bottom:14px;
}
.app-confirm-modal p{
  font-size:22px;
  line-height:1.65;
  color:#17324d;
  font-weight:800;
  margin:18px 0 26px;
}
.app-confirm-actions{
  display:flex;
  justify-content:center;
  gap:18px;
  flex-wrap:wrap;
}
.app-confirm-actions .nav-btn{
  position:static;
  min-width:180px;
  height:64px;
}
@media screen and (max-width:600px) and (orientation:portrait){
  .app-confirm-modal{
    padding:26px 20px;
  }
  .app-confirm-modal h2{
    font-size:26px;
  }
  .app-confirm-modal p{
    font-size:17px;
  }
  .app-confirm-actions .nav-btn{
    min-width:132px;
    height:52px;
    font-size:18px;
  }
}


/* v59: app-native notices instead of Safari standard dialogs */
.app-confirm-actions.single{
  justify-content:center;
}
.required-field-highlight{
  outline:4px solid rgba(239,68,68,.35)!important;
  box-shadow:0 0 0 8px rgba(239,68,68,.12)!important;
  border-radius:18px!important;
  transition:outline .18s ease, box-shadow .18s ease;
}


/* v60: prevent right-top Touchde logo from disappearing on iPad/tablet widths */
@media screen and (min-width:900px) and (max-width:1366px) and (orientation:landscape){
  .form-header-v3{
    grid-template-columns:minmax(300px, .33fr) minmax(460px, .47fr) minmax(220px, .20fr)!important;
    gap:12px!important;
    padding:14px 24px!important;
    height:112px!important;
    overflow:visible!important;
  }
  .form-header-v3 .form-hospital-logo{
    max-width:300px!important;
    height:70px!important;
    display:block!important;
    visibility:visible!important;
    opacity:1!important;
  }
  .form-touchde-logo{
    width:100%!important;
    max-width:230px!important;
    height:62px!important;
    display:block!important;
    visibility:visible!important;
    opacity:1!important;
    object-fit:contain!important;
    object-position:right center!important;
  }
  .header-logo-right{
    min-width:220px!important;
    width:220px!important;
    justify-content:flex-end!important;
    display:flex!important;
    visibility:visible!important;
    opacity:1!important;
  }
  .header-progress{
    gap:8px!important;
    overflow:visible!important;
  }
  .header-progress .progress-dot{
    width:70px!important;
    min-width:70px!important;
    height:68px!important;
    border-radius:18px!important;
    font-size:14px!important;
    gap:3px!important;
  }
  .header-progress .progress-dot b{
    font-size:14px!important;
    line-height:1.15!important;
    white-space:nowrap!important;
  }
  .header-progress .progress-dot span{
    font-size:18px!important;
    line-height:1!important;
  }
  .question-shell{
    height:calc(100svh - 112px - 94px)!important;
  }
}

/* Keep the Touchde logo visible on portrait tablets as well */
@media screen and (min-width:600px) and (max-width:1024px) and (orientation:portrait){
  .header-logo-right{
    display:flex!important;
    visibility:visible!important;
    opacity:1!important;
  }
  .form-touchde-logo{
    display:block!important;
    visibility:visible!important;
    opacity:1!important;
    max-width:280px!important;
    height:auto!important;
  }
}

/* ==========================================================================
   HNSMHP Touch de Monshin Final Notes v61
   --------------------------------------------------------------------------
   これまでの主な要望と実装内容をCSS側にも履歴として残す。

   1. TOPページ
      - 病院ロゴは上部表示。重複する青字の病院名テキストは削除。
      - 「外来問診をはじめます」とメイン画像は2列構成を維持。
      - 問診スタートボタンは2列領域の下、画面中央に配置。
      - 「入力前の確認」および補足案内文は最終要望により非表示・削除。
      - iPad Pro/Air/Mini等でも画面いっぱいに見えるよう、100svh/100vwとclamp系の可変指定を併用。

   2. 問診画面ヘッダー
      - 左に病院ロゴ、中央に進捗、右にタッチde問診ロゴ。
      - iPad Pro 11インチ横表示で右上タッチde問診ロゴが消えないよう、
        タブレット横表示専用のgrid幅・ロゴサイズ・進捗ボタン幅を調整。

   3. 既往・症状入力
      - 手術歴・アレルギー・家族歴は「ない/ある」選択と要約タップ編集で操作感を統一。
      - STEP2の追加問診要約は英語キーを出さず、日本語略称で表示。
      - 体温は35〜42度、小数0〜9分の選択式。下部の重複表示は削除。

   4. シェーマ
      - シェーマQRは廃止し、問診QR内の「シェーマ」項目に統合。
      - シェーマ画像は縦横比を維持し、iPad Proでも大きめに表示。
      - 「位置クリア」等、不要な操作は削除。

   5. Safari / iPadOS 対応
      - Safari標準alert/confirm/promptは使わない方針。
      - 標準ダイアログはツールバー非表示を解除しやすいため、アプリ内独自モーダルを使用。
      - モーダル表示時の自動フォーカスを抑制。
      - HTML側にWebアプリ表示メタタグを追加済み。
      - 通常Safariではツールバー非表示を完全固定できないため、
        スクロール補正・標準ダイアログ排除・フォーカス抑制で崩れにくくする。

   6. QR仕様
      - QR内の改行はCR（\r）で統一。
      - 終端制御は全体末尾にのみ TAB + CR。
      - 患者情報QRは QR内部のみ A + 患者番号 + A で始める。
      - 患者番号ラベルは「患者番号」に統一。
      - 患者情報QRは常時表示。問診QRは問診入力またはシェーマ登録がある場合に表示。
   ========================================================================== */

/* v62:
   シェーマ画像ファイルは添付ファイル名どおり以下を利用。
   - schema_01.png 前姿
   - schema_02.png 後姿
   - schema_03.png 顔
   - schema_04.png 右横顔
   - schema_05.png 後頭部
   - schema_06.png 左横顔
   v62では旧シェーマ画像名は利用しない。
*/

/* v63:
   シェーマ画像ファイル名を括弧なしに統一。
   利用ファイル:
   - schema_01.png 前姿
   - schema_02.png 後姿
   - schema_03.png 顔
   - schema_04.png 右横顔
   - schema_05.png 後頭部
   - schema_06.png 左横顔
   括弧付きの重複番号ファイル名は利用しない。
*/


/* v64: smartphone portrait date / calendar controls overflow fix
   - 対象: 生年月日(date)、ぶつけた日時(datetime-local)、将来追加されるtime/month/week等
   - iOS Safari / Android Chrome のネイティブ日付入力は内部幅を大きく確保しやすいため、
     input-card内で確実に収まるよう横幅、min-width、appearance、内側テキストを調整する。
*/
.page-form .input-card input[type="date"],
.page-form .input-card input[type="datetime-local"],
.page-form .input-card input[type="time"],
.page-form .input-card input[type="month"],
.page-form .input-card input[type="week"]{
  display:block!important;
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  box-sizing:border-box!important;
  overflow:hidden!important;
  -webkit-appearance:none;
  appearance:none;
}
.page-form .input-card input[type="date"]::-webkit-date-and-time-value,
.page-form .input-card input[type="datetime-local"]::-webkit-date-and-time-value,
.page-form .input-card input[type="time"]::-webkit-date-and-time-value,
.page-form .input-card input[type="month"]::-webkit-date-and-time-value,
.page-form .input-card input[type="week"]::-webkit-date-and-time-value{
  min-width:0!important;
  max-width:100%!important;
  text-align:left;
}
.page-form .input-card input[type="date"]::-webkit-calendar-picker-indicator,
.page-form .input-card input[type="datetime-local"]::-webkit-calendar-picker-indicator,
.page-form .input-card input[type="time"]::-webkit-calendar-picker-indicator,
.page-form .input-card input[type="month"]::-webkit-calendar-picker-indicator,
.page-form .input-card input[type="week"]::-webkit-calendar-picker-indicator{
  flex:0 0 auto;
  margin-left:2px;
  padding:0;
}
@media screen and (max-width:600px) and (orientation:portrait){
  .page-form .input-card input[type="date"],
  .page-form .input-card input[type="datetime-local"],
  .page-form .input-card input[type="time"],
  .page-form .input-card input[type="month"],
  .page-form .input-card input[type="week"]{
    height:44px!important;
    min-height:44px!important;
    padding:8px 6px!important;
    font-size:14px!important;
    line-height:1.2!important;
  }
  .page-form .input-card input[type="date"]::-webkit-date-and-time-value,
  .page-form .input-card input[type="datetime-local"]::-webkit-date-and-time-value,
  .page-form .input-card input[type="time"]::-webkit-date-and-time-value,
  .page-form .input-card input[type="month"]::-webkit-date-and-time-value,
  .page-form .input-card input[type="week"]::-webkit-date-and-time-value{
    font-size:14px!important;
    line-height:1.2!important;
  }
  .page-form .input-card input[type="date"]::-webkit-calendar-picker-indicator,
  .page-form .input-card input[type="datetime-local"]::-webkit-calendar-picker-indicator,
  .page-form .input-card input[type="time"]::-webkit-calendar-picker-indicator,
  .page-form .input-card input[type="month"]::-webkit-calendar-picker-indicator,
  .page-form .input-card input[type="week"]::-webkit-calendar-picker-indicator{
    width:16px!important;
    height:16px!important;
  }
  .page-form .datetime-card{
    min-width:0!important;
  }
}
@media screen and (max-width:390px) and (orientation:portrait){
  .page-form .input-card input[type="date"],
  .page-form .input-card input[type="datetime-local"],
  .page-form .input-card input[type="time"],
  .page-form .input-card input[type="month"],
  .page-form .input-card input[type="week"]{
    padding-left:5px!important;
    padding-right:4px!important;
    font-size:13px!important;
  }
  .page-form .input-card input[type="date"]::-webkit-date-and-time-value,
  .page-form .input-card input[type="datetime-local"]::-webkit-date-and-time-value,
  .page-form .input-card input[type="time"]::-webkit-date-and-time-value,
  .page-form .input-card input[type="month"]::-webkit-date-and-time-value,
  .page-form .input-card input[type="week"]::-webkit-date-and-time-value{
    font-size:13px!important;
  }
}


/* v65: smartphone portrait TOP balance tuning (reduce heading size, enlarge hero image) */
@media screen and (max-width:600px) and (orientation:portrait){
  .page-start .start-hero-card-split{
    min-height:calc(100svh - 148px);
    padding:18px 18px 22px;
    row-gap:14px;
    align-content:start;
  }
  .page-start .start-hero-card-split .start-copy{
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:flex-start;
    gap:14px;
  }
  .page-start .start-hero-card-split .start-copy h1{
    font-size:26px;
    line-height:1.14;
    letter-spacing:-.02em;
    margin:0;
  }
  .page-start .start-hero-card-split .lead{
    font-size:15px;
    line-height:1.7;
    max-width:18em;
    margin:0 auto;
    text-align:center;
  }
  .page-start .start-hero-card-split .start-visual{
    order:0;
    width:min(100%,300px);
    margin:2px auto 4px;
  }
  .page-start .start-hero-card-split .start-visual img{
    width:100%;
    max-height:220px;
    object-fit:contain;
  }
  .page-start .start-hero-card-split .start-bottom-cta{
    padding-top:8px;
  }
  .page-start .start-hero-card-split .primary-start{
    width:min(100%,596px);
    height:68px;
    font-size:22px;
  }
}


/* v66: split optimization for iPad portrait and smartphone portrait on TOP page */
@media screen and (min-width:601px) and (max-width:1024px) and (orientation:portrait){
  .page-start .start-hero-card-split{
    min-height:calc(100svh - 176px);
    margin:16px 24px 0;
    padding:34px 30px 30px;
    grid-template-columns:minmax(0,1fr) minmax(280px,.92fr);
    grid-template-rows:auto auto;
    column-gap:24px;
    row-gap:18px;
    align-items:center;
    text-align:left;
  }
  .page-start .start-hero-card-split .start-copy{
    display:block;
    text-align:left;
  }
  .page-start .start-hero-card-split .start-copy h1{
    font-size:60px;
    line-height:1.08;
    letter-spacing:-.03em;
    text-align:left;
    margin:0;
  }
  .page-start .start-hero-card-split .lead{
    font-size:21px;
    line-height:1.7;
    max-width:24em;
    margin:18px 0 0;
    text-align:left;
  }
  .page-start .start-hero-card-split .start-visual{
    order:0;
    width:100%;
    max-width:380px;
    margin:0 auto;
    display:block;
    justify-self:center;
    align-self:center;
    text-align:center;
  }
  .page-start .start-hero-card-split .start-visual img{
    display:block;
    width:100%;
    max-height:420px;
    margin:0 auto;
    object-fit:contain;
  }
  .page-start .start-hero-card-split .start-bottom-cta{
    grid-column:1 / -1;
    padding-top:4px;
  }
  .page-start .start-hero-card-split .primary-start{
    width:min(100%,420px);
    height:78px;
    font-size:28px;
  }
}

@media screen and (max-width:600px) and (orientation:portrait){
  .page-start .start-hero-card-split{
    min-height:calc(100svh - 146px);
    margin:10px 12px 0;
    padding:20px 16px 22px;
    row-gap:16px;
    align-content:start;
    text-align:center;
  }
  .page-start .start-hero-card-split .start-copy{
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:flex-start;
    gap:12px;
    text-align:center;
  }
  .page-start .start-hero-card-split .start-copy h1{
    font-size:24px;
    line-height:1.18;
    letter-spacing:-.02em;
    margin:0;
    text-align:center;
  }
  .page-start .start-hero-card-split .lead{
    font-size:14px;
    line-height:1.75;
    max-width:16em;
    margin:0 auto;
    text-align:center;
  }
  .page-start .start-hero-card-split .start-visual{
    order:0;
    width:min(100%,320px);
    margin:0 auto 2px;
    display:block;
    justify-self:center;
    text-align:center;
  }
  .page-start .start-hero-card-split .start-visual img{
    display:block;
    width:100%;
    max-height:260px;
    margin:0 auto;
    object-fit:contain;
  }
  .page-start .start-hero-card-split .start-bottom-cta{
    padding-top:6px;
  }
  .page-start .start-hero-card-split .primary-start{
    width:min(100%,596px);
    height:66px;
    font-size:21px;
  }
}

@media screen and (max-width:390px) and (orientation:portrait){
  .page-start .start-hero-card-split .start-copy h1{
    font-size:22px;
  }
  .page-start .start-hero-card-split .lead{
    font-size:13px;
    max-width:15.5em;
  }
  .page-start .start-hero-card-split .start-visual{
    width:min(100%,290px);
  }
  .page-start .start-hero-card-split .start-visual img{
    max-height:232px;
  }
  .page-start .start-hero-card-split .primary-start{
    height:62px;
    font-size:20px;
  }
}


/* v73: move TOP page header area down by 50px only */
body.page-start .app-header{
  padding-top:calc(50px + env(safe-area-inset-top, 0px))!important;
}


/* v74: all pages except TOP must be top-aligned */
body.page-form .app-frame{
  align-items:stretch!important;
  justify-content:flex-start!important;
}
body.page-form .question-shell{
  display:block!important;
  align-items:flex-start!important;
  justify-content:flex-start!important;
  align-content:flex-start!important;
}
body.page-form .question-page{
  align-items:flex-start!important;
  justify-content:flex-start!important;
  align-content:flex-start!important;
  place-items:start!important;
  padding-top:18px!important;
}
body.page-form .question-page.active{
  display:block!important;
  align-items:flex-start!important;
  justify-content:flex-start!important;
  align-content:flex-start!important;
}
body.page-form .page-heading{
  margin-top:0!important;
  align-self:start!important;
}
body.page-form .card-grid,
body.page-form .symptom-grid,
body.page-form .history-list,
body.page-form .schema-panel,
body.page-form .summary-box,
body.page-form .result-panel{
  align-self:start!important;
  align-items:start!important;
  align-content:start!important;
  margin-top:0;
}
body.page-form .input-card,
body.page-form .history-card{
  align-self:start!important;
}
@media screen and (max-width:899px), screen and (orientation:portrait){
  body.page-form .question-page{
    padding-top:10px!important;
  }
}


/* v75: Touchde logo on TOP opens viewport information popup */
.touchde-viewport-trigger{
  appearance:none;
  border:0;
  background:transparent;
  padding:0;
  margin:0;
  cursor:pointer;
  line-height:0;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
.touchde-viewport-trigger img{
  display:block;
}
.viewport-info-modal{
  width:min(860px,94vw);
}
.viewport-info-output{
  margin:18px 0 0;
  padding:18px;
  border-radius:18px;
  border:1px solid #d7e8f8;
  background:#f8fbff;
  color:#102a43;
  font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size:16px;
  line-height:1.55;
  white-space:pre-wrap;
  word-break:break-word;
  max-height:min(58svh,560px);
  overflow:auto;
  text-align:left;
}


/* v76: iPad landscape layout unification
   Baseline device: iPad Air WebApp landscape = 1373 x 924.
   Larger iPads keep the same content canvas width/height as much as possible,
   so iPad Pro 13 / iPad Pro 11 / iPad Air show nearly the same layout. */
@media screen and (min-width:900px) and (orientation:landscape){
  :root{
    --ipad-air-layout-width:1373px;
    --ipad-air-layout-height:924px;
  }

  body.page-start,
  body.page-form{
    overflow-x:hidden!important;
  }

  body.page-start .app-frame,
  body.page-form .app-frame{
    width:min(100vw, var(--ipad-air-layout-width))!important;
    max-width:var(--ipad-air-layout-width)!important;
    height:min(100dvh, var(--ipad-air-layout-height))!important;
    min-height:min(100svh, var(--ipad-air-layout-height))!important;
    margin-left:auto!important;
    margin-right:auto!important;
    box-sizing:border-box!important;
  }

  body.page-start .start-frame{
    display:grid!important;
    grid-template-rows:auto minmax(0,1fr) auto!important;
    align-content:start!important;
    overflow:hidden!important;
  }

  body.page-start .app-header{
    padding-left:34px!important;
    padding-right:34px!important;
    padding-top:calc(18px + env(safe-area-inset-top, 0px))!important;
    padding-bottom:10px!important;
  }

  body.page-start .hospital-logo{
    max-height:56px!important;
  }

  body.page-start .touchde-logo{
    width:190px!important;
    max-width:190px!important;
    max-height:54px!important;
  }

  body.page-start .start-hero-card-split{
    margin:10px 34px 0!important;
    min-height:0!important;
    height:auto!important;
    max-height:100%!important;
    padding:34px 42px 28px!important;
    grid-template-columns:minmax(0,1.02fr) minmax(300px,.98fr)!important;
    grid-template-rows:minmax(0,1fr) auto!important;
    column-gap:32px!important;
    row-gap:18px!important;
    align-items:center!important;
    overflow:hidden!important;
  }

  body.page-start .start-hero-card-split .start-copy h1{
    font-size:64px!important;
    line-height:1.06!important;
    margin:0!important;
  }

  body.page-start .start-hero-card-split .lead{
    font-size:22px!important;
    line-height:1.65!important;
    margin-top:16px!important;
    max-width:680px!important;
  }

  body.page-start .start-hero-card-split .start-visual img{
    max-height:360px!important;
    width:100%!important;
    object-fit:contain!important;
  }

  body.page-start .start-hero-card-split .primary-start{
    width:360px!important;
    height:72px!important;
    font-size:26px!important;
  }

  body.page-start .app-footer{
    padding:8px 34px 12px!important;
  }

  /* Form pages: freeze the working canvas near the iPad Air size. */
  body.page-form .form-header-v3{
    height:104px!important;
    padding:12px 24px!important;
    grid-template-columns:300px minmax(0,1fr) 220px!important;
    gap:12px!important;
  }

  body.page-form .form-header-v3 .form-hospital-logo{
    max-width:290px!important;
    height:68px!important;
  }

  body.page-form .form-touchde-logo{
    max-width:220px!important;
    height:58px!important;
  }

  body.page-form .header-logo-right{
    min-width:220px!important;
    width:220px!important;
  }

  body.page-form .header-progress{
    gap:8px!important;
  }

  body.page-form .header-progress .progress-dot{
    width:70px!important;
    min-width:70px!important;
    height:66px!important;
    border-radius:18px!important;
  }

  body.page-form .header-progress .progress-dot span{
    font-size:18px!important;
  }

  body.page-form .header-progress .progress-dot b{
    font-size:14px!important;
  }

  body.page-form .question-shell{
    height:calc(min(100dvh, var(--ipad-air-layout-height)) - 104px - 88px)!important;
    min-height:0!important;
    padding-left:30px!important;
    padding-right:30px!important;
    padding-bottom:96px!important;
    box-sizing:border-box!important;
  }

  body.page-form .question-page{
    padding-top:12px!important;
  }

  body.page-form .page-heading{
    max-width:1280px!important;
    margin-bottom:16px!important;
  }

  body.page-form .page-heading h1{
    font-size:40px!important;
    line-height:1.16!important;
  }

  body.page-form .page-heading p:not(.page-no){
    font-size:20px!important;
    margin-top:8px!important;
  }

  body.page-form .card-grid,
  body.page-form .symptom-grid,
  body.page-form .history-list,
  body.page-form .schema-panel,
  body.page-form .summary-box,
  body.page-form .result-panel{
    max-width:1280px!important;
  }

  body.page-form .input-card{
    padding:18px 20px!important;
  }

  body.page-form .input-card span,
  body.page-form .history-card h2,
  body.page-form .schema-title{
    font-size:21px!important;
  }

  body.page-form input,
  body.page-form textarea,
  body.page-form select{
    font-size:22px!important;
    padding:14px 16px!important;
  }

  body.page-form .fixed-actions{
    left:30px!important;
    right:30px!important;
    bottom:18px!important;
    height:64px!important;
  }

  body.page-form .nav-btn{
    height:64px!important;
    min-width:190px!important;
    font-size:23px!important;
  }
}

/* v76: on larger iPads, keep extra space outside the Air-based canvas instead of stretching content. */
@media screen and (min-width:1400px) and (orientation:landscape){
  body.page-start .app-frame,
  body.page-form .app-frame{
    border-left:0 solid transparent;
    border-right:0 solid transparent;
  }
}


/* v77: smartphone portrait TOP layout fixed.
   Phone must be vertical stack: top=image, below=外来問診をはじめます text, then start button. */
@media screen and (max-width:600px) and (orientation:portrait){
  body.page-start .start-frame{
    display:grid!important;
    grid-template-rows:auto minmax(0,1fr) auto!important;
    overflow:hidden!important;
  }

  body.page-start .start-hero-card-split{
    display:grid!important;
    grid-template-columns:1fr!important;
    grid-template-rows:auto auto auto!important;
    align-content:start!important;
    justify-content:center!important;
    justify-items:center!important;
    align-items:start!important;
    text-align:center!important;
    margin:8px 12px 0!important;
    padding:16px 16px 18px!important;
    row-gap:12px!important;
    min-height:0!important;
    height:auto!important;
    max-height:100%!important;
  }

  body.page-start .start-hero-card-split .start-visual{
    display:block!important;
    grid-column:1!important;
    grid-row:1!important;
    order:0!important;
    position:relative!important;
    width:min(100%,320px)!important;
    max-width:320px!important;
    margin:0 auto!important;
    justify-self:center!important;
    align-self:start!important;
    text-align:center!important;
  }

  body.page-start .start-hero-card-split .start-visual img{
    display:block!important;
    width:100%!important;
    max-height:250px!important;
    object-fit:contain!important;
    margin:0 auto!important;
  }

  body.page-start .start-hero-card-split .start-copy{
    display:flex!important;
    grid-column:1!important;
    grid-row:2!important;
    order:1!important;
    width:100%!important;
    max-width:100%!important;
    margin:0 auto!important;
    flex-direction:column!important;
    align-items:center!important;
    justify-content:flex-start!important;
    text-align:center!important;
  }

  body.page-start .start-hero-card-split .start-copy h1{
    display:block!important;
    text-align:center!important;
    font-size:clamp(24px,6.4vw,28px)!important;
    line-height:1.16!important;
    letter-spacing:-.02em!important;
    margin:0!important;
  }

  body.page-start .start-hero-card-split .lead{
    display:block!important;
    text-align:center!important;
    font-size:clamp(13px,3.8vw,15px)!important;
    line-height:1.65!important;
    max-width:17em!important;
    margin:10px auto 0!important;
  }

  body.page-start .start-hero-card-split .start-bottom-cta{
    display:flex!important;
    grid-column:1!important;
    grid-row:3!important;
    order:2!important;
    width:100%!important;
    padding-top:4px!important;
    justify-content:center!important;
    justify-self:center!important;
    align-self:start!important;
  }

  body.page-start .start-hero-card-split .primary-start{
    width:min(100%,596px)!important;
    height:64px!important;
    font-size:21px!important;
    margin:0 auto!important;
  }
}


/* v78:
   iPad Pro 13 / iPad Pro 11 / iPad Air landscape PC layout normalization.
   Target landscape widths:
   - iPad Air    1373 x  924
   - iPad Pro 13 1590 x 1162
   - iPad Pro 11 1877 x 1253

   Layout rule:
   - 1300px-1900px landscape always keeps the same PC layout structure.
   - Do not switch grid structure by each iPad model.
   - Scale text, images, spacing, and buttons with viewport width/height.
*/
@media screen and (min-width:1300px) and (max-width:1900px) and (orientation:landscape){

  body.page-start,
  body.page-form{
    overflow:hidden!important;
  }

  body.page-start .app-frame,
  body.page-form .app-frame{
    width:100vw!important;
    max-width:none!important;
    height:100dvh!important;
    min-height:100svh!important;
    margin:0 auto!important;
    box-sizing:border-box!important;
  }

  /* ===== TOP PAGE: same 2-column PC layout, fluid scale only ===== */
  body.page-start .start-frame{
    display:grid!important;
    grid-template-rows:auto minmax(0,1fr) auto!important;
    align-content:start!important;
    overflow:hidden!important;
  }

  body.page-start .app-header{
    display:flex!important;
    justify-content:space-between!important;
    align-items:center!important;
    gap:clamp(20px,2vw,38px)!important;
    padding-left:clamp(32px,4vw,72px)!important;
    padding-right:clamp(32px,4vw,72px)!important;
    padding-top:calc(clamp(18px,2.2vh,34px) + env(safe-area-inset-top, 0px))!important;
    padding-bottom:clamp(8px,1.1vh,16px)!important;
    box-sizing:border-box!important;
  }

  body.page-start .hospital-logo{
    max-height:clamp(52px,5.1vw,78px)!important;
    width:auto!important;
    max-width:clamp(360px,34vw,620px)!important;
    object-fit:contain!important;
    object-position:left center!important;
  }

  body.page-start .touchde-viewport-trigger,
  body.page-start .service-brand{
    flex:0 0 auto!important;
  }

  body.page-start .touchde-logo{
    width:clamp(170px,14vw,260px)!important;
    max-width:clamp(170px,14vw,260px)!important;
    max-height:clamp(46px,4.2vw,72px)!important;
  }

  body.page-start .start-hero-card-split{
    display:grid!important;
    grid-template-columns:minmax(0,1.02fr) minmax(340px,.98fr)!important;
    grid-template-rows:minmax(0,1fr) auto!important;
    margin:clamp(10px,1vw,20px) clamp(42px,5.2vw,92px) 0!important;
    padding:clamp(34px,3.7vw,64px) clamp(42px,4.7vw,86px) clamp(28px,3vw,54px)!important;
    column-gap:clamp(34px,3.8vw,66px)!important;
    row-gap:clamp(18px,2vw,34px)!important;
    min-height:0!important;
    max-height:100%!important;
    overflow:hidden!important;
    align-items:center!important;
    text-align:left!important;
    box-sizing:border-box!important;
  }

  body.page-start .start-hero-card-split .start-copy{
    display:block!important;
    text-align:left!important;
    align-self:center!important;
    width:100%!important;
    min-width:0!important;
  }

  body.page-start .start-hero-card-split .start-copy h1{
    font-size:clamp(64px,5.1vw,92px)!important;
    line-height:1.04!important;
    letter-spacing:-.04em!important;
    text-align:left!important;
    margin:0!important;
  }

  body.page-start .start-hero-card-split .lead{
    font-size:clamp(22px,1.65vw,31px)!important;
    line-height:1.62!important;
    max-width:clamp(650px,46vw,880px)!important;
    margin:clamp(16px,1.7vw,30px) 0 0!important;
    text-align:left!important;
  }

  body.page-start .start-hero-card-split .start-visual{
    grid-column:2!important;
    grid-row:1!important;
    order:0!important;
    align-self:center!important;
    justify-self:center!important;
    width:100%!important;
    max-width:clamp(380px,34vw,620px)!important;
    margin:0 auto!important;
    position:relative!important;
    text-align:center!important;
  }

  body.page-start .start-hero-card-split .start-visual img{
    display:block!important;
    width:100%!important;
    max-height:clamp(340px,31vw,560px)!important;
    object-fit:contain!important;
    margin:0 auto!important;
  }

  body.page-start .start-hero-card-split .start-bottom-cta{
    grid-column:1 / -1!important;
    grid-row:2!important;
    width:100%!important;
    display:flex!important;
    justify-content:center!important;
    align-items:center!important;
    padding-top:clamp(4px,.8vw,12px)!important;
  }

  body.page-start .start-hero-card-split .primary-start{
    width:clamp(360px,29vw,520px)!important;
    height:clamp(72px,6vw,104px)!important;
    font-size:clamp(26px,2.25vw,38px)!important;
    margin:0 auto!important;
  }

  body.page-start .app-footer{
    padding:clamp(8px,.9vw,18px) clamp(42px,4vw,72px) clamp(10px,1vw,20px)!important;
  }

  /* ===== FORM PAGES: same PC layout, fluid scale only ===== */
  body.page-form .form-header-v3{
    height:clamp(104px,8.7vw,142px)!important;
    padding:clamp(12px,1.15vw,22px) clamp(24px,3.1vw,56px)!important;
    grid-template-columns:
      minmax(clamp(300px,24vw,450px), .32fr)
      minmax(520px, 1fr)
      minmax(clamp(220px,18vw,340px), .22fr)!important;
    gap:clamp(12px,1.4vw,24px)!important;
    box-sizing:border-box!important;
  }

  body.page-form .form-header-v3 .form-hospital-logo{
    max-width:clamp(290px,24vw,440px)!important;
    height:clamp(68px,5.5vw,94px)!important;
    object-fit:contain!important;
  }

  body.page-form .form-touchde-logo{
    max-width:clamp(220px,17.2vw,320px)!important;
    height:clamp(58px,4.7vw,84px)!important;
    object-fit:contain!important;
  }

  body.page-form .header-logo-right{
    min-width:clamp(220px,17.2vw,320px)!important;
    width:clamp(220px,17.2vw,320px)!important;
    display:flex!important;
    justify-content:flex-end!important;
  }

  body.page-form .header-progress{
    gap:clamp(8px,.85vw,16px)!important;
    justify-content:center!important;
    overflow:visible!important;
  }

  body.page-form .header-progress .progress-dot{
    width:clamp(70px,5.8vw,104px)!important;
    min-width:clamp(70px,5.8vw,104px)!important;
    height:clamp(66px,5.5vw,98px)!important;
    border-radius:clamp(18px,1.6vw,26px)!important;
    gap:clamp(3px,.35vw,6px)!important;
  }

  body.page-form .header-progress .progress-dot span{
    font-size:clamp(18px,1.45vw,26px)!important;
    line-height:1!important;
  }

  body.page-form .header-progress .progress-dot b{
    font-size:clamp(14px,1.1vw,20px)!important;
    line-height:1.1!important;
    white-space:nowrap!important;
  }

  body.page-form .question-shell{
    height:calc(100dvh - clamp(104px,8.7vw,142px) - clamp(82px,7vw,118px))!important;
    min-height:0!important;
    padding-left:clamp(30px,3.4vw,64px)!important;
    padding-right:clamp(30px,3.4vw,64px)!important;
    padding-bottom:clamp(92px,7vw,126px)!important;
    box-sizing:border-box!important;
  }

  body.page-form .question-page{
    padding-top:clamp(12px,1vw,20px)!important;
    padding-bottom:clamp(16px,1.5vw,28px)!important;
  }

  body.page-form .page-heading,
  body.page-form .card-grid,
  body.page-form .symptom-grid,
  body.page-form .history-list,
  body.page-form .schema-panel,
  body.page-form .summary-box,
  body.page-form .result-panel{
    max-width:calc(100vw - clamp(80px,8vw,160px))!important;
  }

  body.page-form .page-heading{
    margin-bottom:clamp(14px,1.2vw,24px)!important;
  }

  body.page-form .page-heading h1{
    font-size:clamp(40px,3.15vw,58px)!important;
    line-height:1.16!important;
  }

  body.page-form .page-heading p:not(.page-no){
    font-size:clamp(20px,1.55vw,28px)!important;
    margin-top:clamp(8px,.8vw,14px)!important;
  }

  body.page-form .page-no{
    font-size:clamp(18px,1.35vw,24px)!important;
  }

  body.page-form .card-grid{
    gap:clamp(18px,1.4vw,28px)!important;
  }

  body.page-form .input-card{
    padding:clamp(18px,1.45vw,28px) clamp(20px,1.65vw,32px)!important;
    border-radius:clamp(22px,1.8vw,30px)!important;
  }

  body.page-form .input-card span,
  body.page-form .history-card h2,
  body.page-form .schema-title{
    font-size:clamp(21px,1.6vw,30px)!important;
  }

  body.page-form input,
  body.page-form textarea,
  body.page-form select{
    font-size:clamp(22px,1.7vw,30px)!important;
    padding:clamp(14px,1.15vw,20px) clamp(16px,1.35vw,24px)!important;
  }

  body.page-form .segmented b{
    height:clamp(56px,4.6vw,78px)!important;
    font-size:clamp(20px,1.55vw,28px)!important;
  }

  body.page-form .symptom-grid{
    grid-template-columns:repeat(4, 1fr)!important;
    gap:clamp(16px,1.25vw,24px)!important;
  }

  body.page-form .check-tile span{
    height:clamp(76px,6.2vw,108px)!important;
    font-size:clamp(20px,1.55vw,28px)!important;
    border-radius:clamp(20px,1.8vw,28px)!important;
    padding-left:clamp(18px,1.5vw,28px)!important;
    padding-right:clamp(18px,1.5vw,28px)!important;
  }

  body.page-form .check-tile span:before{
    width:clamp(24px,1.9vw,34px)!important;
    height:clamp(24px,1.9vw,34px)!important;
  }

  body.page-form .history-list{
    gap:clamp(16px,1.25vw,24px)!important;
  }

  body.page-form .history-card{
    padding:clamp(18px,1.45vw,26px) clamp(20px,1.65vw,30px)!important;
  }

  body.page-form .summary-box{
    font-size:clamp(20px,1.45vw,26px)!important;
    line-height:1.7!important;
    padding:clamp(22px,1.8vw,34px)!important;
  }

  body.page-form .fixed-actions{
    left:clamp(30px,3.4vw,64px)!important;
    right:clamp(30px,3.4vw,64px)!important;
    bottom:clamp(16px,1.4vw,28px)!important;
    height:clamp(64px,5.3vw,92px)!important;
  }

  body.page-form .nav-btn{
    height:clamp(64px,5.3vw,92px)!important;
    min-width:clamp(190px,15vw,280px)!important;
    font-size:clamp(23px,1.8vw,32px)!important;
    border-radius:clamp(18px,1.6vw,28px)!important;
  }

  body.page-form .schema-panel{
    padding:clamp(20px,1.7vw,32px)!important;
  }

  body.page-form .schema-strip{
    gap:clamp(12px,1vw,20px)!important;
  }

  body.page-form .schema-strip img{
    height:clamp(150px,12vw,230px)!important;
  }
}


/* ==============================
   HNSMHP v79 - form pages full-viewport layout
   Request summary:
   - 2ページ目以降は上寄せ
   - ブラウザ表示領域を意識した縦レイアウト
   - 画面外側の背景色付きキャンバスは廃止
   - 余白を保ちつつ画面いっぱいにレイアウト
   ============================== */
@media screen and (min-width:900px) and (orientation:landscape){
  html,
  body.page-form{
    min-height:100%;
    background:#ffffff !important;
  }

  body.page-form{
    display:block !important;
    overflow:auto !important;
    align-items:stretch !important;
    justify-content:flex-start !important;
  }

  body.page-form .app-frame{
    width:100% !important;
    max-width:none !important;
    height:auto !important;
    min-height:100dvh !important;
    margin:0 !important;
    box-shadow:none !important;
    overflow:visible !important;
    background:#edf5fb !important;
  }

  body.page-form .form-header-v3{
    height:auto !important;
    min-height:104px;
    grid-template-columns:minmax(300px, 430px) 1fr minmax(200px, 290px) !important;
    gap:clamp(14px, 1.6vw, 26px) !important;
    padding:18px clamp(28px, 3.2vw, 56px) 16px !important;
    border-bottom:1px solid rgba(120,164,205,.26) !important;
    background:#ffffff !important;
    backdrop-filter:none !important;
    box-shadow:none !important;
  }

  body.page-form .header-logo-left{
    justify-content:flex-start !important;
  }

  body.page-form .header-logo-right{
    justify-content:flex-end !important;
  }

  body.page-form .form-header-v3 .form-hospital-logo{
    width:100% !important;
    max-width:420px !important;
    height:56px !important;
    object-fit:contain !important;
  }

  body.page-form .form-touchde-logo{
    width:100% !important;
    max-width:240px !important;
    height:52px !important;
    object-fit:contain !important;
  }

  body.page-form .header-progress{
    justify-content:center !important;
    align-items:center !important;
    gap:10px !important;
    padding:0 !important;
    overflow:visible !important;
  }

  body.page-form .header-progress .progress-dot{
    width:72px !important;
    min-width:72px !important;
    height:72px !important;
    border-radius:22px !important;
    padding:6px 8px !important;
    gap:2px !important;
  }

  body.page-form .header-progress .progress-dot span{
    font-size:18px !important;
  }

  body.page-form .header-progress .progress-dot b{
    font-size:17px !important;
    letter-spacing:.01em !important;
  }

  body.page-form .form-header-v3 + .question-shell,
  body.page-form .question-shell{
    min-height:calc(100dvh - 104px) !important;
    padding:28px clamp(40px, 4vw, 64px) 24px !important;
    background:#edf5fb !important;
  }

  body.page-form .question-page{
    padding:0 !important;
    height:auto !important;
    overflow:visible !important;
  }

  body.page-form .page-heading,
  body.page-form .card-grid,
  body.page-form .symptom-grid,
  body.page-form .history-list,
  body.page-form .schema-panel,
  body.page-form .summary-box,
  body.page-form .result-panel,
  body.page-form .fixed-actions,
  body.page-form .detail-layout,
  body.page-form .qr-stack{
    width:100% !important;
    max-width:none !important;
  }

  body.page-form .page-heading{
    margin:0 0 18px !important;
    text-align:center;
  }

  body.page-form .page-no{
    font-size:19px !important;
    margin-bottom:6px !important;
  }

  body.page-form .page-heading h1{
    font-size:40px !important;
    line-height:1.15 !important;
  }

  body.page-form .page-heading p:not(.page-no){
    font-size:18px !important;
    margin-top:8px !important;
  }

  body.page-form .card-grid,
  body.page-form .history-list,
  body.page-form .symptom-grid,
  body.page-form .detail-layout,
  body.page-form .detail-row,
  body.page-form .qr-stack{
    gap:20px !important;
  }

  body.page-form .card-grid.two,
  body.page-form .history-list,
  body.page-form .injury-row,
  body.page-form .location-row,
  body.page-form .main-detail-row,
  body.page-form .schema-v18-edit-area,
  body.page-form .qr-card-body{
    grid-template-columns:repeat(2, minmax(0,1fr)) !important;
  }

  body.page-form .input-card,
  body.page-form .history-card,
  body.page-form .qr-card{
    border-radius:24px !important;
    padding:18px 20px !important;
    gap:10px !important;
    background:rgba(255,255,255,.92) !important;
    box-shadow:none !important;
  }

  body.page-form .input-card span,
  body.page-form .history-card h2,
  body.page-form .schema-title{
    font-size:19px !important;
  }

  body.page-form input,
  body.page-form textarea,
  body.page-form select{
    font-size:18px !important;
    padding:14px 16px !important;
    border-radius:16px !important;
  }

  body.page-form .segmented{
    gap:12px !important;
  }

  body.page-form .segmented b{
    height:54px !important;
    font-size:18px !important;
    border-radius:16px !important;
  }

  body.page-form .segmented.compact b{
    height:48px !important;
    font-size:16px !important;
  }

  body.page-form .patient-no-row{
    grid-template-columns:minmax(0, 1fr) 170px !important;
    gap:12px !important;
    align-items:center !important;
  }

  body.page-form .unknown-btn{
    height:56px !important;
    font-size:18px !important;
    border-radius:16px !important;
  }

  body.page-form .patient-no-card small{
    font-size:12px !important;
    line-height:1.55 !important;
  }

  body.page-form .required-mark{
    font-size:13px !important;
    padding:3px 8px !important;
  }

  body.page-form .symptom-grid{
    grid-template-columns:repeat(4, minmax(0,1fr)) !important;
  }

  body.page-form .check-tile span{
    height:58px !important;
    padding:0 14px !important;
    font-size:17px !important;
    border-radius:16px !important;
  }

  body.page-form .check-tile span:before{
    width:20px !important;
    height:20px !important;
    margin-right:10px !important;
  }

  body.page-form .schema-panel{
    margin-top:18px !important;
    padding:20px !important;
    border-radius:24px !important;
    background:rgba(255,255,255,.92) !important;
    box-shadow:none !important;
  }

  body.page-form .summary-box{
    border-radius:24px !important;
    padding:22px !important;
    min-height:260px !important;
    background:rgba(255,255,255,.92) !important;
    box-shadow:none !important;
  }

  body.page-form .result-panel{
    margin-top:18px !important;
    align-items:flex-start !important;
  }

  body.page-form .fixed-actions{
    position:static !important;
    margin:22px 0 0 !important;
    padding:0 !important;
    justify-content:space-between !important;
    align-items:center !important;
    gap:18px !important;
  }

  body.page-form .nav-btn{
    min-width:190px !important;
    height:64px !important;
    font-size:24px !important;
    border-radius:20px !important;
  }
}


/* v80: smartphone portrait STEP2 symptoms should be 2-column layout */
@media screen and (max-width:600px) and (orientation:portrait){
  body.page-form .symptom-grid{
    display:grid!important;
    grid-template-columns:repeat(2, minmax(0, 1fr))!important;
    gap:10px!important;
  }
  body.page-form .symptom-grid .check-tile span{
    height:54px!important;
    min-height:54px!important;
    padding:0 10px!important;
    font-size:15px!important;
    line-height:1.25!important;
    border-radius:15px!important;
  }
  body.page-form .symptom-grid .check-tile span:before{
    width:18px!important;
    height:18px!important;
    margin-right:8px!important;
    flex:0 0 auto!important;
  }
}
@media screen and (max-width:390px) and (orientation:portrait){
  body.page-form .symptom-grid{
    gap:8px!important;
  }
  body.page-form .symptom-grid .check-tile span{
    height:50px!important;
    min-height:50px!important;
    padding:0 8px!important;
    font-size:14px!important;
  }
}


/* v81: force smartphone portrait STEP2 symptom tiles to 2 columns.
   v80 was overridden by later/stronger rules on some iPhone Safari layouts. */
@media screen and (max-width: 600px) and (orientation: portrait) {
  body.page-form .question-page[data-page="1"] .symptom-grid,
  body.page-form .question-page[data-page="1"].active .symptom-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    margin-bottom: 12px !important;
  }

  body.page-form .question-page[data-page="1"] .check-tile,
  body.page-form .question-page[data-page="1"].active .check-tile {
    width: 100% !important;
    min-width: 0 !important;
  }

  body.page-form .question-page[data-page="1"] .check-tile span,
  body.page-form .question-page[data-page="1"].active .check-tile span {
    display: flex !important;
    align-items: center !important;
    min-height: 58px !important;
    height: auto !important;
    padding: 10px 10px !important;
    font-size: 15px !important;
    line-height: 1.2 !important;
    border-radius: 15px !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
  }

  body.page-form .question-page[data-page="1"] .check-tile span:before,
  body.page-form .question-page[data-page="1"].active .check-tile span:before {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    border-width: 2px !important;
    border-radius: 5px !important;
    margin-right: 8px !important;
    flex: 0 0 18px !important;
  }
}

@media screen and (max-width: 390px) and (orientation: portrait) {
  body.page-form .question-page[data-page="1"] .symptom-grid,
  body.page-form .question-page[data-page="1"].active .symptom-grid {
    gap: 8px !important;
  }

  body.page-form .question-page[data-page="1"] .check-tile span,
  body.page-form .question-page[data-page="1"].active .check-tile span {
    min-height: 54px !important;
    padding: 8px 8px !important;
    font-size: 14px !important;
  }

  body.page-form .question-page[data-page="1"] .check-tile span:before,
  body.page-form .question-page[data-page="1"].active .check-tile span:before {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    flex: 0 0 16px !important;
    margin-right: 7px !important;
  }
}
