:root{
  --bg:#f4f6fb;--card:#fff;--ink:#102749;--muted:#6d7481;--line:#e3e7ef;
  --brand:#6657e8;--brand2:#efedff;--ok:#17875d;--okbg:#e9f8f1;
  --warn:#b86a00;--warnbg:#fff3dc;--danger:#c43b4c;--dangerbg:#fff0f2;
  --shadow:0 18px 48px rgba(35,50,75,.10);
  --cream:#fbf4e8;--cream2:#fffaf1;--navy:#102e56;--green:#185f3c;--orange:#c97712;--plum:#4b2d58;--gold:#c6923e;
}
*{box-sizing:border-box}
html{min-height:100%}
body{margin:0;background:var(--bg);color:var(--ink);font:16px/1.4 Inter,"Segoe UI",Arial,sans-serif}
button,input{font:inherit}button{border:0;font-weight:800;cursor:pointer;transition:transform .14s ease,box-shadow .14s ease,filter .14s ease}button:active{transform:scale(.985)}
h1,h2,h3,p{margin-top:0}.hidden{display:none!important}

/* ===================== KIOSK 2160×3840 ===================== */
.kiosk-body{min-height:100vh;background:#f8f0e3;color:#132846;overflow-x:hidden}
.kiosk-shell{position:relative;isolation:isolate;min-height:100vh;max-width:2160px;margin:0 auto;padding:clamp(28px,3.4vw,78px) clamp(30px,4vw,92px) clamp(42px,4vw,92px);overflow:hidden;background:
  radial-gradient(circle at 100% 8%,rgba(230,166,69,.20),transparent 24%),
  radial-gradient(circle at -5% 18%,rgba(191,99,30,.13),transparent 22%),
  linear-gradient(180deg,#fffaf1 0%,#f8f0e3 47%,#f7efe3 100%)}
.kiosk-shell:before,.kiosk-shell:after{content:"";position:absolute;z-index:-1;pointer-events:none;border-radius:50%;filter:blur(8px)}
.kiosk-shell:before{width:44vw;height:44vw;max-width:900px;max-height:900px;right:-15vw;top:12vh;background:radial-gradient(circle,rgba(239,164,60,.14),transparent 68%)}
.kiosk-shell:after{width:36vw;height:36vw;max-width:760px;max-height:760px;left:-14vw;top:4vh;background:radial-gradient(circle,rgba(64,115,76,.09),transparent 70%)}
.autumn-glow{position:absolute;z-index:-1;pointer-events:none;opacity:.42}
.glow-a{width:520px;height:520px;top:0;left:-140px;background:radial-gradient(ellipse at 70% 35%,rgba(206,111,27,.28),transparent 55%);transform:rotate(-18deg)}
.glow-b{width:680px;height:680px;top:500px;right:-260px;background:radial-gradient(ellipse at 30% 50%,rgba(227,157,47,.22),transparent 58%);transform:rotate(22deg)}

.kiosk-brand{text-align:center;display:flex;flex-direction:column;align-items:center;padding-top:clamp(4px,1vw,18px)}
.crest-wrap{width:clamp(210px,17vw,390px);height:clamp(190px,15.5vw,355px);display:grid;place-items:center;margin-bottom:clamp(4px,.8vw,14px)}
.school-logo{display:block;width:100%;height:100%;object-fit:contain;mix-blend-mode:multiply;filter:drop-shadow(0 12px 16px rgba(44,61,71,.08))}
.school-name{font-family:Georgia,"Times New Roman",serif;font-weight:800;font-size:clamp(38px,4.2vw,86px);line-height:1.04;letter-spacing:.015em;color:#122e55}
.school-subtitle{margin-top:clamp(8px,1vw,20px);font-family:Georgia,"Times New Roman",serif;font-weight:700;font-size:clamp(17px,1.45vw,32px);letter-spacing:.18em;color:#9a642c}
.school-subtitle:before,.school-subtitle:after{content:"";display:inline-block;vertical-align:middle;width:clamp(42px,7vw,150px);height:1px;background:linear-gradient(90deg,transparent,#b5813f);margin:0 clamp(12px,1.5vw,28px)}
.school-subtitle:after{background:linear-gradient(90deg,#b5813f,transparent)}

.time-panel{text-align:center;padding:clamp(18px,2vw,40px) 0 clamp(22px,2.2vw,44px)}
.mega-clock{font-family:Georgia,"Times New Roman",serif;font-variant-numeric:tabular-nums;font-size:clamp(112px,15.5vw,330px);font-weight:500;line-height:.92;letter-spacing:-.045em;color:#102f5a;text-shadow:0 6px 0 rgba(255,255,255,.6)}
.mega-date{font-family:Georgia,"Times New Roman",serif;font-size:clamp(30px,3.6vw,76px);font-weight:800;line-height:1.1;margin-top:clamp(6px,1vw,18px);color:#132c50}
.season-line{margin-top:clamp(12px,1.6vw,28px);font-size:clamp(17px,1.55vw,34px);font-weight:900;letter-spacing:.15em;color:#b56828;text-transform:uppercase}
.season-line:before,.season-line:after{content:"◆";font-size:.62em;margin:0 .75em;color:#d17b28;vertical-align:.12em}

.kiosk-offline{max-width:1600px;margin:0 auto 24px;font-size:clamp(18px,1.1vw,27px)}
.action-grid{display:grid;grid-template-columns:1fr 1fr;gap:clamp(18px,2vw,38px);margin:0 auto clamp(24px,2.7vw,52px)}
.action-card{position:relative;overflow:hidden;min-height:clamp(180px,13vw,280px);border-radius:clamp(28px,2.4vw,52px);padding:clamp(28px,2.5vw,54px);display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:clamp(20px,2vw,42px);text-align:left;color:white;box-shadow:0 22px 45px rgba(26,37,55,.18);border:1px solid rgba(255,255,255,.18)}
.action-card:before{content:"";position:absolute;inset:0;background:radial-gradient(circle at 18% 25%,rgba(255,255,255,.15),transparent 35%),linear-gradient(135deg,rgba(255,255,255,.05),transparent 55%);pointer-events:none}
.action-card:hover{filter:brightness(1.045);box-shadow:0 28px 58px rgba(26,37,55,.23)}
.action-blue{background:linear-gradient(135deg,#153b69,#0d294f)}
.action-green{background:linear-gradient(135deg,#26714c,#14583a)}
.action-orange{background:linear-gradient(135deg,#da8a16,#b95d08)}
.action-plum{background:linear-gradient(135deg,#5b3c69,#42244f)}
.action-icon{position:relative;z-index:1;width:clamp(84px,7.2vw,150px);height:clamp(84px,7.2vw,150px);border-radius:50%;display:grid;place-items:center;background:rgba(0,0,0,.12);border:2px solid rgba(255,255,255,.25);box-shadow:inset 0 0 0 9px rgba(255,255,255,.025)}
.action-icon svg{width:52%;height:52%;fill:none;stroke:currentColor;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round}
.action-copy{position:relative;z-index:1;display:flex;flex-direction:column;min-width:0}.action-copy strong{font-family:Georgia,"Times New Roman",serif;font-size:clamp(31px,3vw,62px);line-height:1.03}.action-copy small{display:block;margin-top:clamp(9px,1vw,20px);font-size:clamp(17px,1.35vw,29px);font-weight:600;line-height:1.25;opacity:.86}
.action-arrow{position:relative;z-index:1;width:clamp(50px,4vw,82px);height:clamp(50px,4vw,82px);display:grid;place-items:center;border-radius:50%;border:2px solid rgba(255,255,255,.5);font-size:clamp(38px,3vw,68px);font-weight:400;line-height:1}

.status-card,.today-card{background:rgba(255,252,246,.92);border:1px solid rgba(166,131,80,.22);box-shadow:0 20px 50px rgba(65,50,34,.10);backdrop-filter:blur(8px)}
.status-card{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:clamp(22px,2.4vw,50px);border-radius:clamp(28px,2.5vw,50px);padding:clamp(28px,2.7vw,58px);margin-bottom:clamp(24px,2.5vw,48px)}
.status-icon{width:clamp(92px,8vw,160px);height:clamp(92px,8vw,160px);border-radius:50%;display:grid;place-items:center;background:linear-gradient(145deg,#fff9eb,#efe1c3);color:#163c68;border:1px solid #e4c999}.status-icon svg{width:58%;height:58%;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
.status-title{font-family:Georgia,"Times New Roman",serif;font-size:clamp(30px,3vw,63px);font-weight:800;line-height:1.07;color:#112d52}.status-sub{margin-top:8px;font-size:clamp(18px,1.6vw,34px);font-weight:650;color:#46566b}
.selected-class-box{min-width:clamp(150px,12vw,260px);text-align:center;padding-left:clamp(18px,2vw,38px);border-left:1px solid #e7d6bd}.selected-class-box span{display:block;font-size:clamp(12px,.9vw,20px);letter-spacing:.14em;font-weight:900;color:#8c6f4c}.selected-class-box b{display:block;font-family:Georgia,serif;font-size:clamp(38px,4vw,86px);line-height:1;color:#173d68;margin:8px 0}.tiny-button{background:transparent;color:#8c612e;padding:5px 10px;text-decoration:underline;font-size:clamp(13px,.85vw,19px)}

.today-card{border-radius:clamp(30px,2.6vw,54px);padding:clamp(28px,2.8vw,58px);margin-bottom:clamp(34px,3vw,62px)}
.panel-head,.view-head{display:flex;align-items:center;justify-content:space-between;gap:24px}.panel-head{margin-bottom:clamp(20px,2vw,40px)}
.panel-kicker{font-size:clamp(13px,1vw,22px);letter-spacing:.16em;font-weight:950;color:#96642e}.today-card h2,.view-head h1{font-family:Georgia,"Times New Roman",serif;color:#102f58;margin:4px 0 0;font-weight:800}.today-card h2{font-size:clamp(31px,3.1vw,64px)}.view-head h1{font-size:clamp(38px,4vw,82px);line-height:1.05}
.outline-button,.back-button{border-radius:999px;padding:clamp(14px,1.25vw,25px) clamp(22px,2vw,42px);font-size:clamp(16px,1.15vw,25px);background:rgba(255,255,255,.72);color:#17375e;border:1px solid #d8cab5;box-shadow:0 8px 18px rgba(50,43,36,.05)}

.home-lesson-list{display:grid;gap:clamp(8px,.8vw,16px)}
.home-lesson{display:grid;grid-template-columns:clamp(62px,5vw,105px) minmax(0,1fr) clamp(110px,10vw,220px) clamp(150px,13vw,280px);align-items:center;gap:clamp(13px,1.5vw,28px);min-height:clamp(84px,6vw,128px);padding:clamp(14px,1.25vw,26px) clamp(16px,1.6vw,32px);border-radius:clamp(18px,1.5vw,30px);background:rgba(255,255,255,.60);border:1px solid rgba(184,157,119,.20)}
.home-lesson.current{background:#edf5de;border-color:#9fb67b;box-shadow:0 9px 24px rgba(76,112,54,.10)}.home-lesson.replacement{background:#fff0d4;border-color:#e5b867}.home-lesson.cancelled{background:#fff0f2;border-color:#e6a6ae;opacity:.82}
.home-lesson-no{width:clamp(50px,4vw,82px);height:clamp(50px,4vw,82px);display:grid;place-items:center;border-radius:50%;background:#ead6aa;color:#513b21;font-size:clamp(20px,1.7vw,35px);font-weight:950}.home-lesson.current .home-lesson-no{background:#5f963f;color:white}.home-lesson-main b{display:block;font-family:Georgia,serif;font-size:clamp(22px,2vw,43px);line-height:1.12;color:#162d4b}.home-lesson-main small{display:block;margin-top:5px;font-size:clamp(13px,.95vw,21px);color:#a15f0d;font-weight:800}.home-lesson-room,.home-lesson-time{font-size:clamp(16px,1.35vw,29px);font-weight:750;color:#3f4d5d}.home-lesson-time{text-align:center;border-radius:999px;background:#f2e3c6;padding:10px 14px;font-variant-numeric:tabular-nums}.home-lesson.cancelled .home-lesson-time{background:#f1d8dc}
.empty-select,.empty-card{width:100%;border-radius:26px;padding:38px;text-align:center;background:#fffdf8;border:1px dashed #cdbb9e;color:#7a6244;font-size:clamp(18px,1.4vw,30px);font-weight:800}.empty-select{cursor:pointer}.success-empty{color:#286846;background:#eef8f1;border-color:#a4ccb4}

.kiosk-view{position:relative}.view-head{margin:clamp(14px,1.4vw,28px) 0 clamp(30px,3vw,62px)}
.kiosk-class-grid{display:grid;grid-template-columns:repeat(6,1fr);gap:clamp(14px,1.5vw,30px)}
.class-btn{min-height:clamp(120px,10vw,210px);border-radius:clamp(24px,2vw,42px);background:rgba(255,253,248,.92);border:1px solid #dcc9aa;box-shadow:0 14px 32px rgba(60,47,33,.09);color:#15385f;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px}.class-btn span{font-family:Georgia,serif;font-size:clamp(38px,4vw,82px);line-height:1;font-weight:900}.class-btn small{font-size:clamp(12px,.95vw,20px);color:#8c6b43}.class-btn.selected{background:#e9f0df;border-color:#789a58;color:#285b31}.class-btn:hover{transform:translateY(-2px);box-shadow:0 20px 40px rgba(60,47,33,.13)}

.kiosk-lesson-list{display:grid;gap:clamp(13px,1.25vw,26px)}
.lesson-card{display:grid;grid-template-columns:clamp(80px,6vw,130px) clamp(160px,14vw,310px) minmax(0,1fr) clamp(140px,12vw,260px);align-items:center;gap:clamp(15px,1.5vw,30px);background:rgba(255,253,248,.94);border:1px solid #dfcfb7;border-radius:clamp(24px,2vw,42px);padding:clamp(20px,2vw,42px);box-shadow:0 13px 32px rgba(55,46,36,.08)}
.lesson-card.current{border:4px solid #5f8f41;background:#eef6e5}.lesson-card.replacement{border-left:clamp(8px,.7vw,15px) solid #dc911d;background:#fff2d9}.lesson-card.cancelled{border-left:clamp(8px,.7vw,15px) solid #c94858;background:#fff0f2}.lesson-no{font-family:Georgia,serif;font-size:clamp(36px,3.5vw,74px);font-weight:900;color:#174271;text-align:center}.lesson-no.class-no{font-size:clamp(28px,2.8vw,58px)}.lesson-time{font-size:clamp(19px,1.7vw,36px);font-weight:850;color:#5d6671;font-variant-numeric:tabular-nums}.lesson-subject{font-family:Georgia,serif;font-size:clamp(26px,2.5vw,52px);font-weight:850;white-space:pre-line;color:#152d4b}.lesson-room{font-size:clamp(19px,1.75vw,37px);font-weight:850;text-align:right}.subnote{font-size:clamp(14px,1.05vw,23px);margin-top:7px;color:#975809;font-weight:800}

.kiosk-week-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:clamp(12px,1.1vw,24px)}
.day-col{background:rgba(255,253,248,.94);border:1px solid #dfcfb7;border-radius:clamp(22px,1.8vw,36px);padding:clamp(16px,1.45vw,30px);box-shadow:0 10px 27px rgba(55,46,36,.07)}.day-col h3{font-family:Georgia,serif;font-size:clamp(23px,2vw,42px);color:#143860;margin:0 0 14px}.mini-lesson{display:grid;grid-template-columns:clamp(34px,2.5vw,54px) 1fr;gap:10px;align-items:start;border-top:1px solid #e6d8c3;padding:clamp(13px,1.05vw,22px) 0}.mini-lesson:first-of-type{border-top:0}.mini-n{width:clamp(32px,2.4vw,50px);height:clamp(32px,2.4vw,50px);display:grid;place-items:center;border-radius:50%;background:#e9d3a7;color:#513d23;font-weight:900;font-size:clamp(14px,1vw,21px)}.mini-lesson b{display:block;font-size:clamp(15px,1.05vw,22px);line-height:1.18;color:#1a2f49}.mini-lesson small{display:block;margin-top:5px;color:#756b5e;font-size:clamp(12px,.85vw,18px)}.mini-empty{color:#817466;padding:15px 0}

.room-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:clamp(14px,1.5vw,28px)}.room-btn{min-height:clamp(120px,9vw,190px);border-radius:clamp(24px,2vw,40px);background:linear-gradient(145deg,#fffdf8,#f3e8d6);border:1px solid #dac6a7;color:#183b60;box-shadow:0 12px 28px rgba(60,47,33,.08);display:flex;flex-direction:column;align-items:center;justify-content:center}.room-btn span{font-family:Georgia,serif;font-size:clamp(27px,2.7vw,56px);font-weight:900;text-align:center}.room-btn small{margin-top:7px;color:#856d4f;font-size:clamp(12px,.9vw,19px)}

.kiosk-footer{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:clamp(10px,1.2vw,26px);margin-top:clamp(34px,3vw,64px);border-radius:clamp(25px,2vw,42px);padding:clamp(24px,2vw,42px);background:linear-gradient(135deg,#102f57,#0a2546);color:#d8ab58;font-family:Georgia,serif;font-size:clamp(17px,1.5vw,32px);font-weight:800;letter-spacing:.12em;box-shadow:0 16px 34px rgba(17,35,56,.18)}.kiosk-footer small{width:100%;text-align:center;color:rgba(255,255,255,.65);font:600 clamp(12px,.85vw,18px) Inter,"Segoe UI",sans-serif;letter-spacing:.04em}

/* ===================== ADMIN ===================== */
.shell,.admin-shell{max-width:1450px;margin:auto;padding:24px}.admin-shell{max-width:1200px}.topbar{display:flex;align-items:center;justify-content:space-between;margin-bottom:22px}.topbar h1{font-size:40px;margin:2px 0}.eyebrow{font-size:12px;letter-spacing:.13em;font-weight:900;color:var(--brand)}
.offline{background:var(--warnbg);border:1px solid #f1cf92;padding:12px 16px;border-radius:14px;margin-bottom:16px;font-weight:800}.card{background:white;border:1px solid var(--line);border-radius:22px;padding:22px;box-shadow:var(--shadow);margin-bottom:18px}.admin-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px}.card input[type=file]{display:block;width:100%;padding:14px;background:#f7f8fc;border-radius:12px;border:1px dashed #bdc5d7;margin:16px 0}.primary{background:var(--brand);color:white;border-radius:14px;padding:14px 20px}.secondary{background:white;border:1px solid var(--line);color:var(--ink);border-radius:14px;padding:14px 20px}.success{background:var(--ok);color:white;border-radius:14px;padding:14px 20px}.row{display:flex;gap:10px}.row input{flex:1;border:1px solid var(--line);border-radius:12px;padding:12px}.linkbtn{text-decoration:none;display:inline-block}.summary{display:flex;gap:10px;flex-wrap:wrap;margin:12px 0}.pill{background:var(--brand2);color:#4335c2;padding:8px 12px;border-radius:999px;font-weight:800}.warnbox{background:var(--warnbg);padding:12px;border-radius:12px;margin:10px 0}.table-wrap{overflow:auto;max-height:500px;border:1px solid var(--line);border-radius:14px}table{border-collapse:collapse;width:100%;font-size:14px}th,td{text-align:left;padding:10px;border-bottom:1px solid var(--line);vertical-align:top}th{position:sticky;top:0;background:#f7f8fc}.history-item{padding:10px 0;border-bottom:1px solid var(--line)}.password-options{margin-top:10px;color:var(--muted);font-size:14px}.password-options label{display:inline-flex;align-items:center;gap:7px}.password-options input{width:auto}.login-status{min-height:24px;margin-top:10px;font-weight:800}.login-status.ok{color:var(--ok)}.login-status.error{color:var(--danger)}.login-status.pending{color:var(--muted)}

@media(max-width:1200px){
  .kiosk-class-grid{grid-template-columns:repeat(5,1fr)}.room-grid{grid-template-columns:repeat(4,1fr)}
  .kiosk-week-grid{grid-template-columns:repeat(2,1fr)}
}
@media(max-width:900px){
  .kiosk-shell{padding:24px 20px 34px}.action-grid{grid-template-columns:1fr}.action-card{min-height:150px}.school-subtitle:before,.school-subtitle:after{display:none}
  .status-card{grid-template-columns:auto 1fr}.selected-class-box{grid-column:1/-1;border-left:0;border-top:1px solid #e7d6bd;padding:18px 0 0;display:flex;align-items:center;justify-content:center;gap:18px}.selected-class-box span,.selected-class-box b{display:inline-block;margin:0}
  .kiosk-class-grid{grid-template-columns:repeat(4,1fr)}.room-grid{grid-template-columns:repeat(3,1fr)}
  .lesson-card{grid-template-columns:70px 130px 1fr}.lesson-room{grid-column:3;text-align:left}.home-lesson{grid-template-columns:55px 1fr 120px}.home-lesson-time{grid-column:2/-1}.home-lesson-room{text-align:right}
  .view-head{align-items:flex-start;flex-wrap:wrap}.kiosk-week-grid{grid-template-columns:1fr}
  .admin-grid{grid-template-columns:1fr}
}
@media(max-width:600px){
  .kiosk-class-grid{grid-template-columns:repeat(3,1fr)}.room-grid{grid-template-columns:repeat(2,1fr)}
  .action-card{grid-template-columns:auto 1fr}.action-arrow{display:none}.status-icon{display:none}.status-card{grid-template-columns:1fr}.home-lesson{grid-template-columns:48px 1fr}.home-lesson-room,.home-lesson-time{grid-column:2;text-align:left}.lesson-card{grid-template-columns:55px 1fr}.lesson-time,.lesson-subject,.lesson-room{grid-column:2}.panel-head{align-items:flex-start;flex-wrap:wrap}
  .admin-shell{padding:14px}.topbar h1{font-size:30px}.row{flex-wrap:wrap}.row input{flex-basis:100%}
}


/* ===================== 0.1.7 KIOSK FLOW ===================== */
.kiosk-body{height:100dvh;min-height:100dvh;overflow:hidden}
.kiosk-shell{height:100dvh;min-height:0;display:flex;flex-direction:column;overflow:hidden}
.kiosk-shell>main{min-height:0}
.home-mode .kiosk-shell>main{flex:0 0 auto}
.home-mode #home{overflow:hidden}
.home-mode .kiosk-footer{margin-top:auto}

/* Internal pages get the whole screen. The large home branding does not
   consume vertical space after a menu item is opened. */
.internal-mode .kiosk-brand,.internal-mode .kiosk-footer{display:none}
.internal-mode .kiosk-shell{padding-top:clamp(24px,2vw,46px);padding-bottom:clamp(24px,2vw,46px)}
.internal-mode .kiosk-shell>main{flex:1 1 auto;height:100%;overflow:hidden}
.internal-mode .kiosk-view{height:100%;overflow-y:auto;overscroll-behavior:contain;padding-right:4px;padding-bottom:32px;scrollbar-width:none}
.internal-mode .kiosk-view::-webkit-scrollbar{display:none}

/* Home is intentionally a single, non-scrollable kiosk dashboard. */
.home-mode .time-panel{padding-bottom:clamp(16px,1.5vw,28px)}
.home-mode .action-grid{margin-bottom:0}
.home-mode .action-card{min-height:clamp(155px,11.5vw,250px)}
@media (orientation:portrait) and (max-height:1500px){
  .home-mode .kiosk-shell{padding-top:18px;padding-bottom:18px}
  .home-mode .crest-wrap{width:clamp(120px,15vw,220px);height:clamp(108px,13.5vw,200px);margin-bottom:0}
  .home-mode .school-name{font-size:clamp(30px,4vw,58px)}
  .home-mode .school-subtitle{font-size:clamp(12px,1.3vw,20px);margin-top:5px}
  .home-mode .time-panel{padding:8px 0 14px}
  .home-mode .mega-clock{font-size:clamp(88px,14vw,190px)}
  .home-mode .mega-date{font-size:clamp(25px,3.3vw,48px)}
  .home-mode .season-line{margin-top:8px;font-size:clamp(12px,1.35vw,20px)}
  .home-mode .action-grid{gap:16px}
  .home-mode .action-card{min-height:120px;padding:18px 22px;border-radius:26px}
  .home-mode .action-icon{width:68px;height:68px}
  .home-mode .action-copy strong{font-size:clamp(24px,2.7vw,38px)}
  .home-mode .action-copy small{font-size:clamp(12px,1.15vw,17px);margin-top:5px}
  .home-mode .action-arrow{width:42px;height:42px;font-size:34px}
  .home-mode .kiosk-footer{padding:16px 20px;margin-top:auto;font-size:clamp(12px,1.3vw,18px)}
}


/* ===================== 0.1.8 PHONE ADAPTATION =====================
   START_KIOSK.bat opens the site with ?kiosk=1. That adds html.kiosk-device,
   so these rules affect normal phones but never change the 2160x3840 kiosk. */
@media (max-width:768px){
  html:not(.kiosk-device){min-height:100%;background:#f8f0e3}
  html:not(.kiosk-device) .kiosk-body{
    height:auto;min-height:100dvh;overflow-x:hidden;overflow-y:auto;
    -webkit-overflow-scrolling:touch;background:#f8f0e3;
  }
  html:not(.kiosk-device) .kiosk-shell{
    width:100%;max-width:none;height:auto;min-height:100dvh;overflow:visible;
    padding:max(12px,env(safe-area-inset-top)) 14px max(18px,env(safe-area-inset-bottom));
    background:
      radial-gradient(circle at 105% 4%,rgba(230,166,69,.18),transparent 28%),
      linear-gradient(180deg,#fffaf1 0%,#f8f0e3 100%);
  }
  html:not(.kiosk-device) .autumn-glow{display:none}

  /* Compact mobile brand */
  html:not(.kiosk-device) .kiosk-brand{
    display:grid;grid-template-columns:68px minmax(0,1fr);grid-template-rows:auto auto;
    column-gap:12px;align-items:center;text-align:left;padding:0 2px;
  }
  html:not(.kiosk-device) .crest-wrap{
    grid-row:1/3;width:68px;height:68px;margin:0;align-self:center;
  }
  html:not(.kiosk-device) .school-name{
    align-self:end;font-size:24px;line-height:1.02;white-space:nowrap;
  }
  html:not(.kiosk-device) .school-subtitle{
    align-self:start;margin-top:3px;font-size:9px;line-height:1.15;letter-spacing:.13em;white-space:nowrap;
  }
  html:not(.kiosk-device) .school-subtitle:before,
  html:not(.kiosk-device) .school-subtitle:after{display:none}

  /* Clock and season */
  html:not(.kiosk-device) .time-panel{padding:12px 0 15px}
  html:not(.kiosk-device) .mega-clock{font-size:72px;line-height:.88;letter-spacing:-.055em}
  html:not(.kiosk-device) .mega-date{font-size:21px;line-height:1.12;margin-top:8px}
  html:not(.kiosk-device) .season-line{margin-top:8px;font-size:10px;line-height:1.3;letter-spacing:.11em}
  html:not(.kiosk-device) .season-line:before,
  html:not(.kiosk-device) .season-line:after{margin:0 .45em}
  html:not(.kiosk-device) .kiosk-offline{font-size:13px;margin:8px 0 12px;padding:10px 12px}

  /* Four touch cards: 2x2 on a phone */
  html:not(.kiosk-device) .action-grid{grid-template-columns:1fr 1fr;gap:10px;margin:0}
  html:not(.kiosk-device) .action-card{
    min-height:132px;border-radius:20px;padding:15px;display:flex;flex-direction:column;
    align-items:flex-start;justify-content:center;gap:9px;box-shadow:0 12px 24px rgba(26,37,55,.15);
  }
  html:not(.kiosk-device) .action-icon{width:44px;height:44px;flex:0 0 44px;border-width:1px}
  html:not(.kiosk-device) .action-copy strong{font-size:19px;line-height:1.04}
  html:not(.kiosk-device) .action-copy small{display:none}
  html:not(.kiosk-device) .action-arrow{display:none}

  /* Mobile home can scroll naturally on very short phones. */
  html:not(.kiosk-device) .home-mode .kiosk-shell>main{flex:0 0 auto}
  html:not(.kiosk-device) .home-mode #home{overflow:visible}
  html:not(.kiosk-device) .home-mode .kiosk-footer{margin-top:18px}
  html:not(.kiosk-device) .kiosk-footer{
    margin-top:18px;border-radius:18px;padding:14px 10px;gap:6px 9px;
    font-size:11px;letter-spacing:.08em;
  }
  html:not(.kiosk-device) .kiosk-footer small{font-size:10px}

  /* Internal pages use normal document scrolling on phones. */
  html:not(.kiosk-device) .internal-mode .kiosk-brand,
  html:not(.kiosk-device) .internal-mode .kiosk-footer{display:none}
  html:not(.kiosk-device) .internal-mode .kiosk-shell{
    height:auto;min-height:100dvh;padding:0 12px max(20px,env(safe-area-inset-bottom));overflow:visible;
  }
  html:not(.kiosk-device) .internal-mode .kiosk-shell>main{height:auto;overflow:visible;flex:1 1 auto}
  html:not(.kiosk-device) .internal-mode .kiosk-view{
    height:auto;overflow:visible;padding:0 0 24px;scrollbar-width:auto;
  }
  html:not(.kiosk-device) .view-head{
    position:sticky;top:0;z-index:20;margin:0 -12px 14px;padding:max(10px,env(safe-area-inset-top)) 12px 10px;
    display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:9px 12px;
    background:rgba(255,250,241,.94);border-bottom:1px solid rgba(205,187,158,.58);
    backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);
  }
  html:not(.kiosk-device) .view-head>div{min-width:0}
  html:not(.kiosk-device) .view-head h1{font-size:23px;line-height:1.05;margin-top:2px;overflow-wrap:anywhere}
  html:not(.kiosk-device) .panel-kicker{font-size:9px;letter-spacing:.12em}
  html:not(.kiosk-device) .back-button,
  html:not(.kiosk-device) .outline-button{min-height:44px;padding:10px 13px;font-size:13px;white-space:nowrap}
  html:not(.kiosk-device) .view-head>.outline-button{grid-column:1/-1;width:100%;margin-top:0}

  /* Class picker */
  html:not(.kiosk-device) .kiosk-class-grid{grid-template-columns:repeat(3,1fr);gap:9px}
  html:not(.kiosk-device) .class-btn{min-height:82px;border-radius:17px;gap:3px;box-shadow:0 8px 18px rgba(60,47,33,.07)}
  html:not(.kiosk-device) .class-btn span{font-size:31px}
  html:not(.kiosk-device) .class-btn small{font-size:10px}

  /* Day schedule cards */
  html:not(.kiosk-device) .kiosk-lesson-list{gap:9px}
  html:not(.kiosk-device) .lesson-card{
    grid-template-columns:46px minmax(0,1fr) auto;
    grid-template-areas:"no subject room" "no time time";
    align-items:center;gap:5px 10px;padding:13px 12px;border-radius:17px;
    box-shadow:0 7px 17px rgba(55,46,36,.06);
  }
  html:not(.kiosk-device) .lesson-card.current{border-width:2px}
  html:not(.kiosk-device) .lesson-card.replacement,
  html:not(.kiosk-device) .lesson-card.cancelled{border-left-width:5px}
  html:not(.kiosk-device) .lesson-no{grid-area:no;font-size:31px;text-align:center;align-self:center}
  html:not(.kiosk-device) .lesson-no.class-no{font-size:22px}
  html:not(.kiosk-device) .lesson-time{grid-area:time;font-size:12px;line-height:1.2;color:#6e7278}
  html:not(.kiosk-device) .lesson-card>div:nth-child(3){grid-area:subject;min-width:0}
  html:not(.kiosk-device) .lesson-subject{font-size:18px;line-height:1.08;overflow-wrap:anywhere}
  html:not(.kiosk-device) .lesson-room{grid-area:room;font-size:12px;line-height:1.1;text-align:right;max-width:90px;overflow-wrap:anywhere}
  html:not(.kiosk-device) .subnote{font-size:11px;line-height:1.25;margin-top:4px}

  /* Week view is stacked by days, no sideways scrolling. */
  html:not(.kiosk-device) .kiosk-week-grid{grid-template-columns:1fr;gap:10px}
  html:not(.kiosk-device) .day-col{border-radius:18px;padding:14px 14px 8px}
  html:not(.kiosk-device) .day-col h3{font-size:22px;margin-bottom:7px}
  html:not(.kiosk-device) .mini-lesson{grid-template-columns:32px minmax(0,1fr);padding:10px 0;gap:9px}
  html:not(.kiosk-device) .mini-n{width:30px;height:30px;font-size:13px}
  html:not(.kiosk-device) .mini-lesson b{font-size:15px;overflow-wrap:anywhere}
  html:not(.kiosk-device) .mini-lesson small{font-size:12px}

  /* Rooms */
  html:not(.kiosk-device) .room-grid{grid-template-columns:repeat(2,1fr);gap:9px}
  html:not(.kiosk-device) .room-btn{min-height:92px;border-radius:17px;padding:10px}
  html:not(.kiosk-device) .room-btn span{font-size:22px;line-height:1.05}
  html:not(.kiosk-device) .room-btn small{font-size:10px}

  /* Admin is usable from a phone too. */
  html:not(.kiosk-device) .admin-shell{padding:12px}
  html:not(.kiosk-device) .topbar{align-items:flex-start;gap:12px;flex-wrap:wrap}
  html:not(.kiosk-device) .topbar h1{font-size:28px;line-height:1.05}
  html:not(.kiosk-device) .topbar .linkbtn{width:100%;text-align:center}
  html:not(.kiosk-device) .card{border-radius:17px;padding:15px}
  html:not(.kiosk-device) .admin-grid{grid-template-columns:1fr;gap:12px}
  html:not(.kiosk-device) .row{flex-direction:column}
  html:not(.kiosk-device) .row input,
  html:not(.kiosk-device) .row button{width:100%}
  html:not(.kiosk-device) .table-wrap{max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
}

@media (max-width:380px){
  html:not(.kiosk-device) .school-name{font-size:21px}
  html:not(.kiosk-device) .school-subtitle{font-size:8px;letter-spacing:.09em}
  html:not(.kiosk-device) .mega-clock{font-size:64px}
  html:not(.kiosk-device) .mega-date{font-size:19px}
  html:not(.kiosk-device) .action-card{min-height:124px;padding:13px}
  html:not(.kiosk-device) .action-copy strong{font-size:17px}
  html:not(.kiosk-device) .kiosk-class-grid{grid-template-columns:repeat(3,1fr)}
}


/* ===================== 0.1.9 DESKTOP BROWSER ADAPTATION =====================
   Normal desktop browsers use the full window. Kiosk mode (?kiosk=1) remains
   isolated by html.kiosk-device and keeps the dedicated 2160x3840 layout. */
@media (min-width:1024px){
  html:not(.kiosk-device){min-height:100%;background:#f8f0e3}
  html:not(.kiosk-device) .kiosk-body{
    height:auto;min-height:100dvh;overflow-x:hidden;overflow-y:auto;background:#f8f0e3;
  }
  html:not(.kiosk-device) .kiosk-shell{
    width:100%;max-width:none;height:auto;min-height:100dvh;overflow:visible;
    padding:24px max(28px,calc((100vw - 1440px)/2)) 32px;
    background:
      radial-gradient(circle at 92% 8%,rgba(230,166,69,.18),transparent 26%),
      radial-gradient(circle at 8% 18%,rgba(191,99,30,.09),transparent 24%),
      linear-gradient(180deg,#fffaf1 0%,#f8f0e3 100%);
  }
  html:not(.kiosk-device) .autumn-glow{opacity:.28}

  /* Compact horizontal school header for a landscape browser window. */
  html:not(.kiosk-device) .kiosk-brand{
    width:100%;display:grid;grid-template-columns:92px minmax(0,1fr);grid-template-rows:auto auto;
    column-gap:20px;align-items:center;text-align:left;padding:0 0 18px;
    border-bottom:1px solid rgba(169,126,70,.18);
  }
  html:not(.kiosk-device) .crest-wrap{
    grid-row:1/3;width:92px;height:92px;margin:0;align-self:center;
  }
  html:not(.kiosk-device) .school-name{
    align-self:end;font-size:38px;line-height:1;white-space:nowrap;
  }
  html:not(.kiosk-device) .school-subtitle{
    align-self:start;margin-top:6px;font-size:12px;line-height:1.2;letter-spacing:.17em;white-space:nowrap;
  }
  html:not(.kiosk-device) .school-subtitle:before,
  html:not(.kiosk-device) .school-subtitle:after{display:none}

  /* Home uses the landscape width instead of shrinking the portrait kiosk. */
  html:not(.kiosk-device) body.home-mode .kiosk-shell>main{flex:0 0 auto}
  html:not(.kiosk-device) body.home-mode #home{
    display:grid;grid-template-columns:minmax(330px,.72fr) minmax(640px,1.28fr);
    gap:42px;align-items:center;overflow:visible;padding:34px 0 12px;
  }
  html:not(.kiosk-device) .time-panel{padding:0;text-align:left}
  html:not(.kiosk-device) .mega-clock{
    font-size:clamp(112px,9.2vw,168px);line-height:.84;letter-spacing:-.055em;text-shadow:none;
  }
  html:not(.kiosk-device) .mega-date{
    font-size:clamp(28px,2.25vw,40px);line-height:1.08;margin-top:16px;
  }
  html:not(.kiosk-device) .season-line{
    margin-top:13px;font-size:clamp(12px,.9vw,16px);line-height:1.3;letter-spacing:.12em;
  }
  html:not(.kiosk-device) .season-line:before{margin-left:0}
  html:not(.kiosk-device) .kiosk-offline{grid-column:1/-1;margin:0 0 10px;font-size:14px}

  html:not(.kiosk-device) .action-grid{
    grid-template-columns:1fr 1fr;gap:16px;margin:0;
  }
  html:not(.kiosk-device) .action-card{
    min-height:154px;border-radius:24px;padding:22px 24px;
    grid-template-columns:64px minmax(0,1fr) 36px;gap:17px;
    box-shadow:0 14px 30px rgba(26,37,55,.14);
  }
  html:not(.kiosk-device) .action-icon{width:64px;height:64px;border-width:1px;box-shadow:none}
  html:not(.kiosk-device) .action-copy strong{font-size:clamp(25px,1.9vw,34px);line-height:1.02}
  html:not(.kiosk-device) .action-copy small{font-size:13px;line-height:1.25;margin-top:7px}
  html:not(.kiosk-device) .action-arrow{width:36px;height:36px;font-size:30px;border-width:1px}

  html:not(.kiosk-device) body.home-mode .kiosk-footer{
    margin-top:24px;padding:15px 22px;border-radius:20px;font-size:14px;gap:12px;
  }
  html:not(.kiosk-device) body.home-mode .kiosk-footer small{font-size:10px}

  /* Internal desktop pages are regular browser pages, not locked kiosk panes. */
  html:not(.kiosk-device) body.internal-mode .kiosk-shell{
    padding-top:26px;padding-bottom:34px;
  }
  html:not(.kiosk-device) body.internal-mode .kiosk-shell>main{
    flex:0 0 auto;height:auto;overflow:visible;
  }
  html:not(.kiosk-device) body.internal-mode .kiosk-view{
    height:auto;min-height:0;overflow:visible;padding-right:0;padding-bottom:20px;
  }
  html:not(.kiosk-device) .view-head{
    margin:0 0 28px;display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:24px;
  }
  html:not(.kiosk-device) .view-head h1{font-size:42px}
  html:not(.kiosk-device) .back-button,
  html:not(.kiosk-device) .outline-button{padding:12px 22px;font-size:15px}
  html:not(.kiosk-device) .kiosk-class-grid{grid-template-columns:repeat(6,1fr);gap:14px}
  html:not(.kiosk-device) .class-btn{min-height:116px;border-radius:22px}
  html:not(.kiosk-device) .class-btn span{font-size:44px}
  html:not(.kiosk-device) .class-btn small{font-size:12px}
  html:not(.kiosk-device) .kiosk-lesson-list{gap:11px}
  html:not(.kiosk-device) .lesson-card{
    grid-template-columns:70px 150px minmax(0,1fr) 150px;gap:18px;
    padding:17px 22px;border-radius:20px;
  }
  html:not(.kiosk-device) .lesson-no{font-size:40px}
  html:not(.kiosk-device) .lesson-no.class-no{font-size:31px}
  html:not(.kiosk-device) .lesson-time{font-size:16px}
  html:not(.kiosk-device) .lesson-subject{font-size:25px}
  html:not(.kiosk-device) .lesson-room{font-size:16px}
  html:not(.kiosk-device) .subnote{font-size:13px}
  html:not(.kiosk-device) .kiosk-week-grid{grid-template-columns:repeat(5,1fr);gap:12px}
  html:not(.kiosk-device) .day-col{padding:16px;border-radius:20px}
  html:not(.kiosk-device) .day-col h3{font-size:22px}
  html:not(.kiosk-device) .room-grid{grid-template-columns:repeat(5,1fr);gap:14px}
  html:not(.kiosk-device) .room-btn{min-height:112px;border-radius:22px}
  html:not(.kiosk-device) .room-btn span{font-size:28px}
}

/* Browser/tablet window between phone and full desktop. */
@media (min-width:769px) and (max-width:1023px){
  html:not(.kiosk-device) .kiosk-body{height:auto;min-height:100dvh;overflow-y:auto}
  html:not(.kiosk-device) .kiosk-shell{height:auto;min-height:100dvh;overflow:visible;padding:20px 24px 28px}
  html:not(.kiosk-device) body.home-mode #home{overflow:visible}
  html:not(.kiosk-device) body.home-mode .kiosk-footer{margin-top:24px}
  html:not(.kiosk-device) body.internal-mode .kiosk-shell>main{height:auto;overflow:visible}
  html:not(.kiosk-device) body.internal-mode .kiosk-view{height:auto;overflow:visible}
}

/* ===================== 0.1.10 KIOSK PASSWORD EXIT ===================== */
.kiosk-exit-button{display:none}
html.kiosk-device .kiosk-exit-button{
  position:fixed;z-index:90;right:max(24px,env(safe-area-inset-right));bottom:max(24px,env(safe-area-inset-bottom));
  display:flex;align-items:center;gap:11px;padding:14px 20px;border-radius:999px;
  background:rgba(16,46,86,.88);color:#fff;border:1px solid rgba(255,255,255,.28);
  box-shadow:0 12px 30px rgba(18,35,55,.22);backdrop-filter:blur(12px);
  font-size:16px;font-weight:800;letter-spacing:.01em;opacity:.62;
}
html.kiosk-device .kiosk-exit-button:hover,
html.kiosk-device .kiosk-exit-button:focus-visible{opacity:1;box-shadow:0 15px 34px rgba(18,35,55,.3)}
.kiosk-exit-lock{width:28px;height:28px;border-radius:50%;display:grid;place-items:center;border:1px solid rgba(255,255,255,.42);font-size:17px}

.exit-modal{position:fixed;z-index:200;inset:0;display:grid;place-items:center;padding:34px;background:rgba(8,25,47,.66);backdrop-filter:blur(10px)}
.exit-modal-card{position:relative;width:min(680px,92vw);padding:46px;border-radius:34px;background:#fffaf1;color:#142d50;border:1px solid rgba(180,139,84,.25);box-shadow:0 35px 90px rgba(6,22,42,.35);text-align:center}
.exit-modal-x{position:absolute;right:20px;top:16px;width:46px;height:46px;border-radius:50%;background:#f1e6d4;color:#17375e;font-size:31px;line-height:1;font-weight:500}
.exit-modal-icon{width:82px;height:82px;margin:0 auto 18px;border-radius:50%;display:grid;place-items:center;background:#f3e4c8;font-size:38px;border:1px solid #e4c896}
.exit-modal-card h2{font-family:Georgia,"Times New Roman",serif;font-size:38px;line-height:1.07;margin:7px 0 12px;color:#102f58}
.exit-modal-card p{margin:0 auto 28px;max-width:520px;color:#637087;font-size:17px}
.exit-password-label{display:block;text-align:left;margin:0 0 8px;font-weight:800;color:#324864}
.exit-password-input{display:block;width:100%;height:62px;border-radius:16px;border:2px solid #ddcfba;background:white;padding:0 18px;color:#122c4e;font-size:20px;outline:none}
.exit-password-input:focus{border-color:#23578c;box-shadow:0 0 0 4px rgba(35,87,140,.12)}
.exit-error{margin-top:12px;padding:12px 14px;border-radius:13px;background:#fff0f2;border:1px solid #e8a8b0;color:#a9283b;font-weight:750;text-align:left}
.exit-modal-actions{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-top:24px}
.exit-cancel,.exit-confirm{height:58px;border-radius:16px;font-size:18px;font-weight:900}
.exit-cancel{background:#eee5d8;color:#27415f}.exit-confirm{background:#a52f3e;color:white;box-shadow:0 10px 22px rgba(165,47,62,.20)}
.exit-confirm:disabled{opacity:.6;cursor:wait}

@media (max-width:768px){
  .exit-modal{padding:18px}
  .exit-modal-card{padding:34px 20px 22px;border-radius:24px}
  .exit-modal-card h2{font-size:28px}
  .exit-modal-card p{font-size:14px}
  .exit-password-input{height:56px;font-size:17px}
  .exit-modal-actions{grid-template-columns:1fr}
}
