*{box-sizing:border-box}

:root{
 --bg:#f6f7f9;
 --surface:#ffffff;
 --surface-soft:#f1f3f5;
 --text:#17181b;
 --muted:#747982;
 --border:#e5e7eb;
 --accent:#6d4aff;
 --accent-dark:#5837e8;
 --danger:#c2415d;
 --success:#287a57;
 --shadow:0 10px 35px rgba(20,20,30,.06);
 --radius:22px;
}

html{
 scroll-behavior:smooth;
}

body{
 margin:0;
 background:
   radial-gradient(circle at top left,rgba(109,74,255,.055),transparent 32rem),
   var(--bg);
 color:var(--text);
 font-family:Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
 line-height:1.6;
 -webkit-font-smoothing:antialiased;
}

a{
 color:inherit;
}

button,
input,
textarea,
select{
 font:inherit;
}

button,
a{
 -webkit-tap-highlight-color:transparent;
}

:focus-visible{
 outline:3px solid rgba(109,74,255,.28);
 outline-offset:3px;
}

/* HEADER */

.site-header{
 position:sticky;
 top:0;
 z-index:100;
 height:72px;
 display:flex;
 align-items:center;
 justify-content:space-between;
 padding:0 max(20px,calc((100% - 1120px)/2));
 background:rgba(255,255,255,.86);
 border-bottom:1px solid rgba(229,231,235,.8);
 backdrop-filter:blur(18px);
 -webkit-backdrop-filter:blur(18px);
}

.brand{
 text-decoration:none;
 font-weight:800;
 letter-spacing:-.035em;
 font-size:1.08rem;
 white-space:nowrap;
}

.desktop-nav{
 display:flex;
 align-items:center;
 gap:5px;
}

.desktop-nav a{
 text-decoration:none;
 color:var(--muted);
 font-size:.92rem;
 font-weight:600;
 padding:9px 13px;
 border-radius:12px;
 transition:.18s ease;
}

.desktop-nav a:hover{
 background:var(--surface-soft);
 color:var(--text);
}

.desktop-nav a.nav-primary{
 background:var(--text);
 color:#fff;
 padding:10px 17px;
}

.desktop-nav a.nav-primary:hover{
 background:#000;
 color:#fff;
 transform:translateY(-1px);
}

.desktop-nav a.nav-logout{
 color:#a23b4f;
}

/* LAYOUT */

.container{
 width:min(calc(100% - 32px),720px);
 margin:0 auto;
}

.narrow{
 max-width:640px;
}

.hero{
 padding:72px 0 48px;
}

.eyebrow{
 margin:0 0 12px;
 color:var(--accent);
 font-size:.78rem;
 font-weight:800;
 letter-spacing:.1em;
 text-transform:uppercase;
}

.hero h1,
.page-heading h1{
 margin:0;
 font-size:clamp(2.5rem,8vw,4.6rem);
 line-height:.98;
 letter-spacing:-.055em;
 font-weight:850;
}

.hero-copy{
 max-width:570px;
 margin:24px 0 28px;
 color:var(--muted);
 font-size:1.08rem;
 line-height:1.7;
}

/* BUTTONS */

.button{
 display:inline-flex;
 align-items:center;
 justify-content:center;
 min-height:48px;
 padding:0 19px;
 border:0;
 border-radius:14px;
 text-decoration:none;
 font-weight:750;
 cursor:pointer;
 transition:transform .18s ease,box-shadow .18s ease,background .18s ease;
}

.button:hover{
 transform:translateY(-1px);
}

.button.primary{
 background:var(--text);
 color:#fff;
 box-shadow:0 8px 22px rgba(20,20,25,.14);
}

.button.primary:hover{
 background:#000;
 box-shadow:0 12px 28px rgba(20,20,25,.18);
}

/* FEED */

.feed-header{
 display:flex;
 align-items:end;
 justify-content:space-between;
 gap:20px;
 margin:18px 0 8px;
}

.feed-header h2{
 margin:0;
 font-size:1.35rem;
 letter-spacing:-.025em;
}

.feed-header p{
 margin:4px 0 0;
 color:var(--muted);
 font-size:.88rem;
}

.feed-tabs{
 display:flex;
 gap:4px;
 margin:14px 0 18px;
 padding:4px;
 background:var(--surface-soft);
 border-radius:14px;
 overflow-x:auto;
}

.tab{
 border:0;
 background:transparent;
 padding:9px 15px;
 border-radius:10px;
 color:var(--muted);
 cursor:pointer;
 font-weight:700;
 white-space:nowrap;
}

.tab.active{
 background:var(--surface);
 color:var(--text);
 box-shadow:0 2px 8px rgba(20,20,30,.08);
}

/* TRUTH CARD */

.truth-card{
 background:var(--surface);
 border:1px solid var(--border);
 border-radius:var(--radius);
 padding:24px;
 margin:12px 0;
 box-shadow:var(--shadow);
 transition:transform .18s ease,box-shadow .18s ease;
}

.truth-card:hover{
 transform:translateY(-2px);
 box-shadow:0 16px 40px rgba(20,20,30,.09);
}

.truth-text{
 margin:0 0 18px;
 font-size:1.08rem;
 line-height:1.7;
 letter-spacing:-.01em;
 overflow-wrap:anywhere;
}

.truth-meta{
 display:flex;
 align-items:center;
 gap:10px;
 color:var(--muted);
 font-size:.78rem;
}

.truth-meta span:first-child{
 color:var(--text);
 font-weight:700;
}

.truth-actions{
 display:flex;
 align-items:center;
 flex-wrap:wrap;
 gap:7px;
 margin-top:18px;
 padding-top:15px;
 border-top:1px solid var(--border);
}

.reaction,
.text-button{
 border:0;
 background:transparent;
 color:var(--muted);
 padding:8px 10px;
 border-radius:10px;
 cursor:pointer;
 font-size:.86rem;
 font-weight:650;
 transition:.16s ease;
}

.reaction:hover,
.text-button:hover{
 background:var(--surface-soft);
 color:var(--text);
}

.reaction.reacted{
 color:var(--danger);
 background:#fff1f4;
}

/* FORMS */

.card-form{
 background:var(--surface);
 border:1px solid var(--border);
 border-radius:var(--radius);
 padding:26px;
 box-shadow:var(--shadow);
}

.card-form label{
 display:grid;
 gap:7px;
 margin-bottom:18px;
 color:var(--text);
 font-size:.88rem;
 font-weight:700;
}

.card-form input,
.card-form textarea,
.card-form select{
 width:100%;
 border:1px solid var(--border);
 border-radius:14px;
 background:#fbfbfc;
 color:var(--text);
 padding:13px 15px;
 outline:0;
 transition:.16s ease;
}

.card-form input:focus,
.card-form textarea:focus,
.card-form select:focus{
 background:#fff;
 border-color:rgba(109,74,255,.5);
 box-shadow:0 0 0 4px rgba(109,74,255,.09);
}

.card-form textarea{
 min-height:250px;
 resize:vertical;
 line-height:1.65;
}

.composer-meta{
 display:flex;
 align-items:center;
 justify-content:space-between;
 gap:12px;
 margin:8px 0 18px;
 color:var(--muted);
 font-size:.82rem;
}

.composer-meta select{
 width:auto;
 min-width:170px;
 margin:0;
}

.form-note{
 color:var(--muted);
 font-size:.85rem;
 text-align:center;
}

.divider{
 display:flex;
 align-items:center;
 gap:12px;
 margin:22px 0;
 color:var(--muted);
}

.divider:before,
.divider:after{
 content:"";
 height:1px;
 background:var(--border);
 flex:1;
}

/* PAGE HEADINGS */

.page-heading{
 padding:55px 0 26px;
}

.page-heading p{
 color:var(--muted);
 margin:12px 0 0;
}

/* EMPTY / LOADING */

.empty,
.loading{
 padding:45px 24px;
 text-align:center;
 color:var(--muted);
 background:rgba(255,255,255,.65);
 border:1px dashed var(--border);
 border-radius:var(--radius);
}

/* FOOTER */

.site-footer{
 width:min(calc(100% - 32px),720px);
 margin:90px auto 110px;
 color:var(--muted);
 font-size:.82rem;
}

.site-footer nav{
 display:flex;
 flex-wrap:wrap;
 gap:8px 18px;
 padding-bottom:18px;
 border-bottom:1px solid var(--border);
}

.site-footer nav a{
 text-decoration:none;
}

.site-footer nav a:hover{
 color:var(--text);
}

.support-footer{
 margin-top:24px;
 padding-top:18px;
 border-top:1px solid var(--border);
}

.support-footer p{
 line-height:1.55;
}

.footer-contact{
 margin-top:16px;
}

.footer-contact a{
 text-decoration:none;
}

/* MOBILE NAV */

.mobile-nav{
 display:none;
}

/* AUTH */

.auth-page{
 padding-bottom:30px;
}

.auth-page .card-form{
 margin-top:12px;
}

.auth-page .button{
 width:100%;
}

/* MOBILE */

@media(max-width:680px){

 .site-header{
  height:62px;
  padding:0 16px;
 }

 .brand{
  font-size:1rem;
 }

 .desktop-nav{
  display:none;
 }

 .container{
  width:min(calc(100% - 24px),720px);
 }

 .hero{
  padding:54px 0 38px;
 }

 .hero h1,
 .page-heading h1{
  font-size:clamp(2.5rem,14vw,3.7rem);
 }

 .hero-copy{
  font-size:1rem;
 }

 .feed-header{
  display:block;
 }

 .feed-tabs{
  position:sticky;
  top:62px;
  z-index:30;
  margin-left:-6px;
  margin-right:-6px;
  border-radius:0 0 14px 14px;
  background:rgba(246,247,249,.92);
  backdrop-filter:blur(14px);
 }

 .truth-card{
  padding:19px;
  border-radius:19px;
 }

 .truth-text{
  font-size:1.04rem;
 }

 .card-form{
  padding:19px;
  border-radius:19px;
 }

 .composer-meta{
  align-items:stretch;
  flex-direction:column;
 }

 .composer-meta select{
  width:100%;
 }

 .site-footer{
  margin:60px auto 100px;
 }

 .mobile-nav{
  position:fixed;
  display:flex;
  z-index:200;
  left:12px;
  right:12px;
  bottom:max(12px,env(safe-area-inset-bottom));
  min-height:62px;
  padding:6px;
  justify-content:space-around;
  align-items:center;
  background:rgba(255,255,255,.94);
  border:1px solid var(--border);
  border-radius:19px;
  box-shadow:0 14px 40px rgba(20,20,30,.15);
  backdrop-filter:blur(18px);
 }

 .mobile-nav a{
  flex:1;
  text-align:center;
  text-decoration:none;
  color:var(--muted);
  font-size:.76rem;
  font-weight:700;
  padding:10px 5px;
  border-radius:13px;
 }

 .mobile-nav a:hover{
  color:var(--text);
  background:var(--surface-soft);
 }

 .mobile-nav a[href="/write"]{
  background:var(--text);
  color:#fff;
 }

}

/* REDUCED MOTION */

@media(prefers-reduced-motion:reduce){
 html{scroll-behavior:auto}
 *{transition:none!important}
}

/* =========================
   MY TRUTHS — MODERN UI
   ========================= */

.my-truth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 20px;
    margin: 0 0 14px;
    box-shadow: 0 4px 18px rgba(20, 24, 30, .04);
}

.my-truth-card.is-deleted {
    opacity: .6;
}

.my-truth-top,
.my-truth-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.truth-category {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
}

.truth-date {
    font-size: .76rem;
    color: var(--muted);
}

.my-truth-text {
    font-size: 1.08rem;
    line-height: 1.65;
    margin: 18px 0;
    white-space: normal;
}

.truth-status {
    font-size: .78rem;
    color: var(--muted);
}

.my-truth-actions {
    display: flex;
    gap: 8px;
}

.action-button {
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 999px;
    padding: 9px 13px;
    color: var(--text);
    font: inherit;
    font-size: .82rem;
    cursor: pointer;
}

.action-button:hover {
    background: var(--bg);
}

.action-button.danger {
    color: #9b4d4d;
}

.modern-empty {
    padding: 64px 24px;
    text-align: center;
}

.empty-icon {
    width: 54px;
    height: 54px;
    margin: 0 auto 18px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--bg);
    font-size: 1.4rem;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(20, 24, 30, .42);
    backdrop-filter: blur(8px);
}

.modal-card {
    width: min(100%, 560px);
    max-height: min(90vh, 720px);
    overflow: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 24px 80px rgba(20, 24, 30, .2);
}

.modal-card.compact {
    max-width: 430px;
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.modal-header h2,
.modal-card h2 {
    margin: 0;
}

.modal-close {
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: transparent;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-label {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: .9rem;
}

.modal-textarea {
    width: 100%;
    min-height: 220px;
    resize: vertical;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
    line-height: 1.6;
    outline: none;
}

.modal-textarea:focus {
    border-color: var(--text);
}

.edit-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
}

.edit-meta select {
    min-width: 150px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

#edit-counter {
    color: var(--muted);
    font-size: .8rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
}

.modal-error {
    min-height: 20px;
    margin: 12px 0 0;
    color: #a34f4f;
    font-size: .88rem;
}

.delete-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    margin-bottom: 18px;
    background: var(--bg);
    color: #9b4d4d;
    font-size: 1.25rem;
}

.modal-copy {
    color: var(--muted);
    line-height: 1.6;
}

.danger-button {
    border: 0;
    border-radius: 12px;
    padding: 11px 17px;
    background: #9b4d4d;
    color: white;
    font: inherit;
    cursor: pointer;
}

.danger-button:disabled,
.button:disabled {
    opacity: .55;
    cursor: wait;
}

@media (max-width: 680px) {
    .my-truth-card {
        border-radius: 18px;
        padding: 17px;
    }

    .my-truth-bottom {
        align-items: flex-end;
    }

    .my-truth-actions {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .modal-overlay {
        align-items: flex-end;
        padding: 10px;
    }

    .modal-card {
        border-radius: 24px 24px 18px 18px;
        padding: 20px;
    }

    .modal-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .modal-actions .button,
    .modal-actions button {
        width: 100%;
    }
}
