/* My devices page: the Pocket itself first (is it awake, who does it speak
   as), then its details and the few things you can do with it. */

.device-page { --dp-card: rgba(255, 253, 249, .92); }
.device-page.active { max-width: 1160px; margin-inline: auto; }

.dp-head { margin: 6px 0 14px; }
.dp-head .eyebrow { margin: 0 0 2px; }
.dp-head h2 { margin: 0; font-size: 28px; line-height: 1.2; overflow-wrap: anywhere; }

.dp-tabs { display: flex; gap: 8px; margin: 0 -16px 14px; padding: 2px 16px; overflow-x: auto; scrollbar-width: none; }
.dp-tabs::-webkit-scrollbar { display: none; }
.dp-tab { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; max-width: 70vw; padding: 0 16px; border: 1px solid var(--line); border-radius: 999px; color: #56524d; background: rgba(255, 255, 255, .62); font-size: 14px; transition: background .2s, color .2s, border-color .2s; }
.dp-tab > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dp-tab[aria-selected="true"] { border-color: transparent; color: #fff; background: var(--accent); }
.dp-tab[aria-selected="true"] .dp-dot { box-shadow: 0 0 0 2px rgba(255, 255, 255, .75); }
.dp-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dp-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.dp-dot { flex: none; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #b9b2ab; }
.dp-dot.online { background: #5f9a78; }

.dp-card { padding: 18px; border-radius: 24px; background: var(--dp-card); box-shadow: 0 18px 46px -30px rgba(80, 45, 40, .45); }
.dp-card h3 { margin: 0 0 6px; font-family: "Songti SC", "STSong", serif; font-size: 20px; font-weight: 500; }
.dp-hint { margin: 0 0 6px; color: var(--muted); font-size: 12px; line-height: 1.6; }

/* Hero: the Pocket, its status, current role and this week's voice. */
.dp-hero { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "pocket status" "caption caption"; gap: 12px 16px; align-items: center; background: linear-gradient(160deg, rgba(255, 253, 249, .97), rgba(247, 238, 233, .97)); }
.dp-pocket { --dp-screen-ratio: 1 / 1; grid-area: pocket; width: 138px; padding: 12px 12px 18px; border-radius: 30px; background: linear-gradient(160deg, #fbf5f0, #eadcd2); box-shadow: inset 0 1px 0 #fff, 0 18px 40px -18px rgba(80, 45, 40, .55); }
.dp-pocket-screen { position: relative; display: grid; place-items: center; aspect-ratio: var(--dp-screen-ratio); overflow: hidden; border-radius: 15px; background: #121015; box-shadow: inset 0 0 0 3px #1d1a1f; }
.dp-pocket-screen img { width: 100%; height: 100%; object-fit: cover; animation: dp-screen-on .45s ease both; }
.dp-pocket-fallback { color: rgba(255, 255, 255, .5); font-family: "Songti SC", "STSong", serif; font-size: 30px; }
.dp-pocket.off .dp-pocket-screen { background: #0d0c0f; box-shadow: inset 0 0 0 3px #1a181c, inset 0 10px 24px rgba(255, 255, 255, .04); }
.dp-pocket-button { display: block; width: 24px; height: 24px; margin: 11px auto 0; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #fff, #e6dbd3); box-shadow: 0 2px 5px rgba(80, 45, 40, .25); }
@keyframes dp-screen-on { from { opacity: 0; filter: brightness(1.6); } }
.dp-caption { grid-area: caption; margin: 0; color: var(--muted); font-size: 12px; }

.dp-status { grid-area: status; display: grid; gap: 10px; min-width: 0; }
.dp-online { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; }
.dp-role { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 54px; padding: 6px 12px 6px 6px; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); background: rgba(255, 255, 255, .72); text-align: left; }
.dp-role img { width: 38px; height: 38px; border-radius: 12px; object-fit: cover; object-position: 50% 26%; background: #e9dcd6; }
.dp-role small, .dp-quota small { display: block; color: var(--muted); font-size: 11px; }
.dp-role strong { display: block; overflow: hidden; font-family: "Songti SC", "STSong", serif; font-size: 16px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.dp-role em { color: var(--muted); font-size: 18px; font-style: normal; }
.dp-quota { display: grid; gap: 7px; padding: 9px 12px; border: 0; border-radius: 14px; color: var(--ink); background: rgba(245, 241, 235, .85); text-align: left; }
.dp-quota-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.dp-quota-head strong { font-size: 13px; font-weight: 500; }
.dp-quota-bar { display: block; height: 6px; overflow: hidden; border-radius: 999px; background: rgba(93, 74, 65, .12); }
.dp-quota-bar i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--sage); transition: width .6s ease; }
.dp-quota[data-status="warning"] .dp-quota-bar i { background: #be7b25; }
.dp-quota[data-status="text_only"] .dp-quota-bar i { background: var(--accent); }
.dp-role:focus-visible, .dp-quota:focus-visible, .dp-link:focus-visible, .dp-copy:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Rows */
.dp-side { display: grid; gap: 14px; margin-top: 14px; }
.dp-rows { display: grid; }
.dp-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 0 2px; border-bottom: 1px solid var(--line); font-size: 14px; }
.dp-row:last-child { border-bottom: 0; }
.dp-row > span:first-child { flex: none; color: var(--muted); }
.dp-row strong { font-weight: 500; text-align: right; overflow-wrap: anywhere; }
.dp-link { width: 100%; min-height: 56px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; color: var(--ink); background: none; text-align: left; }
.dp-link::after { content: "›"; flex: none; color: var(--muted); font-size: 18px; }
.dp-link > span:first-child { color: var(--ink); }
.dp-link-text { flex: 1; min-width: 0; }
.dp-link-text strong, .dp-link-text small { display: block; text-align: left; }
.dp-link-text small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.dp-mac { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.dp-mac strong { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; letter-spacing: .02em; user-select: all; }
.dp-copy { flex: none; min-height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; color: #56524d; background: #fff; font-size: 12px; transition: color .2s, border-color .2s, background .2s; }
.dp-copy.done { border-color: rgba(95, 154, 120, .4); color: #3f6b52; background: rgba(95, 154, 120, .1); }
.dp-recovery { margin-top: 10px; padding: 12px 14px; border-radius: 14px; background: rgba(245, 241, 235, .75); font-size: 13px; }
.dp-recovery summary { color: var(--ink); cursor: pointer; }
.dp-recovery p { margin: 8px 0 0; color: var(--muted); line-height: 1.7; }

/* No device yet */
.dp-empty { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 8px; padding: 26px 20px; text-align: center; }
.dp-empty .dp-pocket { grid-area: auto; width: 150px; margin-bottom: 6px; }
.dp-steps { display: grid; gap: 10px; margin: 6px 0 14px; padding: 0; list-style: none; font-size: 14px; text-align: left; }
.dp-steps li { display: flex; align-items: center; gap: 10px; }
.dp-steps b { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: var(--accent); background: var(--accent-soft); font-family: "Songti SC", "STSong", serif; font-size: 13px; }

#deviceDetail[hidden] { display: none; }

@media (max-width: 380px) {
  .dp-hero { grid-template-columns: 1fr; grid-template-areas: "pocket" "caption" "status"; justify-items: center; }
  .dp-caption { text-align: center; }
  .dp-status { width: 100%; }
}

/* Desktop: the Pocket stays in view on the left while details scroll. */
@media (min-width: 900px) {
  .dp-layout { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 24px; align-items: start; }
  .dp-hero { position: sticky; top: 16px; grid-template-columns: 1fr; grid-template-areas: "pocket" "caption" "status"; justify-items: center; padding: 26px; }
  .dp-pocket { width: 220px; }
  .dp-caption { text-align: center; }
  .dp-status { width: 100%; }
  .dp-side { margin-top: 0; }
  .dp-tabs { margin-inline: 0; padding-inline: 0; }
  .dp-empty { max-width: 520px; margin: 0 auto; }
}

@media (prefers-reduced-motion: reduce) {
  .dp-pocket-screen img { animation: none; }
  .dp-quota-bar i, .dp-tab, .dp-copy { transition: none; }
}
