:root { --fs: 46px; --bg: #1e2228; --panel: #2a2f37; --fg: #f5f5f5; --dim: #9aa3ad; --green: #3fc06b; --yellow: #f2c03c; --red: #ee554b; --cur: #1f5fa8; --orange: #e88a2e; --accent: #1f5fa8; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); font-family: -apple-system, "Hiragino Sans", "Yu Gothic UI", sans-serif; overflow: hidden; -webkit-user-select: none; user-select: none; -webkit-text-size-adjust: 100%; }
body { display: flex; flex-direction: column; height: 100vh; height: 100dvh; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.green { color: var(--green); } .yellow { color: var(--yellow); } .red { color: var(--red); } .dim { color: var(--dim); }

header { display: flex; align-items: center; gap: 12px; padding: 6px 10px; background: #111418; font-size: 20px; flex: none; }
.beta { background: #7b2fbf; color: #fff; font-weight: 800; padding: 4px 10px; border-radius: 6px; font-size: 18px; white-space: nowrap; }
#apptitle { font-weight: 700; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 18px; color: var(--dim); }
.conn { font-weight: 800; padding: 4px 12px; border-radius: 20px; white-space: nowrap; font-size: 19px; }
.conn.on { background: #164d2a; color: #7dffaa; }
.conn.try, .conn.nohost { background: #5a4710; color: #ffe07a; }
.conn.off { background: #5c1616; color: #ffb0a8; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .55; } }
.bat { font-weight: 800; font-size: 22px; white-space: nowrap; }
.bat.old { opacity: .6; }
#clock { font-variant-numeric: tabular-nums; font-size: 22px; color: var(--dim); }
.hbtn { background: var(--panel); color: var(--fg); border: 0; font-size: 22px; border-radius: 8px; padding: 6px 12px; }

main { flex: 1; display: grid; grid-template-columns: 36% 1fr; gap: 8px; padding: 8px; min-height: 0; }
#timer { background: var(--panel); border-radius: 10px; padding: 10px 14px; overflow-y: auto; min-height: 0; }
#slideno { font-size: 22px; font-weight: 800; }
#slidetitle { font-size: 22px; margin: 2px 0 4px; line-height: 1.3; }
.remain { font-size: 112px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; margin: 4px 0; }
.barbg { height: 12px; background: #1a1d22; border-radius: 6px; overflow: hidden; }
.fill { height: 100%; background: var(--green); } .fill.yellow { background: var(--yellow); } .fill.red { background: var(--red); } .fill.dim { background: var(--dim); }
.behind { font-size: 22px; font-weight: 800; margin-top: 6px; }
#seg { font-size: 19px; font-weight: 700; margin-top: 4px; }
#elapsed { font-size: 16px; color: var(--dim); margin-top: 2px; }
.work { font-size: 26px; font-weight: 800; margin-top: 4px; }
#pausing { font-size: 26px; font-weight: 800; color: var(--orange); }
.must { background: var(--orange); color: #000; font-weight: 800; font-size: 22px; padding: 8px 10px; border-radius: 8px; margin: 6px 0; line-height: 1.35; }
.fix { background: #c62828; color: #fff; font-weight: 800; font-size: 20px; padding: 8px 10px; border-radius: 8px; margin: 6px 0; }
#memo { font-size: 16px; color: var(--dim); margin-top: 6px; white-space: normal; } #memo.user { color: var(--yellow); }
.nhead { font-size: 15px; color: var(--dim); font-weight: 700; margin-top: 10px; }
.nrow { display: flex; justify-content: space-between; gap: 8px; font-size: 16px; color: var(--dim); padding: 1px 0; }
.nrow span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .nrow b { color: var(--fg); } .nrow b.yellow { color: var(--yellow); }
#test { background: var(--orange); color: #000; font-weight: 800; padding: 4px 8px; border-radius: 6px; margin-bottom: 6px; }

#flow { overflow-y: auto; min-height: 0; scroll-behavior: smooth; padding-right: 4px; }
.card { background: var(--panel); border-radius: 10px; padding: 8px 14px; margin: 0 0 8px; }
.card .head { font-size: 19px; font-weight: 700; }
.card .sno { color: var(--dim); font-weight: 400; font-size: 16px; }
.card .body { font-size: 22px; line-height: 1.4; margin-top: 2px; white-space: normal; word-break: break-word; }
.card .sub { font-size: 16px; color: var(--dim); margin-top: 2px; }
.card.done { opacity: .45; }
.card.k-slide { border-left: 6px solid var(--yellow); } .card.k-slide .head { color: var(--yellow); }
.card.k-work { border-left: 6px solid var(--green); }
.card.cur { background: var(--cur); padding: 12px 18px; }
.card.cur .head { font-size: 26px; color: #fff; }
.card.cur .body { font-size: var(--fs); font-weight: 700; line-height: 1.38; }
.card.cur .sub { font-size: 22px; color: #d6e4f5; }
.card .body.big { color: var(--yellow); font-weight: 700; }
.card.k-must, .card.k-warn { background: #6a4510; } .card.cur.k-must, .card.cur.k-warn { background: var(--orange); } .card.cur.k-must .body, .card.cur.k-warn .body, .card.cur.k-must .head, .card.cur.k-warn .head { color: #000; }
.card.k-fix { background: #5c1616; } .card.cur.k-fix { background: #c62828; } .card.k-fix .body { color: #fff; }
.card.end { font-size: 30px; color: var(--green); font-weight: 800; }
.wait { font-size: 30px; color: var(--dim); padding: 40px 20px; text-align: center; line-height: 1.6; } .wait small { font-size: 20px; }
#status { font-size: 16px; color: var(--yellow); padding: 0 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: none; min-height: 20px; }

footer { flex: none; display: grid; grid-template-columns: repeat(4, 1fr) 2.2fr; grid-template-rows: 78px 78px; gap: 8px; padding: 6px 8px 8px; }
footer button, .modal button { font-size: 22px; font-weight: 700; border: 0; border-radius: 12px; background: #3a414c; color: #fff; touch-action: manipulation; }
footer button:active, .modal button:active { filter: brightness(1.4); transform: scale(.98); }
footer button:disabled { opacity: .35; }
#next-btn { grid-column: 5; grid-row: 1 / span 2; font-size: 46px; background: var(--accent); }
.b-skip { background: var(--orange) !important; color: #000 !important; }
.b-small { font-size: 20px !important; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.75); display: flex; align-items: center; justify-content: center; z-index: 10; }
.modal[hidden] { display: none; }
.mbox { background: var(--panel); border-radius: 16px; padding: 20px 24px; width: min(720px, 94vw); max-height: 92vh; overflow-y: auto; }
.mbox h2 { margin: 0 0 12px; font-size: 28px; }
.mbox p { font-size: 19px; line-height: 1.5; color: #dde; }
#paircode { font-size: 64px; letter-spacing: 14px; width: 100%; text-align: center; padding: 10px; border-radius: 12px; border: 0; background: #fff; color: #000; font-weight: 800; -webkit-user-select: text; user-select: text; }
#pairmsg { font-size: 22px; color: var(--yellow); min-height: 30px; margin: 8px 0; }
.mrow { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; } .mrow button { flex: 1; min-height: 72px; min-width: 140px; }
.primary { background: var(--accent) !important; }
#jumpval { font-size: 80px; font-weight: 800; text-align: center; min-height: 96px; font-variant-numeric: tabular-nums; }
#jumptitle { text-align: center; font-size: 22px; min-height: 30px; color: var(--dim); }
#jumphint { text-align: center; color: var(--dim); font-size: 18px; }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; } .pad button { height: 86px; font-size: 40px; }
#listbody { max-height: 70vh; overflow-y: auto; }
.lrow { font-size: 22px; padding: 10px 8px; border-bottom: 1px solid #3a414c; } .lrow.cur { background: var(--cur); } .lrow b { display: inline-block; width: 52px; color: var(--yellow); }
#baturl { width: 100%; font-size: 15px; padding: 8px; border-radius: 8px; border: 0; -webkit-user-select: text; user-select: text; }
#setinfo { font-size: 15px; color: var(--dim); }
.toast { position: fixed; left: 50%; bottom: 190px; transform: translateX(-50%); background: #000c; color: #fff; font-size: 24px; padding: 12px 22px; border-radius: 12px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 20; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; } .toast.bad { background: #8b1d1dee; }
body:not(.linked) main { opacity: .8; }

/* 縦向き（834×1112 など） */
@media (orientation: portrait) {
  main { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  #timer { max-height: 38vh; display: grid; grid-template-columns: auto 1fr; column-gap: 16px; align-content: start; }
  #timer > * { grid-column: 2; }
  #timer > .remain { grid-column: 1; grid-row: 1 / span 4; font-size: 100px; align-self: center; }
  #timer > .barbg { grid-column: 1 / span 2; }
  #timer > .nhead, #next { display: none; }
  footer { grid-template-columns: repeat(4, 1fr); grid-template-rows: 70px 70px 96px; }
  #next-btn { grid-column: 1 / span 4; grid-row: 3; font-size: 44px; }
  header { font-size: 17px; } #apptitle { display: none; }
}
