/* The Nest accounts portal: login, home, saved characters and campaigns, account, admin. Matches the apps' look. */
body { line-height: 1.5; min-height: 100vh; display: flex; flex-direction: column; }
h1, h2, h3 { margin-bottom: .6rem; line-height: 1.2; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.25rem; }
a { color: var(--accent); }
textarea:focus-visible { outline: revert; outline-offset: revert; }   /* keeps the browser's own ring; the base styles textareas */
.fine { font-size: .85rem; }
.file-btn input { width: auto; }

.masthead { position: static; }
.masthead-inner { gap: .8rem; }
.brand { color: inherit; text-decoration: none; }
.actions { align-items: center; }
.masthead .who { font-size: .85rem; opacity: .85; margin-right: .3rem; }

.wrap { width: 100%; margin: 0 auto; padding: 24px clamp(16px, 2vw, 40px) 40px; flex: 1; }   /* fills the window; forms stay .narrow */
.narrow { max-width: 440px; margin: 0 auto; }
.card { padding: 20px; margin-bottom: 16px; min-width: auto; }

.btn { padding: .45rem .85rem; min-height: 38px; text-decoration: none; }
.tile:focus-visible { outline: 2px solid var(--sel); outline-offset: 1px; }
.btn-danger { color: var(--bad); border-color: var(--bad); background: transparent; }
.btn-small { padding: .25rem .6rem; min-height: 32px; }

form .field { display: flex; flex-direction: column; gap: .25rem; margin-bottom: .9rem; font-weight: 600; font-size: .9rem; }
form .field[hidden] { display: none; }
form .field small { font-weight: normal; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=search], select {
  width: 100%; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); min-height: 40px; font-weight: normal; }
.form-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: .4rem; }
.msg { padding: .6rem .8rem; border-radius: 6px; margin-bottom: .9rem; font-size: .92rem; }
.msg.err { background: color-mix(in srgb, var(--bad) 12%, transparent); border: 1px solid var(--bad); }
.msg.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); border: 1px solid var(--ok); }
.msg.warn { background: color-mix(in srgb, var(--warn) 12%, transparent); border: 1px solid var(--warn); }
.or { display: flex; align-items: center; gap: .8rem; color: var(--muted); margin: 1.1rem 0; font-size: .85rem; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.links { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; margin-top: .9rem; font-size: .9rem; }

.code-in { font: 600 1.4rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .15em; max-width: 14rem; }
.row-btns { display: flex; gap: .4rem; flex-wrap: wrap; margin: .4rem 0; }
.choices { display: grid; gap: .7rem; margin: 1rem 0; }
.choice { display: grid; grid-template-columns: 1fr auto; gap: .2rem .6rem; text-align: left; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: inherit; font: inherit; cursor: pointer; }
.choice:hover, .choice:focus-visible { border-color: var(--accent); }
.choice .t { font-weight: 700; }
.choice .tag { font-size: .72rem; font-weight: 700; color: #fff; background: var(--ok); border-radius: 999px; padding: .05rem .5rem; align-self: start; }
.choice .d { grid-column: 1 / -1; color: var(--muted); font-size: .9rem; }
.steps { padding-left: 1.2rem; } .steps li { margin: .3rem 0; }
.secret { font: 600 .95rem ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; background: var(--soft); padding: .05rem .3rem; border-radius: 4px; }
.qr { display: block; width: 220px; max-width: 70vw; height: auto; margin: .6rem auto 1rem; border-radius: 6px; }
.recovery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .3rem 1rem; list-style: none; padding: .8rem 1rem; margin: .8rem 0; background: var(--soft); border-radius: 8px; }
.recovery code { font: 600 1.05rem ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .05em; }
@media print { .masthead, footer, .row-btns, .check-row, .form-actions { display: none !important; } }
.check-row { display: flex; gap: .5rem; align-items: flex-start; margin: .4rem 0; }
.check-row input { margin-top: .25rem; }
.camps { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .3rem; }
.camp-chip { font-size: .78rem; padding: .1rem .55rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.camp-chip b { color: var(--ink, inherit); font-weight: 600; }
.camp-chip.ok { border-color: var(--ok); } .camp-chip.ok b { color: var(--ok); }
.camp-chip.warn { border-color: var(--warn); } .camp-chip.warn b { color: var(--warn); }
.camp-chip.bad { border-color: var(--bad); } .camp-chip.bad b { color: var(--bad); }
.camp-chip.none { border-style: dashed; }
.section-head { margin-top: 1.6rem; }
.count { display: inline-block; min-width: 1.2rem; margin-left: .35rem; padding: 0 .3rem; border-radius: 999px; background: var(--accent); color: #fff; font-size: .72rem; font-weight: 700; text-align: center; }
.news .rows li { border-left: 4px solid var(--ok); padding-left: .7rem; }
.news .rows li.no { border-left-color: var(--warn); }
.news .rows li:first-child { border-top: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; margin: 18px 0; }
.tile { display: flex; flex-direction: column; gap: .35rem; padding: 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); color: var(--ink); text-decoration: none; cursor: pointer; text-align: left; font: inherit; border-top: 4px solid var(--accent); }
.tile:hover { border-color: var(--accent); }
.tile .t { font: bold 1.15rem/1.2 var(--serif); }
.tile .d { color: var(--muted); font-size: .9rem; }
.tile.ref { border-top-color: var(--sel); }
.tile.admin { border-top-color: var(--muted); }

.list-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .8rem; }
.list-head .btns { display: flex; gap: .4rem; flex-wrap: wrap; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; gap: .8rem; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: .75rem 0; border-top: 1px solid var(--line); }
.rows li:first-child { border-top: 0; }
.rows .name { font-weight: 600; }
.rows .meta { color: var(--muted); font-size: .85rem; }
.rows .btns { display: flex; gap: .35rem; flex-wrap: wrap; align-items: center; }
.rows .grow { flex: 1 1 16rem; min-width: 0; }
.rows .note { margin-top: .25rem; font-size: .9rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.search { display: flex; margin-bottom: .4rem; }
.search input { flex: 1; min-width: 0; }
.share-panel { flex-basis: 100%; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: .8rem; }
.share-panel h3 { font-size: 1rem; }
.share-panel .row-btns { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .6rem; }
.share-panel .access { list-style: none; margin: .3rem 0 0; padding: 0; }
.share-panel .access li { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .3rem 0; border-top: 1px solid var(--line); }
.empty { color: var(--muted); padding: .8rem 0; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: .5rem .45rem; border-top: 1px solid var(--line); vertical-align: middle; }
th { font-size: .8rem; color: var(--muted); font-weight: 600; border-top: 0; }
td select { min-height: 34px; padding: .2rem .4rem; width: auto; }
.cell-btns { display: flex; gap: .35rem; flex-wrap: wrap; justify-content: flex-end; }
.pill { display: inline-block; font-size: .75rem; padding: .05rem .5rem; border-radius: 99px; background: var(--soft); border: 1px solid var(--line); }
.pill.ref { border-color: var(--sel); }
.pill.admin { border-color: var(--accent); }
.copy { display: flex; gap: .4rem; margin-top: .5rem; }
.copy input { flex: 1; font-size: .8rem; }

.footer { color: var(--muted); font-size: .8rem; text-align: center; padding: 12px clamp(16px, 2vw, 40px) 24px; margin: 0 auto; }
.toast { transform: translate(-50%, 20px); background: #1f1d1e; color: #f4efe6; opacity: 0; pointer-events: none; transition: .2s; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 560px) {
  .brand-sub { display: none; }
  .card { padding: 16px; }
  .rows li { align-items: flex-start; }
}

.more { position: relative; }
.more > summary { list-style: none; cursor: pointer; }
.more > summary::-webkit-details-marker { display: none; }
.more-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 5; display: flex; flex-direction: column; gap: .25rem; min-width: 10rem;
  padding: .4rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.more-menu .btn { text-align: left; }
.list-head h2.section-head { margin: 0; }

/* Sign in with Discord */
.alt-login { text-align: center; margin-top: 1rem; }
.alt-login p { margin: 0 0 .5rem; }
.btn-discord { background: #5865f2; border-color: #5865f2; color: #fff; }
.btn-discord:hover { background: #4752c4; border-color: #4752c4; }

/* campaign chat */
.chat-log { height: 52vh; min-height: 260px; overflow-y: auto; padding: .4rem .2rem; display: flex; flex-direction: column; gap: .5rem; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.chat-msg { max-width: 85%; padding: .45rem .7rem; border-radius: 10px; background: var(--soft); border: 1px solid var(--line); align-self: flex-start; }
.chat-msg.mine { align-self: flex-end; background: color-mix(in srgb, var(--accent) 12%, var(--card)); }
.chat-msg.announce { align-self: stretch; max-width: none; border-left: 4px solid var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--card)); }
.chat-msg.private { border-style: dashed; }
.chat-meta { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; font-size: .82rem; }
.chat-tag { font-size: .7rem; font-weight: 700; padding: .05rem .5rem; border-radius: 999px; border: 1px solid var(--accent); color: var(--accent); }
.chat-del { margin-left: auto; min-height: 0; padding: 0 .4rem; line-height: 1.3; }
.chat-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-pin { border: 1px solid var(--accent); border-left-width: 5px; border-radius: 8px; padding: .5rem .8rem; margin-bottom: 12px; background: color-mix(in srgb, var(--accent) 8%, var(--card)); }
.chat-compose { margin-top: 12px; display: grid; gap: .5rem; }
.chat-modes { display: flex; gap: 1rem; flex-wrap: wrap; }
.chat-mode { display: inline-flex; gap: .3rem; align-items: center; }
.chat-text { width: 100%; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); color: var(--ink); font: inherit; resize: vertical; }
.chat-tmpl { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.chat-compose .btns { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; }

/* ---- Phase 2: journal-page polish ---- */
h1:focus { outline: none; }   /* the heading takes focus when a view changes (portal.js show()); it isn't a control */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* log in / create account / reset: a page of the journal */
.narrow .card > h1 { padding-bottom: .55rem; margin-bottom: 1rem; background: linear-gradient(90deg, var(--accent), var(--sel) 70%, transparent) left bottom / 100% 1px no-repeat; }
.narrow .card > h1 + .muted { margin-top: 0; }
.narrow .card { padding: 24px 24px 20px; }
.pw { position: relative; display: block; }
.pw input { padding-right: 4.4rem; }
.pw-toggle { position: absolute; right: .3rem; top: 50%; transform: translateY(-50%); min-height: 30px; padding: .1rem .55rem; border: 0; border-radius: 4px;
  background: transparent; color: var(--muted); font: italic .85rem var(--serif); cursor: pointer; }
.pw-toggle:hover, .pw-toggle[aria-pressed="true"] { color: var(--accent); }
.pw-toggle:focus-visible { outline: 2px solid var(--sel); box-shadow: 0 0 0 4px var(--glow); }
/* the guest card: a note tipped into the page */
.guest-card { position: relative; background: color-mix(in srgb, var(--soft) 55%, var(--card)); border-style: dashed; box-shadow: none; transform: rotate(-.35deg); }
.guest-card::before { content: ''; position: absolute; top: -5px; left: 50%; width: 9px; height: 9px; background: var(--sel); transform: translateX(-50%) rotate(45deg); }
.guest-card h2 { background: none; padding-bottom: 0; }

/* home tiles */
.tile { position: relative; transition: transform .2s var(--ease), box-shadow .2s, border-color .2s; }
.tile .t { align-self: flex-start; padding-bottom: .15rem; background: linear-gradient(90deg, var(--sel), var(--accent)) left bottom / 0 2px no-repeat; transition: background-size .3s var(--ease); }
.tile:hover, .tile:focus-visible { transform: translateY(-2px); box-shadow: var(--shadow), 0 10px 22px -14px var(--accent); }
.tile:hover .t, .tile:focus-visible .t { background-size: 100% 2px; }
/* the unread count: a small oxblood wax seal */
.count { min-width: 1.35rem; height: 1.35rem; line-height: 1.35rem; padding: 0 .3rem; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255,255,255,.4), 0 0 0 1px var(--accent), 0 1px 3px rgba(0,0,0,.4); }

/* character and campaign rows */
.rows li { padding-left: .6rem; padding-right: .6rem; margin: 0 -.6rem; border-radius: 6px; transition: background-color .15s; }
.rows li:hover { background: color-mix(in srgb, var(--sel) 8%, transparent); }
.rows li.empty-state { display: block; margin: .4rem 0; padding: 1rem 1.1rem; border: 1px dashed var(--line); background: color-mix(in srgb, var(--soft) 35%, transparent); }
.rows li.empty-state:hover { background: color-mix(in srgb, var(--soft) 35%, transparent); }
.camp-chip { background: color-mix(in srgb, var(--soft) 60%, transparent); letter-spacing: .02em; }
.camp-chip.ok { background: color-mix(in srgb, var(--ok) 10%, transparent); }
.camp-chip.warn { background: color-mix(in srgb, var(--warn) 10%, transparent); }
.camp-chip.bad { background: color-mix(in srgb, var(--bad) 10%, transparent); }
.continue:not(:empty) { margin-bottom: .6rem; padding-bottom: .6rem; border-bottom: 1px solid var(--line); }
.continue .btn { border-color: var(--sel); max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

/* loading skeleton */
.rows li.skeleton { display: block; padding-top: 1rem; padding-bottom: 1rem; }
.rows li.skeleton:hover { background: none; }
.skeleton .bar { display: block; height: .8rem; width: 55%; margin: .3rem 0; border-radius: 4px;
  background: linear-gradient(90deg, var(--soft) 30%, color-mix(in srgb, var(--sel) 22%, var(--soft)) 50%, var(--soft) 70%) 100% 0 / 300% 100%; animation: skeleton-sheen 1.4s linear infinite; }
.skeleton .bar.short { width: 30%; height: .65rem; }
@keyframes skeleton-sheen { to { background-position: 0 0; } }

/* footer */
.footer { max-width: 62rem; }
.footer .rule { margin: 0 auto 1rem; }
.footer .rule::after { box-shadow: 0 0 0 4px var(--paper); }
.footer p { margin: 0; font: italic .85rem/1.6 var(--serif); text-wrap: pretty; }

@media (prefers-reduced-motion: reduce) {
  .tile, .tile .t, .rows li { transition: none; }
  .tile:hover, .tile:focus-visible { transform: none; }
  .skeleton .bar { animation: none; }
  .guest-card { transform: none; }
}

/* The Playtest 2 | Playtest 3 switch in the header, and the PT2 / PT3 badge on a save in an All list. */
.pt-switch { display: inline-flex; border: 1px solid #5a5354; border-radius: 999px; overflow: hidden; }
.pt-switch .seg { font: inherit; font-size: .8rem; padding: .25rem .7rem; border: 0; background: transparent; color: inherit; cursor: pointer; opacity: .8; }
.pt-switch .seg + .seg { border-left: 1px solid #5a5354; }   /* on the dark masthead, like its ghost buttons */
.pt-switch .seg.on { background: var(--accent); color: var(--accent-ink); opacity: 1; font-weight: 600; }
.pt-switch .seg:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.pt-badge { display: inline-block; margin-left: .45rem; font-size: .7rem; font-weight: 600; letter-spacing: .03em; padding: 0 .4rem;
  border-radius: 999px; border: 1px solid var(--line); color: var(--muted); vertical-align: middle; }
.pt-badge.pt3 { border-color: var(--ok); color: var(--ok); }
