/* LifeGame web — colors from the UIKit MainUI (TopBarView/SidebarViewController/
   BottomBarView) and the onboarding mockup */
* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; }
body {
    font-family: "Helvetica Neue", system-ui, sans-serif;
    background: #22262e; color: #eceff0;
}
button { font: inherit; color: inherit; background: none;
         border: none; cursor: pointer; }
input, select {
    font: inherit; color: #111; background: #fff;
    border: 1px solid #cfd4da; border-radius: 8px; padding: 7px 10px;
}
input.invalid { border: 2px solid #e02020; }

:root {
    --wk-blue: rgb(0, 107, 200);
    --sidebar-bg: rgb(19, 25, 31);
    --bottom-bg: rgb(33, 35, 39);
    --canvas-bg: #22262e;
    --yellow: #f5d328;
    --green: #70bf41;
    --select-green: #34c759;
}

/* ---------- splash ---------- */
.splash {
    height: 100%; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 24px;
    background: #fff;
}
.splash-logo { max-width: min(480px, 70vw); height: auto; }
.splash-footer { color: #667; font-size: 11px; }

/* ---------- onboarding ---------- */
.onboarding {
    min-height: 100%; display: flex; flex-direction: column;
    align-items: center; padding: 18px 16px 8px;
    background: var(--wk-blue); color: #fff;
}
.onboarding h1 { margin: 0; font-size: 24px; font-weight: 600; }
.required-note { margin: 2px 0 14px; font-size: 12px; }
.profile-form { display: flex; flex-direction: column; gap: 8px; }
.profile-row {
    display: grid; grid-template-columns: 175px 255px 26px;
    align-items: center; gap: 8px;
}
.profile-row > label { text-align: right; font-size: 14px; font-weight: 600; }
.profile-row .req { color: #ff5b5b; }
.profile-row input, .profile-row select { width: 100%; }
.info-btn { color: #fff; font-size: 17px; padding: 0; line-height: 1; }
.segmented {
    display: flex; background: #eef0f2; border-radius: 8px; padding: 2px;
}
.segmented button {
    flex: 1; color: #111; font-size: 13px; padding: 5px 10px;
    border-radius: 6px; white-space: nowrap;
}
.segmented button.selected { background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.onboarding-footer {
    margin-top: auto; padding-top: 24px;
    display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.tutorial-btn {
    color: #fff; border: 1px solid rgba(255,255,255,.7);
    border-radius: 18px; padding: 7px 28px; font-size: 15px;
}
.get-started-btn {
    color: #fff; font-weight: 700; background: #3d8fe0;
    border-radius: 18px; padding: 8px 32px; font-size: 16px;
}
.copyright { font-size: 10px; margin: 12px 0 0; }

/* ---------- main frame ---------- */
.main-screen { height: 100%; display: flex; flex-direction: column; }
.middle { flex: 1; display: flex; min-height: 0; }

/* top bar */
.topbar {
    position: relative; display: flex; align-items: center;
    height: 52px; padding: 0 14px; background: var(--wk-blue);
}
.icon-btn { color: #fff; font-size: 22px; padding: 4px 8px; }
.topbar-center {
    position: absolute; left: 50%; transform: translateX(-50%);
    display: flex; align-items: center; gap: 22px;
}
.plus-btn { font-size: 30px; font-weight: 300; }
.minus-btn { font-size: 38px; font-weight: 300; line-height: 0; }
.user-name { color: #fff; font-size: 22px; font-weight: 200; }
.link-btn { margin-left: auto; }
.gear-menu, .new-menu, .add-menu { position: relative; }
.menu {
    position: absolute; top: 110%; left: 0; z-index: 30;
    max-height: 65vh; overflow-y: auto; min-width: 230px;
    background: #2a2f37; border: 1px solid #3a3f47; border-radius: 8px;
    display: flex; flex-direction: column; padding: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.menu.hidden { display: none; }
.menu button {
    color: #eceff0; text-align: left; padding: 7px 10px; border-radius: 6px;
}
.menu button:hover { background: #3a4049; }

/* sidebar */
.sidebar {
    width: 280px; overflow-y: auto; padding: 8px 0;
    background: var(--sidebar-bg);
}
.side-header {
    display: flex; justify-content: space-between;
    padding: 4px 16px 8px; font-size: 12px; font-weight: 700;
    color: rgba(255,255,255,.6);
}
.side-row {
    display: flex; align-items: center; gap: 4px;
    padding: 7px 16px 7px 6px; cursor: pointer;
}
.side-row:hover { background: rgba(255,255,255,.05); }
.side-row .chevron {
    width: 22px; color: rgba(255,255,255,.6); font-size: 15px; padding: 0;
}
.side-row .chevron-pad { width: 22px; }
.side-row .side-title { flex: 1; font-size: 16px; }
.side-row .side-amount {
    font-weight: 700; font-size: 15px;
    font-variant-numeric: tabular-nums;
}
.side-row.child .side-title { font-weight: 300; padding-left: 14px; }
.side-row.child .side-amount { color: rgba(255,255,255,.85); }
.side-row.selected .side-title,
.side-row.selected .side-amount { color: var(--select-green); }

/* canvas: summary */
#canvas { flex: 1; min-width: 0; background: var(--canvas-bg);
          position: relative; overflow: hidden; }
.summary-panel { padding: 26px; display: flex; flex-direction: column;
                 gap: 14px; }
.summary-row { display: flex; gap: 18px; font-size: 18px; }
.summary-row.indent { padding-left: 26px; }

/* canvas: timeline */
.timeline { height: 100%; display: flex; flex-direction: column; }
.new-menu { padding: 12px; }
.new-btn {
    background: var(--wk-blue); color: #fff; font-size: 14px;
    padding: 6px 16px; border-radius: 15px;
}
.timeline-scroller { flex: 1; overflow-x: auto; overflow-y: auto;
                     position: relative; }
.timeline-content { position: relative; }
.year-line {
    position: absolute; top: 0; bottom: 26px; width: 0;
    border-left: 1px dashed rgba(238, 239, 240, .35);
}
.year-label {
    position: absolute; bottom: 6px; font-size: 13px;
    color: rgb(238, 239, 240);
}
.today-label {
    position: absolute; bottom: 6px; font-size: 13px; font-weight: 700;
    color: var(--yellow);
}
.duration-line { position: absolute; height: 2px; background: #fff; }
.timeline-item {
    position: absolute; display: flex; flex-direction: column;
    align-items: center; gap: 2px; padding: 0; color: rgba(255,255,255,.85);
    font-size: 11px; font-weight: 300; white-space: nowrap;
}
.timeline-item img { display: block; }

/* bottom bar */
.bottombar {
    display: flex; align-items: center; height: 86px;
    padding: 0 30px; background: var(--bottom-bg); gap: 8px;
}
.scale-end { display: flex; flex-direction: column; align-items: center;
             width: 90px; }
.scale-value { font-size: 24px; font-weight: 700; }
.scale-caption { font-size: 10px; font-weight: 300; }
.scale-line-wrap { position: relative; flex: 1; height: 100%; }
.scale-line {
    position: absolute; left: 0; right: 0; top: 50%; height: 4px;
    margin-top: -2px; background: var(--green);
}
.scale-marker { position: absolute; top: 0; bottom: 0; width: 0; }
.marker-tick {
    position: absolute; top: 50%; left: -2px; width: 4px; height: 24px;
    margin-top: -12px;
}
.marker-value {
    position: absolute; top: 8px; left: -40px; width: 80px;
    text-align: center; font-size: 20px; font-weight: 700;
}
.marker-caption {
    position: absolute; left: -85px; width: 170px; text-align: center;
    font-size: 10px; font-weight: 300; top: 26px;
}
.bottombar .scale-marker .marker-caption { top: calc(50% + 14px); }

/* form modal (unchanged palette, matches property sheets) */
.modal-overlay {
    position: fixed; inset: 0; z-index: 50;
    background: rgba(8, 10, 12, .65);
    display: flex; align-items: center; justify-content: center;
}
.modal {
    width: min(980px, 94vw); max-height: 88vh; overflow-y: auto;
    background: #21262e; border: 1px solid #3a3f47; border-radius: 12px;
    padding: 20px 24px;
}
.modal h2 { margin: 0 0 12px; font-size: 18px; }
.modal button {
    background: #2a2e35; border: 1px solid #3a3f47; border-radius: 6px;
    padding: 6px 12px;
}
.modal button.danger { color: #ff7b72; }
.settings-modal { width: min(480px, 94vw); }
.form-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.form-tabs button.selected { background: var(--wk-blue); border-color: var(--wk-blue); }
.guard-note { color: var(--yellow); font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.form-col { display: flex; flex-direction: column; gap: 12px; }
.form-field { display: flex; flex-direction: column; gap: 4px; }
.form-field > span { font-size: 12px; color: #9aa1ab; cursor: help; }
.form-field input, .form-field select {
    width: 100%; color: #eceff0; background: #191d23;
    border: 1px solid #3a3f47;
}
.modal .segmented { background: #191d23; }
.modal .segmented button { color: #eceff0; border: none; }
.modal .segmented button.selected { background: var(--wk-blue); }
.hook-note { color: #6f7681; font-size: 12px; font-style: italic; }
.modal-buttons { display: flex; justify-content: space-between;
                 margin-top: 20px; gap: 8px; flex-wrap: wrap; }

@media (max-width: 800px) {
    .form-grid { grid-template-columns: 1fr; }
    .sidebar { width: 210px; }
    .profile-row { grid-template-columns: 120px 1fr 26px; }
    .profile-row > label { font-size: 12px; }
}

/* ---------- cascading menus ---------- */
.menu.cascade { min-width: 200px; overflow: visible; max-height: none; }
.submenu { position: relative; }
.submenu-label {
    width: 100%; display: flex; justify-content: space-between;
    align-items: center; gap: 12px;
}
.sub-arrow { color: rgba(255,255,255,.5); }
.submenu > .menu {
    display: none; position: absolute; left: 100%; top: -6px;
}
.submenu:hover > .menu,
.submenu.open > .menu { display: flex; }

/* ---------- help / document viewers ---------- */
.doc-panel {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    width: min(860px, 94vw); height: 88vh; padding: 12px;
    background: rgb(1, 106, 200); border-radius: 12px;
}
.doc-panel.fullscreen {
    width: 100vw; height: 100vh; border-radius: 0; background: #fff;
    padding: 0; gap: 0;
}
.doc-done {
    background: #e03b30; color: #fff; font-weight: 600;
    padding: 7px 26px; border-radius: 8px;
}
.doc-panel.fullscreen .doc-done {
    width: 100%; border-radius: 0; padding: 16px;
    background: rgb(81, 167, 249);
}
.doc-frame {
    flex: 1; width: 100%; border: none; border-radius: 8px;
    background: #fff;
}
.doc-panel.fullscreen .doc-frame { border-radius: 0; }
.doc-newtab { color: #fff; font-size: 12px; }

/* ---------- terms and agreement ---------- */
.agreement {
    height: 100%; display: flex; flex-direction: column;
    align-items: center; gap: 12px; padding: 16px;
    background: rgb(1, 106, 200);
}
.agreement h1 { margin: 0; color: #fff; font-size: 28px; font-weight: 600; }
.terms-frame {
    flex: 1; width: min(900px, 100%); border: none; border-radius: 8px;
    background: #fff;
}
.agreement-buttons { display: flex; gap: 16px; width: 420px; max-width: 90vw; }
.agreement-buttons button {
    flex: 1; color: #fff; padding: 11px 0; border-radius: 22px; font-size: 16px;
}
.decline-btn { border: 0.5px solid rgba(255,255,255,.6); }
.accept-btn { background: rgb(81, 167, 249); font-weight: 700; }

/* timeline drag affordance */
.timeline-scroller { cursor: grab; }
.timeline-scroller:active { cursor: grabbing; }

/* ---------- property sheet (UIKit PropertySheetFormViewController) ---------- */
.propsheet {
    width: min(760px, 94vw); max-height: 92vh;
    display: flex; flex-direction: column;
    background: rgb(1, 95, 184); border-radius: 12px; overflow: hidden;
}
.ps-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px;
}
.ps-title { color: #fff; font-size: 18px; font-weight: 500; }
.ps-cancel { color: #fff; font-size: 16px; padding: 6px 4px; }
.ps-trash { color: #fff; font-size: 20px; padding: 4px 6px; }
.ps-primary {
    background: rgb(1, 106, 200); color: #fff; font-weight: 600;
    border-radius: 15px; padding: 6px 20px;
}
.ps-body { overflow-y: auto; padding: 0 20px 20px; }
.ps-section {
    color: var(--yellow); font-weight: 700; font-size: 15px;
    padding: 14px 0 8px; border-top: 1px solid rgba(255,255,255,.25);
    margin-top: 10px;
}
.ps-section:first-child { border-top: none; margin-top: 0; }
.ps-row {
    display: grid; grid-template-columns: 1fr 30px 220px;
    align-items: center; gap: 8px; padding: 5px 0;
}
.ps-label { color: #fff; font-size: 14px; }
.ps-help button {
    color: #7dff9e; font-size: 16px; padding: 0; line-height: 1;
}
.ps-control input, .ps-control select {
    width: 100%; color: #111; background: #d5d6d9;
    border: none; border-radius: 8px; padding: 8px 10px;
    text-align: center; font-size: 14px;
}
.ps-control input::placeholder { color: #8a8f98; }
.ps-control input:disabled { color: #777; font-style: italic; }
.ps-control .segmented { background: #d5d6d9; border-radius: 8px; }
.ps-control .segmented button { color: #111; }
.ps-control .segmented button.selected { background: #fff; color: #111;
    box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.ps-toggle { position: relative; display: inline-block;
    width: 51px; height: 31px; float: right; }
.ps-toggle input { opacity: 0; width: 0; height: 0; }
.ps-toggle span {
    position: absolute; inset: 0; border-radius: 16px;
    background: rgba(120,120,128,.5); transition: .15s;
}
.ps-toggle span::before {
    content: ""; position: absolute; width: 27px; height: 27px;
    left: 2px; top: 2px; border-radius: 50%; background: #fff;
    transition: .15s;
}
.ps-toggle input:checked + span { background: #34c759; }
.ps-toggle input:checked + span::before { transform: translateX(20px); }
.propsheet .guard-note { color: var(--yellow); padding: 10px 0; }

/* ---------- tester access gate ---------- */
.gate {
    height: 100%; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 18px;
    background: rgb(1, 95, 184); color: #fff;
}
.gate-logo { max-width: min(360px, 60vw); height: auto;
    background: #fff; border-radius: 12px; padding: 16px 24px; }
.gate-form { display: flex; flex-direction: column; gap: 10px;
    width: 260px; }
.gate-form input { text-align: center; }
.gate-form button {
    background: rgb(81, 167, 249); color: #fff; font-weight: 700;
    border-radius: 18px; padding: 9px 0;
}
.gate-error { color: #ffd0cc; font-size: 13px; text-align: center;
    margin: 0; }
.gate-error.hidden { display: none; }
