/*
 * MemorMe Pocket phone app: base look (docs/POCKET_PHASE_D.md §2, §9). The purple/gold dark theme, and a
 * light theme when the phone is set to light. Sizes in rem so text follows the phone's text size.
 * Screens of other work packages add css/browse.css and css/viewer.css and use these tokens.
 */
:root {
  color-scheme: dark;
  --bg: #100b17;
  --surface: #1c1426;
  --surface-2: #261b33;
  --border: #33284a;
  --text: #ece6f6;
  --muted: #b3a7ca;
  --accent: #b388ff;
  --on-accent: #160d24;
  --gold: #e8c26a;
  --ok: #6fcf97;
  --bad: #ff7b7b;
  --on-bad: #1d0a0a;
  --banner: #3a2a10;
  --tabbar-h: 4.25rem;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f7f3fc;
    --surface: #ffffff;
    --surface-2: #efe8f8;
    --border: #d6cbe6;
    --text: #1b1226;
    --muted: #574a6b;
    --accent: #6a3fc4;
    --on-accent: #ffffff;
    --gold: #7f5a0c;
    --ok: #1d7a46;
    --bad: #b3261e;
    --on-bad: #ffffff;
    --banner: #fbf0d4;
  }
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html {
  -webkit-text-size-adjust: 100%;
  font-size: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1.125rem/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  /* iPhone: follow Dynamic Type */
  font: -apple-system-body;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
main {
  max-width: 32.5rem;
  margin: 0 auto;
  padding: max(1rem, var(--safe-top)) max(1rem, var(--safe-right)) max(1.5rem, var(--safe-bottom)) max(1rem, var(--safe-left));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
h1 {
  font-size: 1.375rem;
  margin: 0.25rem 0 1rem;
  color: var(--gold);
}
/* the wordmark, as on the computer: "Memor" in the text's color, "Me" in brushed gold */
h1.brand {
  color: var(--text);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.brand__me {
  color: var(--gold);
}
@media (prefers-color-scheme: dark) {
  .brand__me {
    background: linear-gradient(135deg, #f7e2a4 0%, #d9aa45 38%, #a8771f 58%, #e8c56c 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }
}
h2 {
  font-size: 1.5rem;
  line-height: 1.3;
  margin: 0;
}
h3 {
  font-size: 1.25rem;
  margin: 0;
}
.screen {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}
p {
  margin: 0;
}
.big {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.3;
}
/* phase E: the lock screen, its help, and the cover for the app switcher's picture */
.lock-screen {
  text-align: center;
}
.lock-icon {
  display: block;
  margin: 1.5rem auto 0.5rem;
  border-radius: 18px;
}
.lock-help {
  margin-top: 1rem;
  text-align: left;
}
.cover {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg, #100b17);
}
.cover[hidden] {
  display: none;
}
.menu-head {
  margin: 1.25rem 0 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0.75;
}
.menu .menu-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  color: inherit;
  text-decoration: none;
}
.menu-select {
  font: inherit;
  padding: 0.3rem;
  border-radius: 8px;
}
.footer-link {
  display: inline-block;
  margin-top: 0.5rem;
  color: inherit;
  opacity: 0.7;
  font-size: 0.85rem;
}
.big-text {
  font-size: 1.25rem;
}
.small {
  font-size: 0.9375rem;
}
.muted {
  color: var(--muted);
}
.nowrap {
  white-space: nowrap;
}
.note {
  color: var(--muted);
  border-left: 3px solid var(--gold);
  padding-left: 0.75rem;
}
.code {
  font-size: 3.5rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--gold);
  text-align: center;
  margin: 0.25rem 0;
  font-variant-numeric: tabular-nums;
}
label {
  font-weight: 600;
}
input[type='text'],
input[type='search'],
select,
button,
textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.875rem;
  width: 100%;
}
input[type='text'],
input[type='search'] {
  font-size: 1.25rem;
  min-height: 3.5rem;
}
button {
  font-weight: 700;
  min-height: 3.5rem;
  cursor: pointer;
}
button.primary {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}
/* dark: the computer's primary button, royal purple with a gold hairline and light words */
@media (prefers-color-scheme: dark) {
  button.primary {
    background: linear-gradient(180deg, #5f37ad, #3d1f78);
    color: #f7f2ff;
    border-color: rgba(217, 170, 69, 0.45);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 2px 10px rgba(20, 6, 45, 0.5);
  }
}
/* "Scan the code" when it's the only way on (no other action shown): it is the main button */
#msg-action[hidden] + #msg-scan {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}
@media (prefers-color-scheme: dark) {
  #msg-action[hidden] + #msg-scan {
    background: linear-gradient(180deg, #5f37ad, #3d1f78);
    color: #f7f2ff;
    border-color: rgba(217, 170, 69, 0.45);
  }
}
button.danger {
  background: var(--bad);
  color: var(--on-bad);
  border-color: var(--bad);
}
button:disabled {
  opacity: 0.5;
}
.msg-lock {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-align: left;
}
.msg-lock > span {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
button.link.danger-text {
  color: var(--bad);
}
button.link {
  background: none;
  border: none;
  color: var(--muted);
  text-decoration: underline;
  font-weight: 400;
  font-size: 1rem;
  min-height: 2.75rem;
  width: auto;
  padding: 0.5rem 0.25rem;
}
:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}
footer {
  margin-top: auto;
  padding-top: 1.5rem;
  text-align: center;
}
details {
  color: var(--muted);
  font-size: 1rem;
}
details[open] {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}
summary {
  min-height: 2.75rem;
  display: flex;
  align-items: center;
  cursor: pointer;
}
.check {
  display: flex;
  gap: 0.625rem;
  align-items: flex-start;
  font-weight: 400;
  color: var(--text);
}
.check input {
  width: 1.5rem;
  height: 1.5rem;
  margin-top: 2px;
  flex: none;
}
textarea {
  font: 0.75rem/1.4 ui-monospace, Menlo, monospace;
}
dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.375rem 0.875rem;
  margin: 0;
  font-size: 1rem;
}
dt {
  color: var(--muted);
}
dd {
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}
pre {
  font-size: 0.75rem;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--muted);
  margin: 0;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.banner {
  background: var(--banner);
  border: 1px solid var(--gold);
  border-radius: 0.75rem;
  padding: 0.75rem 0.875rem;
  color: var(--text);
}
.card {
  border: 1px solid var(--border);
  border-radius: 0.875rem;
  padding: 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  background: var(--surface);
}
.row {
  display: flex;
  gap: 0.5rem;
}
.row input {
  flex: 1;
  min-width: 0;
}
.row button {
  width: auto;
  flex: none;
  padding: 0.875rem 1.125rem;
}
button.back {
  width: auto;
  min-width: 5.5rem;
  min-height: 2.75rem;
  flex: none;
  padding: 0.5rem 0.75rem;
}
.pad {
  padding: 1rem;
}

/* ---------------------------------------------------------------- first run */
.steps {
  margin: 0;
  padding-left: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 1.125rem;
}
.share-icon {
  display: inline-block;
  width: 1.1em;
  height: 1.3em;
  vertical-align: -0.2em;
  border: 2px solid var(--accent);
  border-top: none;
  border-radius: 0 0 0.2em 0.2em;
  position: relative;
  margin: 0 0.1em;
}
.share-icon::before {
  content: '';
  position: absolute;
  left: 50%;
  top: -0.35em;
  width: 2px;
  height: 0.9em;
  background: var(--accent);
  transform: translateX(-50%);
}
.install-card {
  border: 1px solid var(--gold);
  border-radius: 0.875rem;
  padding: 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--surface-2);
}
.scan-view {
  position: relative;
  border-radius: 0.875rem;
  overflow: hidden;
  background: #000;
  aspect-ratio: 1;
}
.scan-view video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.update-line {
  position: fixed;
  left: 0.75rem;
  right: 0.75rem;
  top: calc(var(--safe-top) + 0.5rem);
  z-index: 40;
  background: var(--surface-2);
  border: 1px solid var(--gold);
  border-radius: 0.75rem;
  padding: 0.25rem 0.75rem;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

/* ---------------------------------------------------------------- the app shell (shell.js) */
body[data-screen='s-app'] main {
  max-width: none;
  padding: 0;
}
body[data-screen='s-app'] .brand,
body[data-screen='s-app'] footer {
  display: none;
}
.screen.app {
  background: none;
  border: none;
  border-radius: 0;
  padding: 0 0 calc(var(--tabbar-h) + var(--safe-bottom)) 0;
  gap: 0;
  min-height: 100vh;
}
.screen.app.fullscreen {
  padding-bottom: 0;
}
.status-line {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 0;
  padding: calc(var(--safe-top) + 0.25rem) 1rem 0.25rem;
  background: var(--banner);
  border-bottom: 1px solid var(--gold);
  font-size: 0.9375rem;
  text-align: center;
}
.app-top {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: calc(var(--safe-top) + 0.5rem) max(0.75rem, var(--safe-right)) 0.5rem max(0.75rem, var(--safe-left));
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.status-line:not([hidden]) + .app-top {
  padding-top: 0.5rem;
}
.app-title {
  font-size: 1.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-screens {
  flex: 1;
}
.screen-root {
  padding: 0 max(0.75rem, var(--safe-right)) 1rem max(0.75rem, var(--safe-left));
}
/* a pushed screen (This computer, Help, Data Saving Mode, Connection details…): room below the top bar */
.app-top:not([hidden]) + .app-screens .screen-root {
  padding-top: 1rem;
}
.app-top[hidden] + .app-screens .screen-root {
  padding-top: calc(var(--safe-top) + 0.75rem);
}
.status-line:not([hidden]) ~ .app-screens .screen-root {
  padding-top: 0.75rem;
}
.screen.app.fullscreen .screen-root {
  padding: 0;
}
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 0 var(--safe-right) var(--safe-bottom) var(--safe-left);
}
.tabbar .tab {
  flex: 1;
  width: auto;
  min-height: var(--tabbar-h);
  min-width: 2.75rem;
  border: none;
  border-radius: 0;
  background: none;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.125rem;
  padding: 0.375rem 0.125rem;
  font-size: 0.75rem;
  font-weight: 600;
}
.tabbar .tab svg {
  width: 1.625rem;
  height: 1.625rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tabbar .tab.on {
  color: var(--accent);
}
.progress-strip {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom));
  z-index: 29;
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border);
}
.screen.app.fullscreen .progress-strip {
  bottom: var(--safe-bottom);
}
.progress-row {
  border: none;
  border-radius: 0;
  background: var(--surface-2);
  min-height: 2.75rem;
  padding: 0.375rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.25rem;
  text-align: left;
  font-size: 0.9375rem;
}
.progress-row .bar {
  height: 0.375rem;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}
.progress-row .bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.2s linear;
}
.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 4rem);
  z-index: 50;
  max-width: calc(100% - 2rem);
  background: var(--text);
  color: var(--bg);
  border-radius: 999px;
  padding: 0.625rem 1.125rem;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
}
/* pocket-web-e6: a note that wraps is a rounded box, not an oval with its edges cut off */
.toast.long {
  border-radius: 1rem;
  width: max-content;
  font-weight: 500;
  text-align: left;
}
.placeholder {
  padding: 3rem 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ---------------------------------------------------------------- More, Help, This computer (help.js) */
.page-head {
  margin: 0.5rem 0 1rem;
}
.menu {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0.875rem;
  overflow: hidden;
  background: var(--surface);
}
.menu li + li {
  border-top: 1px solid var(--border);
}
.menu button,
.menu .menu-row {
  width: 100%;
  border: none;
  border-radius: 0;
  background: none;
  min-height: 3.5rem;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  text-align: left;
  font-weight: 600;
}
.menu .sub {
  display: block;
  color: var(--muted);
  font-weight: 400;
  font-size: 0.9375rem;
}
.menu .chev {
  color: var(--muted);
  flex: none;
}
.switch {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 3.25rem;
  height: 2rem;
  border-radius: 999px;
  background: var(--border);
  position: relative;
  cursor: pointer;
  margin: 0;
}
.switch::after {
  content: '';
  position: absolute;
  top: 0.1875rem;
  left: 0.1875rem;
  width: 1.625rem;
  height: 1.625rem;
  border-radius: 50%;
  background: var(--text);
  transition: left 0.15s ease;
}
.switch:checked {
  background: var(--accent);
}
.switch:checked::after {
  left: 1.4375rem;
  background: var(--on-accent);
}
.help-section {
  margin: 0 0 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.help-section h3 {
  font-size: 1.125rem;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
.gap-top {
  margin-top: 1rem;
}
.install-offer {
  margin: calc(var(--safe-top) + 0.5rem) 0.75rem 0.5rem;
}

/* Connecting (polish round 1): a phone and a computer with dots passing between them. Calm and slow;
   with reduced motion the dots simply stay lit (the rule above stops every animation). */
.connect-anim {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  margin: 1.5rem 0 0.5rem;
}
.connect-anim .ca-end {
  display: block;
  border: 0.1875rem solid var(--accent);
  border-radius: 0.375rem;
}
.connect-anim .ca-phone {
  width: 1.5rem;
  height: 2.5rem;
}
.connect-anim .ca-computer {
  width: 3rem;
  height: 2.125rem;
  border-bottom-width: 0.5rem;
}
.connect-anim .ca-dot {
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 50%;
  background: var(--gold);
  opacity: 0.35;
  animation: ca-pass 1.8s ease-in-out infinite;
}
.connect-anim .ca-dot:nth-child(3) {
  animation-delay: 0.3s;
}
.connect-anim .ca-dot:nth-child(4) {
  animation-delay: 0.6s;
}
@keyframes ca-pass {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  40% { opacity: 1; transform: scale(1.15); }
}
@media (prefers-reduced-motion: reduce) {
  .connect-anim .ca-dot {
    opacity: 0.8;
  }
}

/* caps 'send_home': Send to MemorMe and Free up space (ui/home.js) */
.home-bar {
  height: 0.6rem;
  border-radius: 0.4rem;
  background: var(--surface-2);
  overflow: hidden;
  margin: 0.75rem 0 0.25rem;
}
.home-bar > i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--gold);
  transition: width 0.3s ease;
}
.home-result {
  margin: 0.5rem 0 0;
  font-weight: 600;
}
.home-list {
  list-style: none;
  margin: 0.5rem 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
  font-size: 0.875rem;
}
.home-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-wrap: anywhere;
}
.home-list img {
  width: 2.75rem;
  height: 2.75rem;
  object-fit: cover;
  border-radius: 0.35rem;
  flex: none;
}
.home-steps {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
  display: grid;
  gap: 0.4rem;
}
.home-safe h3 {
  color: var(--gold);
}
@media (prefers-reduced-motion: reduce) {
  .home-bar > i {
    transition: none;
  }
}
