/* App shell styles -- layered on top of protocols.css (brand tokens + card styles) */

*{box-sizing:border-box;}
html,body{margin:0;padding:0;height:100%;background:var(--bg);}
body{
  font-family:'Segoe UI',Arial,Helvetica,sans-serif;
  color:var(--text);
  -webkit-font-smoothing:antialiased;
  overscroll-behavior-y:none;
}
img{max-width:100%;}
[hidden]{display:none!important;}
a{color:inherit;}
button{font-family:inherit;}

:root{
  padding-top:env(safe-area-inset-top,0px);
  padding-bottom:env(safe-area-inset-bottom,0px);
}

/* ---- Top app bar ---- */
.appbar{
  position:sticky; top:0; z-index:20;
  display:flex; align-items:center; gap:10px;
  padding:14px 18px; padding-top:calc(14px + env(safe-area-inset-top,0px));
  background:rgba(13,22,38,0.92); backdrop-filter:blur(6px);
  border-bottom:1px solid var(--edge);
}
.appbar .back{
  background:none; border:none; color:var(--gold-lt);
  font-size:20px; padding:2px 6px; cursor:pointer; line-height:1;
}
.appbar .brandmark{display:flex; align-items:center; gap:8px; flex:1; min-width:0;}
.appbar .brandmark .logo{width:26px; height:26px; border-radius:6px; flex:0 0 auto; display:block;}
.appbar .brandmark .name{font-weight:800; font-size:14px; letter-spacing:0.3px; color:var(--white); white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.appbar .menu-btn{background:none; border:none; color:var(--muted); font-size:18px; padding:4px 8px; cursor:pointer;}

/* ---- Generic screen container ---- */
.screen{min-height:100%; display:flex; flex-direction:column;}
.screen-body{flex:1; padding:20px 18px 40px 18px; max-width:520px; margin:0 auto; width:100%;}
.screen-body.wide{max-width:820px;}

/* ---- Centered auth / paywall card ---- */
.center-wrap{min-height:100%; display:flex; align-items:center; justify-content:center; padding:24px 18px;}
.auth-card{
  width:100%; max-width:380px; background:var(--panel); border:1px solid var(--edge);
  border-radius:12px; padding:28px 26px; box-shadow:0 20px 50px rgba(0,0,0,0.35);
}
.auth-logo{display:flex; flex-direction:column; align-items:center; gap:10px; margin-bottom:22px; text-align:center;}
.auth-logo .wordmark{width:100%; max-width:260px; height:auto; display:block;}
.auth-logo .app-name{font-weight:800; font-size:17px; color:var(--white); letter-spacing:0.3px;}
.auth-logo .app-sub{font-size:11px; color:var(--muted); margin-top:2px;}

.field{margin-bottom:14px;}
.field label{display:block; font-size:10.5px; text-transform:uppercase; letter-spacing:0.5px; color:var(--muted); margin-bottom:6px; font-weight:700;}
.field input{
  width:100%; padding:11px 12px; border-radius:6px; border:1px solid var(--edge);
  background:rgba(0,0,0,0.3); color:var(--white); font-size:14px; outline:none;
}
.field input:focus{border-color:var(--gold);}

.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  width:100%; padding:12px 16px; border-radius:7px; border:none; cursor:pointer;
  font-size:13.5px; font-weight:800; letter-spacing:0.3px; text-transform:uppercase;
}
.btn-primary{background:linear-gradient(135deg,var(--gold-lt),var(--gold-s)); color:#1a1506;}
.btn-primary:disabled{opacity:0.55; cursor:not-allowed;}
.btn-ghost{background:transparent; border:1px solid var(--edge); color:var(--text);}
.btn-small{width:auto; padding:8px 14px; font-size:11.5px;}

.auth-switch{margin-top:16px; text-align:center; font-size:12px; color:var(--muted);}
.auth-switch button{background:none; border:none; color:var(--gold-lt); font-weight:700; cursor:pointer; padding:0; font-size:12px;}

.form-error{
  background:var(--red-bg); border:1px solid var(--red-bd); color:#f0d7d7;
  padding:9px 12px; border-radius:6px; font-size:12px; margin-bottom:14px; line-height:1.4;
}
.form-note{font-size:11px; color:var(--muted); margin-top:10px; line-height:1.5; text-align:center;}

/* ---- Paywall ---- */
.paywall-card{width:100%; max-width:420px; background:var(--panel); border:1px solid var(--edge); border-radius:12px; padding:30px 28px; text-align:center;}
.paywall-card .paywall-mark{width:44px; height:44px; border-radius:10px; display:inline-block;}
.paywall-card h2{margin:14px 0 6px 0; font-size:20px; color:var(--white);}
.paywall-card p{color:var(--muted); font-size:13px; line-height:1.6; margin:0 0 20px 0;}
.price-row{display:flex; align-items:baseline; justify-content:center; gap:6px; margin-bottom:22px;}
.price-row .amt{font-size:34px; font-weight:800; color:var(--gold-lt);}
.price-row .per{font-size:13px; color:var(--muted);}
.paywall-list{text-align:left; list-style:none; margin:0 0 24px 0; padding:0;}
.paywall-list li{display:flex; gap:10px; align-items:flex-start; font-size:13px; color:var(--text); margin-bottom:10px; line-height:1.4;}
.paywall-list li:before{content:"\2713"; color:var(--gold-lt); font-weight:800; flex:0 0 auto;}

/* ---- Home screen: protocol list ---- */
.home-header{margin-bottom:18px;}
.home-header h1{margin:0; font-size:22px; color:var(--white); font-weight:800;}
.home-header p{margin:6px 0 0 0; font-size:12.5px; color:var(--muted); line-height:1.5;}

.search-box{margin-bottom:16px;}
.search-box input{
  width:100%; padding:11px 14px; border-radius:8px; border:1px solid var(--edge);
  background:var(--panel); color:var(--white); font-size:13px; outline:none;
}
.search-box input:focus{border-color:var(--gold);}

.protocol-list{display:flex; flex-direction:column; gap:10px;}
.protocol-card{
  display:flex; align-items:center; gap:14px; padding:14px 16px;
  background:var(--panel); border:1px solid var(--edge); border-left:4px solid var(--tag,var(--gold));
  border-radius:8px; cursor:pointer; text-align:left;
}
.protocol-card:active{background:#16223c;}
.protocol-card .emoji{font-size:22px; flex:0 0 auto; width:30px; text-align:center;}
.protocol-card .info{flex:1; min-width:0; display:flex; flex-direction:column; gap:2px;}
.protocol-card .info .t{display:block; font-weight:800; font-size:13.5px; color:var(--white);}
.protocol-card .info .d{display:block; font-size:11.5px; color:var(--muted); line-height:1.35; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.protocol-card .chev{color:var(--muted); font-size:16px; flex:0 0 auto;}

.empty-state{text-align:center; padding:40px 20px; color:var(--muted); font-size:13px;}

/* ---- Protocol detail view ---- */
.protocol-frame .page{max-width:none; padding-left:0;}
.protocol-frame .page::before{display:none;}
.protocol-frame .topbar{border-radius:8px 8px 0 0; margin:0 -18px; width:calc(100% + 36px);}
.protocol-frame .header{padding-left:4px; padding-right:4px;}
.protocol-frame .wrap{padding-left:4px; padding-right:4px;}
.protocol-frame .footer{padding-left:4px; padding-right:4px; margin-left:-4px; margin-right:-4px;}

/* ---- Content protection (deterrents, not a real lock -- see SETUP.md) ---- */
/* Casual copy/paste and iOS's long-press "Copy/Save" callout, scoped to the
   protocol content only -- the rest of the app (email fields, etc.) is untouched. */
.protocol-frame, .protocol-frame *{
  -webkit-user-select:none; -moz-user-select:none; user-select:none;
  -webkit-touch-callout:none;
}
.protocol-frame img{ -webkit-user-drag:none; user-drag:none; pointer-events:none; }

.protocol-frame{ position:relative; }
.watermark-layer{
  position:absolute; top:0; left:0; right:0; bottom:0;
  pointer-events:none; z-index:50;
  background-repeat:repeat;
}

/* ---- Account menu ---- */
.account-sheet{
  position:fixed; inset:0; z-index:50; background:rgba(0,0,0,0.5);
  display:flex; align-items:flex-end; justify-content:center;
}
.account-sheet .panel{
  width:100%; max-width:520px; background:var(--panel); border:1px solid var(--edge);
  border-radius:14px 14px 0 0; padding:20px 20px calc(20px + env(safe-area-inset-bottom,0px)) 20px;
}
.account-sheet .row{padding:13px 4px; border-bottom:1px solid var(--edge); font-size:13.5px; display:flex; justify-content:space-between; align-items:center; cursor:pointer;}
.account-sheet .row:last-child{border-bottom:none;}
.account-sheet .email{font-size:11.5px; color:var(--muted); padding:0 4px 4px 4px;}
.account-sheet .status{font-size:11.5px; color:var(--gold-lt); font-weight:700; padding:0 4px 12px 4px;}

/* ---- Loading spinner ---- */
.spinner-wrap{min-height:100%; display:flex; align-items:center; justify-content:center;}
.spinner{width:34px; height:34px; border-radius:50%; border:3px solid var(--edge); border-top-color:var(--gold-lt); animation:spin 0.8s linear infinite;}
@keyframes spin{to{transform:rotate(360deg);}}

/* ---- Toast ---- */
.toast{
  position:fixed; left:50%; bottom:24px; transform:translateX(-50%);
  background:var(--panel); border:1px solid var(--edge); color:var(--text);
  padding:11px 18px; border-radius:8px; font-size:12.5px; z-index:60;
  box-shadow:0 10px 30px rgba(0,0,0,0.4); max-width:90%; text-align:center;
}

@media (min-width:640px){
  .screen-body{padding-top:28px;}
}
