/* ============================================================
   Lexio — styles
   ============================================================ */

:root{
  --bg:#f6f5fb;
  --surface:#ffffff;
  --surface-2:#f1eefb;
  --text:#211f36;
  --muted:#6f6c8a;
  --border:#e7e3f5;

  --primary:#6c5ce7;
  --primary-strong:#5a4bd6;
  --primary-soft:#efeafd;

  --grad:linear-gradient(135deg,#6c5ce7 0%,#9333ea 55%,#c026d3 100%);
  --accent:#f59e0b;
  --accent-soft:#fef3c7;

  --syn:#0d9f6e;     --syn-bg:#e7f7f0;
  --ant:#e0245e;     --ant-bg:#fde9ef;

  --radius:18px;
  --radius-sm:12px;
  --shadow:0 10px 30px rgba(35,28,80,.07);
  --shadow-lg:0 26px 60px rgba(35,28,80,.16);

  --maxw:1120px;
}

[data-theme="dark"]{
  --bg:#121120;
  --surface:#1b1a2e;
  --surface-2:#232238;
  --text:#edecf8;
  --muted:#a09dbd;
  --border:#2e2c49;
  --primary-soft:#2a2748;
  --syn-bg:#16281f;
  --ant-bg:#2c1a22;
  --accent-soft:#3a2c10;
  --shadow:0 10px 30px rgba(0,0,0,.4);
  --shadow-lg:0 26px 60px rgba(0,0,0,.5);
}

*{ box-sizing:border-box; }
html{ scroll-behavior:smooth; }
body{
  margin:0;
  font-family:'Inter',system-ui,-apple-system,sans-serif;
  background:var(--bg);
  color:var(--text);
  line-height:1.6;
  -webkit-font-smoothing:antialiased;
}
a{ color:var(--primary); text-decoration:none; }
a:hover{ text-decoration:underline; }

.container{ max-width:var(--maxw); margin:0 auto; padding:0 22px; }
.main{ padding:30px 22px 70px; min-height:62vh; }

/* headings */
h1,h2,h3{ font-family:'Sora',sans-serif; line-height:1.15; }
.serif{ font-family:'Fraunces',Georgia,serif; }

/* ---------- buttons ---------- */
.btn{
  display:inline-flex; align-items:center; gap:8px;
  font-weight:600; font-size:.95rem;
  padding:12px 20px; border-radius:999px;
  border:1px solid transparent; cursor:pointer;
  transition:.18s transform,.18s box-shadow,.18s background;
  font-family:inherit;
}
.btn:hover{ text-decoration:none; transform:translateY(-1px); }
.btn:active{ transform:translateY(0); }
.btn-primary{ background:var(--grad); color:#fff !important; box-shadow:0 8px 20px rgba(108,92,231,.35); }
.btn-primary:hover{ box-shadow:0 12px 26px rgba(108,92,231,.45); }
.btn-ghost{ background:transparent; border-color:var(--border); color:var(--text); }
.btn-ghost:hover{ background:var(--surface-2); }
.btn-sm{ padding:8px 14px; font-size:.85rem; }
.btn-block{ width:100%; justify-content:center; }

/* ---------- nav ---------- */
.nav{
  position:sticky; top:0; z-index:50;
  background:var(--surface);
  background:color-mix(in srgb,var(--surface) 82%,transparent);
  backdrop-filter:blur(12px);
  border-bottom:1px solid var(--border);
}
.nav-inner{
  display:flex; align-items:center; gap:18px;
  height:66px; flex-wrap:wrap;
}
.brand{ display:flex; align-items:center; gap:10px; font-weight:800; font-size:1.25rem; font-family:'Sora'; color:var(--text); }
.brand:hover{ text-decoration:none; }
.brand-mark{
  display:grid; place-items:center;
  width:34px; height:34px; border-radius:10px;
  background:var(--grad); color:#fff; font-weight:800;
  box-shadow:0 6px 14px rgba(108,92,231,.4);
}
.brand-mark.sm{ width:24px; height:24px; border-radius:7px; font-size:.8rem; }

.nav-search{ flex:1 1 220px; max-width:360px; }
.nav-search input{
  width:100%; padding:11px 18px; border-radius:999px;
  border:1px solid var(--border); background:var(--surface-2); color:var(--text);
  font-family:inherit; font-size:.92rem; outline:none; transition:.18s;
}
.nav-search input:focus{ border-color:var(--primary); background:var(--surface); box-shadow:0 0 0 4px var(--primary-soft); }

.nav-links{ display:flex; align-items:center; gap:6px; }
.nav-links a{ color:var(--muted); font-weight:600; font-size:.92rem; padding:8px 12px; border-radius:999px; }
.nav-links a:not(.btn):hover{ background:var(--surface-2); color:var(--text); text-decoration:none; }

.nav-right{ display:flex; align-items:center; gap:10px; margin-left:auto; }
.nav-user{ font-weight:600; color:var(--text); }
.icon-btn{
  display:grid; place-items:center; width:38px; height:38px; border-radius:50%;
  border:1px solid var(--border); background:var(--surface); color:var(--text);
  cursor:pointer; transition:.18s;
}
.icon-btn:hover{ background:var(--surface-2); }
#themeToggle svg{ transition:.3s; }
[data-theme="dark"] #themeToggle svg{ transform:rotate(180deg); }

/* ---------- flash ---------- */
.flash{
  margin:16px 22px 0; max-width:var(--maxw);
  margin-left:auto; margin-right:auto;
  padding:13px 18px; border-radius:var(--radius-sm); font-weight:500; font-size:.92rem;
  border:1px solid var(--border); background:var(--surface);
}
.flash-success{ border-color:#9ae6b0; background:var(--syn-bg); color:var(--syn); }
.flash-error{ border-color:#fbb6ce; background:var(--ant-bg); color:var(--ant); }
.flash-info{ border-color:var(--primary); background:var(--primary-soft); color:var(--primary-strong); }

/* ---------- hero ---------- */
.hero{ text-align:center; padding:44px 0 30px; }
.hero h1{
  font-size:clamp(2.1rem,5vw,3.4rem); margin:0 0 12px;
  background:var(--grad); -webkit-background-clip:text; background-clip:text; color:transparent;
}
.hero p{ color:var(--muted); font-size:1.08rem; max-width:560px; margin:0 auto 26px; }
.search-box{ position:relative; max-width:560px; margin:0 auto; }
.search-box input{
  width:100%; padding:18px 56px 18px 24px; border-radius:999px;
  border:1px solid var(--border); background:var(--surface); color:var(--text);
  font-size:1.05rem; box-shadow:var(--shadow); outline:none; transition:.18s;
  font-family:inherit;
}
.search-box input:focus{ border-color:var(--primary); box-shadow:var(--shadow-lg),0 0 0 5px var(--primary-soft); }
.search-box .search-go{
  position:absolute; right:7px; top:7px; bottom:7px; width:48px;
  border:none; border-radius:999px; background:var(--grad); color:#fff; cursor:pointer;
  display:grid; place-items:center;
}
.suggest-box{
  position:absolute; left:0; right:0; top:calc(100% + 8px); z-index:20;
  background:var(--surface); border:1px solid var(--border); border-radius:14px;
  box-shadow:var(--shadow-lg); overflow:hidden; display:none; text-align:left;
}
.suggest-box.open{ display:block; }
.suggest-box a{ display:block; padding:11px 18px; color:var(--text); font-weight:500; border-bottom:1px solid var(--border); }
.suggest-box a:last-child{ border-bottom:none; }
.suggest-box a:hover{ background:var(--surface-2); text-decoration:none; }
.suggest-box .muted{ color:var(--muted); font-size:.85rem; padding:10px 18px; }

.hero-actions{ margin-top:22px; display:flex; gap:12px; justify-content:center; flex-wrap:wrap; }

/* ---------- stats ---------- */
.stats{
  display:grid; grid-template-columns:repeat(auto-fit,minmax(140px,1fr));
  gap:14px; margin:34px 0;
}
.stat{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  padding:18px; text-align:center; box-shadow:var(--shadow);
}
.stat .num{ font-family:'Sora'; font-size:1.8rem; font-weight:800; color:var(--primary); }
.stat .lbl{ color:var(--muted); font-size:.85rem; font-weight:600; text-transform:uppercase; letter-spacing:.04em; }

/* ---------- sections ---------- */
.section{ margin:42px 0; }
.section-head{ display:flex; align-items:baseline; justify-content:space-between; gap:12px; margin-bottom:18px; flex-wrap:wrap; }
.section-title{ font-size:1.5rem; margin:0; display:flex; align-items:center; gap:12px; }
.section-title::before{ content:''; width:6px; height:26px; border-radius:4px; background:var(--grad); }
.section-link{ font-weight:600; font-size:.92rem; }

/* ---------- word of the day ---------- */
.wotd{
  background:var(--grad); color:#fff; border-radius:24px; padding:38px;
  box-shadow:var(--shadow-lg); position:relative; overflow:hidden;
}
.wotd::after{
  content:''; position:absolute; right:-60px; top:-60px; width:220px; height:220px;
  border-radius:50%; background:rgba(255,255,255,.12);
}
.wotd-eyebrow{
  font-size:.78rem; font-weight:700; letter-spacing:.18em; text-transform:uppercase;
  color:rgba(255,255,255,.85); display:flex; align-items:center; gap:10px;
}
.wotd-eyebrow::before{ content:'★'; font-size:1rem; }
.wotd .word{ font-family:'Fraunces',serif; font-size:clamp(2.4rem,6vw,3.6rem); font-weight:600; margin:8px 0 4px; }
.wotd .pos{ font-style:italic; color:rgba(255,255,255,.8); font-size:1rem; margin-bottom:14px; }
.wotd .def{ font-size:1.1rem; max-width:680px; color:rgba(255,255,255,.92); }
.wotd .wotd-cta{ margin-top:22px; }
.wotd .btn-light{ background:#fff; color:var(--primary-strong); }

/* ---------- word grid ---------- */
.grid-words{ display:grid; grid-template-columns:repeat(auto-fill,minmax(250px,1fr)); gap:18px; }
.word-card{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  padding:20px; box-shadow:var(--shadow); display:flex; flex-direction:column; gap:8px;
  transition:.2s transform,.2s box-shadow; text-decoration:none; color:inherit;
}
.word-card:hover{ transform:translateY(-4px); box-shadow:var(--shadow-lg); text-decoration:none; }
.word-card .wc-word{ font-family:'Fraunces',serif; font-size:1.5rem; font-weight:600; color:var(--text); }
.word-card .wc-excerpt{ color:var(--muted); font-size:.92rem; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.word-card .wc-foot{ display:flex; align-items:center; gap:14px; margin-top:auto; padding-top:8px; font-size:.8rem; color:var(--muted); }
.word-card .wc-foot span{ display:inline-flex; align-items:center; gap:4px; }

.pos-badge{
  display:inline-block; font-size:.72rem; font-weight:700; text-transform:uppercase;
  letter-spacing:.05em; padding:3px 10px; border-radius:999px;
  background:var(--primary-soft); color:var(--primary-strong);
}

/* ---------- letter strip ---------- */
.letter-strip{ display:flex; flex-wrap:wrap; gap:6px; margin-bottom:24px; }
.letter-strip a{
  width:38px; height:38px; display:grid; place-items:center; border-radius:10px;
  background:var(--surface); border:1px solid var(--border); color:var(--text); font-weight:700;
}
.letter-strip a:hover{ background:var(--primary); color:#fff; border-color:var(--primary); text-decoration:none; }
.letter-strip a.active{ background:var(--grad); color:#fff; border-color:transparent; }
.letter-strip a.all{ width:auto; padding:0 14px; }

/* ---------- chips ---------- */
.chips{ display:flex; flex-wrap:wrap; gap:8px; }
.chip{
  padding:7px 14px; border-radius:999px; font-size:.9rem; font-weight:600;
  border:1px solid transparent;
}
.chip-syn{ background:var(--syn-bg); color:var(--syn); }
.chip-ant{ background:var(--ant-bg); color:var(--ant); }
.chip-info{ background:var(--surface-2); color:var(--muted); }

/* ---------- word detail ---------- */
.word-hero{
  background:var(--surface); border:1px solid var(--border); border-radius:24px;
  padding:32px; box-shadow:var(--shadow); margin-bottom:28px;
}
.word-hero .wh-top{ display:flex; align-items:flex-start; justify-content:space-between; gap:16px; flex-wrap:wrap; }
.word-hero h1{ font-family:'Fraunces',serif; font-size:clamp(2.2rem,5vw,3.2rem); font-weight:600; margin:0; }
.word-hero .wh-meta{ color:var(--muted); font-size:.88rem; margin-top:10px; display:flex; gap:16px; flex-wrap:wrap; }
.like-btn{
  display:inline-flex; align-items:center; gap:8px; padding:10px 18px; border-radius:999px;
  border:1px solid var(--border); background:var(--surface); color:var(--text);
  font-weight:600; cursor:pointer; font-family:inherit; font-size:.95rem; transition:.18s;
}
.like-btn:hover{ border-color:var(--ant); color:var(--ant); }
.like-btn.liked{ background:var(--ant-bg); color:var(--ant); border-color:transparent; }
.like-btn .heart{ font-size:1.05rem; }

.panel{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  padding:24px; box-shadow:var(--shadow); margin-bottom:20px;
}
.panel h2{ font-size:1.2rem; margin:0 0 14px; display:flex; align-items:center; gap:10px; }
.panel h2 .count{ font-size:.8rem; color:var(--muted); font-weight:600; }

.meaning{ display:flex; gap:14px; padding:12px 0; border-bottom:1px solid var(--border); }
.meaning:last-child{ border-bottom:none; }
.meaning .num{ flex:none; width:26px; height:26px; border-radius:8px; background:var(--primary-soft); color:var(--primary-strong); font-weight:700; display:grid; place-items:center; font-size:.85rem; }
.meaning .def{ flex:1; }
.meaning .by{ color:var(--muted); font-size:.8rem; margin-top:4px; }

.sentence{ padding:10px 16px; border-left:3px solid var(--primary); background:var(--surface-2); border-radius:0 12px 12px 0; margin-bottom:8px; font-style:italic; }
.sentence .by{ display:block; font-style:normal; color:var(--muted); font-size:.78rem; margin-top:4px; }

.oneword-row{ display:flex; gap:10px; align-items:center; padding:10px 0; border-bottom:1px dashed var(--border); flex-wrap:wrap; }
.oneword-row:last-child{ border-bottom:none; }
.oneword-row .phrase{ color:var(--text); }
.oneword-row .arrow{ color:var(--muted); }

.empty-note{ color:var(--muted); font-style:italic; padding:6px 0; }

/* ---------- contribute forms ---------- */
.contribute-cta{
  background:var(--primary-soft); border:1px dashed var(--primary);
  border-radius:var(--radius); padding:22px; text-align:center;
}
.contribute-cta h3{ margin:0 0 6px; }
.contribute-cta p{ margin:0 0 14px; color:var(--muted); }

.form-grid{ display:grid; grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); gap:18px; }
.form-card{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  padding:20px; box-shadow:var(--shadow);
}
.form-card h3{ margin:0 0 12px; font-size:1.05rem; }
label{ display:block; font-weight:600; font-size:.85rem; margin:12px 0 6px; color:var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=search], select, textarea{
  width:100%; padding:11px 14px; border-radius:var(--radius-sm); border:1px solid var(--border);
  background:var(--surface-2); color:var(--text); font-family:inherit; font-size:.95rem; outline:none; transition:.18s;
}
input:focus, select:focus, textarea:focus{ border-color:var(--primary); background:var(--surface); box-shadow:0 0 0 4px var(--primary-soft); }
textarea{ resize:vertical; min-height:84px; }
.hint{ font-size:.78rem; color:var(--muted); margin-top:5px; }

/* ---------- auth ---------- */
.auth-wrap{ max-width:440px; margin:30px auto; }
.auth-card{ background:var(--surface); border:1px solid var(--border); border-radius:24px; padding:32px; box-shadow:var(--shadow-lg); }
.auth-card h1{ font-size:1.7rem; margin:0 0 6px; }
.auth-card .sub{ color:var(--muted); margin:0 0 22px; }
.auth-foot{ text-align:center; margin-top:18px; color:var(--muted); font-size:.9rem; }

/* ---------- profile ---------- */
.profile-head{ display:flex; align-items:center; gap:18px; flex-wrap:wrap; margin-bottom:24px; }
.avatar{
  width:64px; height:64px; border-radius:18px; background:var(--grad); color:#fff;
  display:grid; place-items:center; font-family:'Sora'; font-weight:800; font-size:1.8rem;
}
.profile-head h1{ margin:0; font-size:1.8rem; }
.profile-head .since{ color:var(--muted); font-size:.88rem; }

.list-row{ display:flex; gap:10px; align-items:baseline; padding:9px 0; border-bottom:1px solid var(--border); }
.list-row:last-child{ border-bottom:none; }
.list-row .lr-title{ font-weight:600; }
.list-row .lr-sub{ color:var(--muted); font-size:.85rem; }

/* ---------- footer ---------- */
.footer{ border-top:1px solid var(--border); background:var(--surface); padding:28px 0; margin-top:50px; }
.footer-inner{ display:flex; flex-direction:column; gap:6px; align-items:center; text-align:center; color:var(--muted); }
.footer-brand strong{ color:var(--text); }
.footer-links{ display:flex; gap:16px; flex-wrap:wrap; justify-content:center; }
.footer-links a{ color:var(--muted); font-weight:600; font-size:.9rem; }

/* ---------- utilities ---------- */
.two-col{ display:grid; grid-template-columns:1.4fr 1fr; gap:24px; align-items:start; }
.muted{ color:var(--muted); }
.center{ text-align:center; }
.mt0{ margin-top:0; }

/* ---------- responsive ---------- */
@media (max-width:820px){
  .two-col{ grid-template-columns:1fr; }
  .nav-search{ order:3; flex-basis:100%; max-width:none; }
  .nav-inner{ height:auto; padding:10px 0; }
  .nav-links{ display:none; }
}
@media (max-width:520px){
  .main{ padding:20px 16px 60px; }
  .container{ padding:0 16px; }
  .wotd, .word-hero, .auth-card{ padding:24px 20px; }
  .nav-right .btn-ghost{ display:none; }
}
