/* The Roost: the parent side. Plain on purpose, not themed (rtr-07, rtr-08). A phone and an iPad are equal.
   hq.css from the household build was the reference. */
#roost { position: fixed; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; background: #f2f5f7; color: #22333b; font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: 16px; line-height: 1.4; user-select: text; -webkit-user-select: text; z-index: 10; }
#roost .rwrap { max-width: 760px; margin: 0 auto; padding: 14px 12px 80px; }
#roost h1 { font-family: inherit; font-size: 22px; font-weight: 800; color: #22333b; text-shadow: none; margin: 0; }
#roost h2 { font-family: inherit; font-size: 17px; font-weight: 800; color: #22333b; text-shadow: none; -webkit-text-stroke: 0; margin: 0 0 8px; }
#roost h3 { text-shadow: none; }
#roost h3 { font-size: 14px; font-weight: 800; color: #4a5b63; margin: 12px 0 4px; text-transform: uppercase; letter-spacing: .04em; }
#roost p { margin: .3em 0; }
#roost a { color: #c4452c; font-weight: 700; }
.rhead { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.rexit { margin-left: auto; }
.rswitcher { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.rtab { font: inherit; font-weight: 800; font-size: 15px; padding: 9px 16px; border-radius: 10px; border: 1px solid #d5e2e7; background: #dde5e9; color: #22333b; cursor: pointer; min-height: 44px; }
.rtab.on { background: #c4452c; border-color: #c4452c; color: #fff; }
.rtab.add { background: #fff; color: #4a5b63; }
.rtabs { display: flex; gap: 0; margin: 6px 0 10px; border-bottom: 2px solid #d5e2e7; }
.rsub { font: inherit; font-weight: 800; font-size: 15px; padding: 10px 18px; background: none; border: none; border-bottom: 3px solid transparent; margin-bottom: -2px; color: #7e929a; cursor: pointer; min-height: 44px; }
.rsub.on { color: #22333b; border-bottom-color: #c4452c; }
.rcard { background: #fff; border: 1px solid #d5e2e7; border-radius: 12px; padding: 14px 16px; margin: 10px 0; }
.rrow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid #edf2f4; }
.rrow:last-child, .rrow.nob { border-bottom: none; }
.rgrow { flex: 1; min-width: 160px; }
.rlabel { font-weight: 700; }
.rline, .rmuted { color: #7e929a; font-size: 13.5px; }
.rmuted.ok { color: #3e8e5a; font-weight: 700; }
.rattn { background: #fdf1d7; border: 1px solid #eeda9e; border-radius: 10px; padding: 10px 14px; font-weight: 700; margin: 8px 0; }
.rbtn { font: inherit; font-weight: 800; font-size: 14px; background: #3e8e5a; color: #fff; border: none; border-radius: 8px; padding: 9px 14px; cursor: pointer; min-height: 40px; }
.rbtn.red { background: #c4452c; }
.rbtn.ghost { background: #edf2f4; color: #22333b; }
.rbtn.small { font-size: 13px; padding: 6px 10px; min-height: 34px; }
.rbtn[disabled] { opacity: .5; cursor: default; }
.rbtn[data-armed] { background: #a03920; }
#roost input, #roost select, #roost textarea { font: inherit; font-size: 16px; padding: 8px 10px; border: 1px solid #c8d6dc; border-radius: 8px; background: #fff; color: inherit; }
.rnum { width: 84px; text-align: center; }
.rnumwrap { display: inline-flex; align-items: center; gap: 6px; }
.rsuffix { color: #7e929a; font-size: 13px; }
.rswitch { display: inline-flex; align-items: center; gap: 8px; font: inherit; font-weight: 800; font-size: 13px; background: #fff; border: 1px solid #c8d6dc; border-radius: 999px; padding: 4px 12px 4px 4px; cursor: pointer; color: #7e929a; min-height: 36px; }
.rswitch .knob { width: 26px; height: 26px; border-radius: 50%; background: #c8d6dc; transition: background .15s; }
.rswitch.on { color: #3e8e5a; border-color: #3e8e5a; }
.rswitch.on .knob { background: #3e8e5a; }
.rseg { display: inline-flex; border: 1px solid #c8d6dc; border-radius: 10px; overflow: hidden; }
.rsegbtn { font: inherit; font-weight: 700; font-size: 13px; padding: 8px 12px; background: #f7fafb; color: #4a5b63; border: none; border-right: 1px solid #c8d6dc; cursor: pointer; min-height: 38px; }
.rsegbtn:last-child { border-right: none; }
.rsegbtn.on { background: #3e8e5a; color: #fff; }
.rconfirm { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: #fdf1d7; border: 1px solid #eeda9e; border-radius: 10px; padding: 8px 12px; font-size: 14px; }
.rconfirm.danger { background: #fdf1ee; border-color: #ecc8bd; }
.rconfirmtext { flex: 1; min-width: 160px; font-weight: 700; }
.rfeedback { width: 100%; resize: vertical; }
.rreply { flex: 1; min-width: 200px; }
.rfoot { color: #7e929a; font-size: 12.5px; text-align: center; margin-top: 24px; }
.rfoot a { color: #7e929a; }
.rchips { display: flex; gap: 6px; flex-wrap: wrap; }
.rchip { background: #edf2f4; border-radius: 8px; padding: 3px 9px; font-size: 13px; font-weight: 700; }
.rchip.roosted { background: #ddefe2; color: #2c6e44; }
.rchip.chick { background: #fdf1d7; color: #8a6d1d; }
.rchip.trouble { background: #f8dcd4; color: #a03920; }
.rchip.due { background: #e4e9f5; color: #44518a; }
.rchip.nest { background: #edf2f4; color: #4a5b63; }
#roost details { margin-top: 6px; }
#roost summary { cursor: pointer; font-weight: 800; color: #7e929a; padding: 6px 0; }

/* the door: PIN screens keep the game look (they sit on the start screen's side of the fence) */
.roostdoor input.pin { font: inherit; font-size: 2rem; letter-spacing: .5em; padding: 10px 14px; border: 3px solid var(--wood3); border-radius: 12px; width: 100%; max-width: 240px; text-align: center; background: #fff; }

/* the setup screens: screen 4 */
.racesaday { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 14px 0 6px; }
.racesbtn { min-width: 56px; font-size: 1.4rem; }
.goalnote { margin-bottom: 6px; }

/* the Summary */
.rstats { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.rstat { background: #f2f7f9; border: 1px solid #d5e2e7; border-radius: 10px; padding: 8px 12px; text-align: center; min-width: 78px; flex: 1; }
.rstat .n { font-size: 22px; font-weight: 800; line-height: 1.1; }
.rstat .l { font-size: 12px; color: #7e929a; font-weight: 600; }
.rnests { display: flex; gap: 6px; align-items: flex-end; margin: 6px 0; }
.rnest { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: #7e929a; min-width: 34px; }
.rnest i { font-style: normal; font-size: 20px; opacity: .35; }
.rnest.met i { opacity: 1; }
.rnest.today { font-weight: 800; color: #22333b; }
.rclimb { display: flex; gap: 5px; align-items: flex-end; height: 72px; padding: 4px 0; }
.rclimb .bar { flex: 1; border-radius: 4px 4px 0 0; background: linear-gradient(#8ed05c, #4c8a28); min-height: 4px; position: relative; }
.rclimb .bar span { position: absolute; top: -16px; left: 0; right: 0; text-align: center; font-size: 10px; color: #4a5b63; }
.rclimb.small { height: 36px; width: 120px; }
.rclimb.small .bar span { display: none; }
.rlegend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13px; margin-top: 6px; }
.rlegend span::before { content: ''; display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.rlegend .roosted::before { background: var(--gold); }
.rlegend .chick::before { background: #cfe3f3; }
.rlegend .nest::before { background: #e6ebee; }
#roost .map { width: min(100%, 360px); margin: 0 auto; }
#roost .map .mcell.st-roosted { background: var(--gold); }
#roost .map .mcell.st-chick { background: #cfe3f3; }
#roost .map .mcell.st-nest { background: #e6ebee; }
#roost .map .mcell.trouble::after { content: '•'; color: #a03920; font-size: 12px; line-height: 1; position: absolute; }
#roost .map .mcell { position: relative; cursor: pointer; }
#roost .map .mcell.picked { outline: 2px solid #22333b; outline-offset: -2px; }
.rfactpop { background: #22333b; color: #fff; border-radius: 10px; padding: 8px 12px; font-size: 13.5px; margin: 8px auto 0; max-width: 360px; }
.rtrack { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid #edf2f4; }
.rtrack:last-child { border-bottom: none; }
.rtrack .rgrow { min-width: 180px; }
.ractions { display: flex; gap: 8px; flex-wrap: wrap; }
.rmiss { align-items: flex-start; }
.rheard { font-family: ui-monospace, Menlo, monospace; background: #edf2f4; border-radius: 6px; padding: 1px 6px; }
.rfact { display: flex; gap: 10px; align-items: baseline; padding: 4px 0 4px 10px; font-size: 14px; flex-wrap: wrap; }
.rfact b { min-width: 72px; }
.runlock { background: #fff8e6; border-color: #eeda9e; }
.rstep { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid #edf2f4; }
.rstep:last-child { border-bottom: none; }
@media (max-width: 480px) { #roost .rwrap { padding: 10px 8px 60px; } .rstat { min-width: 64px; padding: 6px 8px; } .rstat .n { font-size: 18px; } #roost .map { width: 100%; } }

/* stage 4o: the status line, Needs you, two columns on a wide screen, the step table, the feedback link */
.rstatus { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline; background: #fff; border: 1px solid #d5e2e7; border-radius: 12px; padding: 12px 16px; margin: 10px 0; font-size: 15px; color: #4a5b63; }
.rstatus b { font-size: 18px; color: #22333b; }
.rstatus span::before { content: '·'; margin-right: 18px; color: #c8d6dc; }
.rattnhead { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: #8a6d1d; margin-bottom: 4px; }
.rattnline { margin: 3px 0; }
.rattn .rcard { margin: 8px 0 2px; }
.rcols { display: block; }
@media (min-width: 1000px) {
  #roost .rwrap { max-width: 1200px; padding-left: 20px; padding-right: 20px; }
  .rcols { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 16px; align-items: start; }
  .rcols .rcard:first-child { margin-top: 0; }
}
#roost .factchart.parent .chartbody { flex-direction: column; }
#roost .factchart.parent .chartside { flex: 0 0 auto; flex-direction: row; flex-wrap: wrap; }
#roost .factchart.parent .listbox { flex: 1 1 200px; background: #f2f5f7; }
#roost .factchart.parent .listbox h3 { color: #22333b; text-shadow: none; font-family: inherit; font-size: 14px; text-transform: none; letter-spacing: 0; margin: 0 0 6px; }
#roost .factchart.parent .listbox .empty { color: #7e929a; }
#roost .factchart.parent .legend { flex-direction: row; flex-wrap: wrap; gap: 6px 14px; color: #4a5b63; flex: 1 1 100%; }
#roost .factchart.parent .chartsum, #roost .factchart.parent .chartmain { background: #fbf6ea; }
#roost .fc.tap { cursor: pointer; border-style: solid; font: inherit; font-family: 'Lilita One', sans-serif; padding: 0; }
#roost .fc.trouble::after { content: ''; position: absolute; top: 3px; right: 3px; width: 7px; height: 7px; border-radius: 50%; background: #c4452c; }
#roost .fc { position: relative; }
#roost .fc.picked { outline: 3px solid #22333b; outline-offset: 1px; }
#roost .sw.trouble { background: #fff; border: 2px solid #d9c49c; position: relative; }
#roost .sw.trouble::after { content: ''; position: absolute; top: 2px; right: 2px; width: 6px; height: 6px; border-radius: 50%; background: #c4452c; }
.rsteptable { display: flex; flex-direction: column; margin-top: 6px; }
.rsteprow { display: grid; grid-template-columns: minmax(110px, 2fr) repeat(4, minmax(44px, 1fr)) minmax(70px, 1.3fr); align-items: center; gap: 6px; padding: 8px 6px; border: none; border-bottom: 1px solid #edf2f4; background: none; font: inherit; text-align: left; color: inherit; width: 100%; cursor: pointer; }
.rsteprow.head { cursor: default; font-size: 12px; font-weight: 800; color: #7e929a; text-transform: uppercase; letter-spacing: .03em; }
.rsteprow.current { background: #f2f9f4; }
.rsteprow.open { background: #f7fafb; }
.rsteprow .n { text-align: center; font-weight: 700; }
.rsteprow .n.good { color: #2c6e44; } .rsteprow .n.bad { color: #a03920; } .rsteprow .n.dim { color: #9aaab0; }
.rstepname { font-weight: 700; }
.rsteprow .rclimb.small { display: flex; align-items: flex-end; gap: 2px; height: 24px; }
.rsteprow .rclimb.small .bar { width: 6px; }
.rstepfacts { padding: 4px 10px 10px; border-bottom: 1px solid #edf2f4; }
.rfblink { color: #7e929a !important; }
.rfbhost { margin-top: 10px; }
#roost .rclimb .bar { border: none; box-shadow: none; }
#roost .factchart.parent .chartmain { order: -1; }
#roost .factchart.parent .legend { display: flex; flex-wrap: wrap; gap: 4px 14px; }
#roost .factchart.parent .legend > div { margin: 0; }
#roost .rattnline .rbtn { margin-left: 10px; vertical-align: middle; }
/* stage 5c: the fact's history pops up beside the cell */
.rfactpop { position: fixed; z-index: 50; margin: 0; width: max-content; max-width: min(320px, calc(100vw - 16px)); padding: 10px 34px 10px 14px; box-shadow: 0 8px 24px rgba(0,0,0,.28); line-height: 1.45; }
.rfactx { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border: none; border-radius: 50%; background: #ffffff22; color: #fff; font-size: 13px; cursor: pointer; }
