html, body { background: var(--bg); }
body { display: block; }
.shell { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.shell > .phone { width: 100%; max-width: var(--w, 560px); height: auto; flex: 1 1 0; min-height: 0; margin: 0 auto;
                  border-radius: 0; box-shadow: none; padding: calc(env(safe-area-inset-top, 0px) + 16px) 16px 6px; }
.shell.asking > .phone { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 12px); overflow-y: auto; }
a { color: var(--on); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--on); outline-offset: 2px; }
@media (hover: hover) {
  button:not(:disabled):hover { filter: var(--hover); }
  .dock button:not(.on):hover, .tabs button:not(.on):hover, .seg button:not(.on):hover { background: var(--panel2); filter: none; }
}
.acg { display: inline-block; fill: currentColor; overflow: visible; margin: 0 0.02em 0 0.06em; flex: none; }
kbd { font: 600 12px/1 ui-monospace, 'Cascadia Mono', Consolas, Menlo, monospace; color: var(--fg); background: var(--panel2);
      border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 2px 5px; white-space: nowrap; }

.shell > .dock { flex: none; margin: 0; background: var(--bg); grid-template-columns: repeat(3, minmax(0, 1fr));
                 padding: 6px max(8px, calc(50% - 272px)) calc(env(safe-area-inset-bottom, 0px) + 8px); }
.dock .brand, .dock .fill, .dock .about, .dock .dockfoot, .dock .maker { display: none; }
.title > .pg { display: none; }
a.maker { color: var(--sub); text-decoration: none; white-space: nowrap; flex: none; font-size: 12px; }
@media (hover: hover) { a.maker:hover { color: var(--fg); text-decoration: underline; } }

.scroll > .col { display: contents; }
.scroll > .col > * { flex-shrink: 0; }
.phone > .foot2 { display: flex; flex-direction: column; gap: 14px; }
.aboutlink { height: 44px; font-size: 13px; color: var(--sub); padding: 0 8px; border: 0; background: none; white-space: nowrap;
             flex: none; align-self: center; margin: -8px 0 -8px auto; }

.quit { height: 30px; font-size: 13px; padding: 0 10px; color: var(--sub); border-radius: 9px; }
.keyhint { display: none; }
.nudge { color: var(--on); }
.shell .qscreen { --f: var(--fit, 1); --ff: calc(0.5 + 0.5 * var(--fit, 1)); }
.shell .qscreen .q { gap: calc(12px * var(--f)); margin-bottom: calc(20px * var(--f)); }
.shell .qscreen .ask { gap: calc(12px * var(--f)) !important; }
.shell .qscreen .slots .val { height: calc(72px * var(--f)); font-size: calc(38px * var(--ff)); }
.shell .qscreen .slots .val.long { font-size: calc(30px * var(--ff)); }
.shell .qscreen .slots .val.xlong { font-size: calc(23px * var(--ff)); }
.shell .qscreen .seqhead { font-size: calc(38px * var(--ff)); }
.shell .qscreen .seq > span { height: calc(52px * var(--f)); }
.shell .qscreen .seq.n3 > span, .shell .qscreen .seq.n4 > span, .shell .qscreen .seq.cn > span { height: calc(64px * var(--f)); }
.shell .qscreen .tones > span { font-size: calc(34px * var(--ff)); }
.shell .qscreen .staffbox { max-width: calc(300px * var(--f)); }
.shell .qscreen .staffbox.wide { max-width: calc(380px * var(--f)); }
.shell .qscreen .staffbox.ks { max-width: calc(300px * var(--f)); }
.shell .qscreen .staffbox.cn { max-width: calc(260px * var(--f)); }
.shell .qscreen .pad .cell { height: calc(64px * var(--f)); }
.shell .qscreen .pad .cell.nat { height: calc(72px * var(--f)); }
.shell .qscreen .pad .cell.x2 { height: calc(50px * var(--f)); }
.shell .qscreen .pad .num button { height: calc(80px * var(--f)); }
.shell .qscreen .pad .sig { height: calc(64px * var(--f)); }
.shell .qscreen .pad .zero { height: calc(56px * var(--f)); }
.shell .qscreen .pad .sp { height: calc(72px * var(--f)); }
.shell .qscreen .pad .sp svg.staff { height: calc(62px * var(--f)); }
.shell .qscreen .pad .foot { height: calc(52px * var(--f)); }
.shell .qscreen .pad .qual button { height: calc(50px * var(--f)); }
.shell .qscreen .kbd { height: calc(230px * var(--f)); }
@media not all and (min-width: 900px) {
  .shell .qscreen .q { --f: var(--fq, 1); --ff: calc(0.5 + 0.5 * var(--fq, 1)); }
  .shell .qscreen .staffbox { --f: var(--fs, 1); }
  .shell .qscreen .pad { --f: var(--fp, 1); --ff: calc(0.5 + 0.5 * var(--fp, 1)); }
}

#turn { display: none; }
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  #app { display: none; }
  #turn { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
          background: var(--bg); color: var(--sub); font-size: 15px; }
  #turn svg { width: 56px; height: 56px; display: block; }
  #turn p { margin: 0; }
}

.about { user-select: text; -webkit-user-select: text; }
.about .card p { margin: 6px 0 0; font-size: 14px; }
.about .keys { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 14px; margin: 10px 0 2px; font-size: 13px; align-items: baseline; }
.about .keys dt { color: var(--sub); white-space: nowrap; }
.about .keys dd { margin: 0; line-height: 1.9; }
@media (hover: none) and (pointer: coarse) { .about .keyhelp { display: none; } }

@media (min-width: 900px) {
  .shell { flex-direction: row; }
  .shell > .dock { order: -1; flex: 0 0 220px; height: 100%; display: flex; flex-direction: column; gap: 4px;
                   padding: 22px 12px 14px; border-top: 0; border-right: 1px solid var(--line); background: var(--panel); }
  .dock .brand { display: block; font-size: 17px; font-weight: 700; padding: 2px 14px 18px; }
  .dock .brand > small { display: block; margin-top: 4px; font-size: 11px; font-weight: 400; color: var(--sub); white-space: nowrap; }
  .dock .maker { display: block; padding: 8px 14px; }
  .title > .pg { display: inline; }
  .title > .app { display: none; }
  .dock .fill { display: block; flex: 1 1 0; }
  .dock button { flex: none; height: 46px; font-size: 16px; padding: 0 14px; display: flex; align-items: center; justify-content: space-between; }
  .dock .about { display: flex; height: 40px; font-size: 13px; }
  .dock .dockfoot { display: flex; align-items: center; gap: 4px; }
  .dock .dockfoot > .about { flex: 1 1 0; min-width: 0; }
  .dock .dockfoot > .thtog { flex: none; width: 40px; height: 40px; padding: 0; margin: 0; justify-content: center; }
  .shell .h > .thtog { display: none; }
  .dock .badge em { position: static; }
  .aboutlink { display: none; }
  .shell > .phone { height: 100%; padding: 28px 32px 24px; }
  .phone[data-view=list], .phone[data-view=about], .phone[data-view=rank] { --w: 760px; }
  .phone[data-view=list], .phone[data-view=free] { gap: 10px; }

  .phone[data-view=home], .phone[data-view=decide], .phone[data-view=look], .phone[data-view=done] { padding-top: clamp(28px, 10vh, 96px); }
  .phone[data-view=home] > .grow, .phone[data-view=decide] > .grow, .phone[data-view=look] > .grow, .phone[data-view=done] > .grow { flex: 0 0 40px; }
  .phone[data-view=end] > .scroll, .phone[data-view=rhead] > .scroll, .phone[data-view=scales] > .scroll { flex: 0 1 auto; }
  .phone[data-view=end] > .grow { flex: 0 0 12px; }

  .shell.asking > .phone.qscreen { --w: 1000px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
                                   grid-template-rows: auto 1fr auto; column-gap: 56px; align-items: center; }
  .qscreen > .prog { grid-column: 1 / -1; grid-row: 1; }
  .qscreen > .space-top, .qscreen > .space-bottom { display: none; }
  .shell .qscreen > .q { grid-column: 1; grid-row: 2; justify-self: end; width: 100%; max-width: 420px; margin-bottom: 0; }
  .qscreen > .pad { grid-column: 2; grid-row: 2; justify-self: start; width: 100%; max-width: 420px; }
  .qscreen > .keyhint { grid-column: 1 / -1; grid-row: 3; }
  html[data-q=v] .shell.asking > .phone.qscreen { --w: 444px; display: flex; flex-direction: column; }
  html[data-q=v] .qscreen > .space-top, html[data-q=v] .qscreen > .space-bottom { display: block; }
  html[data-q=v] .shell .qscreen > .q { max-width: none; margin-bottom: calc(20px * var(--f)); }
  html[data-q=v] .qscreen > .pad { max-width: none; }
}
@media (min-width: 900px) and (hover: hover) and (pointer: fine) {
  .keyhint { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; align-content: center; min-height: 52px;
             font-size: 12px; color: var(--sub); }
  .keyhint > span { white-space: nowrap; }
}

@media (min-width: 1080px) {
  .phone[data-view=free]:has(.cols), .phone[data-view=log] { --w: 1080px; }
  .scroll.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 36px; align-content: start; align-items: start; }
  .scroll.cols > .col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
  .phone[data-view=log] .scroll.cols > .col:first-child { position: sticky; top: 0; }
  .phone[data-view=free]:has(.cols) > .foot2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 36px; align-items: center; }
  .phone[data-view=free]:has(.cols) > .foot2 > #go, .phone[data-view=free]:has(.cols) > .foot2 > .rkmark { grid-column: 2; }
  .phone[data-view=free]:has(.cols) > .foot2:has(.rkmark) > .row2 { grid-row: 1 / span 2; }
}

a.share { display: flex; align-items: center; justify-content: center; flex: none; box-sizing: border-box; text-decoration: none; color: inherit; white-space: nowrap;
  border: 1px solid var(--keyline); background: var(--key); border-radius: 12px; -webkit-tap-highlight-color: transparent; }
a.share:active { filter: var(--press); }
.rankbox { display: grid; gap: 8px; }
.rankbox .rh { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 15px; }
.rankbox .rh > span { color: var(--sub); font-size: 13px; white-space: nowrap; }
.rankbox input { width: 100%; height: 44px; font: inherit; font-size: 16px; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; }
.rankbox input:focus-visible { outline: 2px solid var(--on); outline-offset: 1px; }
.rankbox .rb { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.rankbox button { height: 44px; font-size: 15px; }
.rankbox .note.ng { color: var(--ng); }
.rkcards { display: flex; flex-wrap: wrap; gap: 6px; }
.rkcards button { height: 38px; padding: 0 12px; font-size: 14px; }
.rkcards button.on { color: var(--on); border-color: var(--on); font-weight: 700; }
.rkdiv { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--sub); }
.rkdiv .seg { flex: none; }
.rkdiv .seg button { flex: none; height: 38px; padding: 0 20px; font-size: 14px; }
.card.rank { display: grid; grid-template-columns: 2.2em minmax(0, 1fr) auto auto; gap: 6px 12px; font-size: 15px; align-items: baseline; }
.card.rank > p { grid-column: 1 / -1; }
.card.rank .n { color: var(--sub); text-align: right; font-variant-numeric: tabular-nums; }
.card.rank .nm { font-weight: 700; overflow-wrap: anywhere; }
.card.rank b { text-align: right; font-variant-numeric: tabular-nums; }
.card.rank b small { font-size: 11px; font-weight: 400; color: var(--sub); }
.card.rank .d { color: var(--sub); font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.phone[data-view=rank] { gap: 10px; }
.rkmark { margin: -4px 0 -8px; display: flex; justify-content: center; align-items: center; gap: 10px; font-size: 13px; color: var(--sub); }
.rkmark b { color: var(--on); }
.rkmark.off b { color: var(--fg); }
.rkmark button { flex: none; height: 38px; padding: 0 12px; font-size: 13px; }
.phone[data-view=rank] > .scroll { display: grid; gap: 10px; align-content: start; }
a.share .xlogo { height: 0.9em; width: auto; flex: none; margin-right: 0.32em; fill: var(--xlogo); }
