/* ============ Tokens ============
     Light palette คัดลอกมาจาก haarn.com (css/styles.css) ตรงๆ ตามที่ขอให้หน้าตาคล้ายกัน

     สีกลุ่ม --brand-*, --accent, --fg-inverse, --status-* ตั้งใจ "คงที่" ไม่เปลี่ยนตาม dark mode
     (เหมือนแนวทางเดิมของ haarn ที่ --input-bg ขาวตายตัวทุกธีม) เพราะเป็นสีตกแต่ง/ป้ายสถานะ/ปกหนังสือที่ควร
     อ่านออกเหมือนกันไม่ว่าโหมดไหน — มีแค่ชุดโครงหน้า (bg/card-bg/ink/line/shadow) และ --brand-dark-grey
     (พื้นปุ่มหลัก ต้องสว่างกว่าพื้นหลังหน้าถึงจะยังดูเป็นปุ่มลอยอยู่ตอนพื้นหน้าเข้มแล้ว) เท่านั้นที่ต้อง flip จริง */
  :root{
    --bg:#fcf9f4;
    --ink:#14141a;
    --ink-soft:#4a4a4a;
    --line:#14141a;
    --card-bg:#ffffff;
    --input-bg:#ffffff;
    --brand-dark-grey:#1a1a1a;

    --accent:#f39bc2;
    --accent-fg:#14141a;
    --fg-inverse:#fff;
    --focus-ring:#3a8fae;
    --ink-on-brand:#14141a;

    --brand-yellow:#fff669;
    --brand-navy:#3d2e4a;
    --brand-peach:#f39bc2;
    --brand-sage:#83ca9e;
    --brand-orange-red:#fcaf5d;
    --brand-dark-navy:#1f5c6b;
    --brand-ochre:#c092c3;
    --brand-ice-blue:#8dd8f8;

    --status-available-bg:#dff3e6;
    --status-available-fg:#1e6b45;
    --status-unavailable-bg:#f6e2da;
    --status-unavailable-fg:#96421f;

    --shadow-card:rgba(20,20,26,0.08);
    --shadow-modal:rgba(20,20,26,0.5);
  }

  @media (prefers-color-scheme: dark){
    :root:not([data-theme="light"]){
      --bg:#1b1720;
      --ink:#f4efe8;
      --ink-soft:#c9bfd6;
      --line:#f4efe8;
      --card-bg:#241f2c;
      --input-bg:#241f2c;
      --brand-dark-grey:#413a4d;

      --shadow-card:rgba(0,0,0,0.35);
      --shadow-modal:rgba(0,0,0,0.6);
    }
  }
  :root[data-theme="dark"]{
    --bg:#1b1720;
    --ink:#f4efe8;
    --ink-soft:#c9bfd6;
    --line:#f4efe8;
    --card-bg:#241f2c;
    --input-bg:#241f2c;
    --brand-dark-grey:#413a4d;

    --shadow-card:rgba(0,0,0,0.35);
    --shadow-modal:rgba(0,0,0,0.6);
  }

  *{box-sizing:border-box;}
  html,body{margin:0;padding:0;}
  body{
    background:var(--bg);
    color:var(--ink);
    font-family:'Mitr',sans-serif;
    -webkit-font-smoothing:antialiased;
    min-height:100vh;
  }
  a{color:inherit;}
  button,input,select{font-family:inherit;}
  ::selection{background:var(--accent);color:var(--accent-fg);}

  button, a, input, select{
    outline:none;
  }
  button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible{
    outline:2px solid var(--focus-ring);
    outline-offset:2px;
  }

  .visually-hidden{
    position:absolute; width:1px; height:1px; padding:0; margin:-1px;
    overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0;
  }

  /* ============ Topbar ============ */
  .topbar{
    max-width:1800px;
    margin:0 auto;
    padding:40px 32px 22px;
    transition:padding .35s ease;
  }
  body.landing .topbar{max-width:660px; padding-top:min(22vh,180px);}

  .topbar-head{
    display:flex;
    align-items:center;
    justify-content:space-between;
    flex-wrap:wrap;
    row-gap:10px;
    gap:12px;
    margin-bottom:26px;
  }
  body.landing .topbar-head{justify-content:center;}

  .brand{
    display:flex;
    align-items:center;
    gap:12px;
    text-decoration:none;
    color:inherit;
  }
  /* โลโก้จริง (assets/logo/logo-haarn.svg — ไอคอน+ตัวหนังสือ "หาอ่าน" รวมอยู่ในภาพเดียวกันแล้ว) มาแทน
     ไอคอนวงกลม+ตัวหนังสือพิมพ์เองที่เคยทำไว้ชั่วคราว (13 ส.ค. 2569 อาร์ธขอ) — เอาแท็กไลน์ "ข้างบ้าน" ที่เคย
     ต่อท้ายออกทั้งหมดแล้ว (อาร์ธขอรอบสอง 13 ส.ค. 2569 เย็น) ให้หน้าตาส่วนโลโก้เหมือน haarn ห้องสมุดเป๊ะๆ
     ทุกหน้า — เพราะจริงๆ ตั้งใจเป็นโปรเจคเดียวกัน แค่แยกไส้ในคู่ขนานไว้ชั่วคราว (ดู docs spec ข้อ 1) */
  .brand-logo{height:40px; width:auto; display:block;}
  body.landing .brand-logo{height:60px;}

  .site-nav{display:flex; align-items:center; gap:8px; flex-wrap:wrap; min-width:0;}
  body.landing .site-nav{display:none;}
  .page-nav{display:flex; align-items:center; gap:8px; flex-wrap:wrap; min-width:0;}
  .pill-btn{
    display:inline-flex;
    align-items:center;
    gap:6px;
    padding:9px 16px;
    border-radius:999px;
    border:1.5px solid var(--line);
    background:var(--card-bg);
    color:var(--ink);
    font-size:13.5px;
    font-weight:500;
    white-space:nowrap;
    cursor:pointer;
    text-decoration:none;
    transition:background .15s ease, color .15s ease, border-color .15s ease;
  }
  .pill-btn:hover{background:var(--brand-navy); color:var(--fg-inverse); border-color:var(--brand-navy);}
  .pill-btn.solid{background:var(--brand-dark-grey); color:var(--fg-inverse); border-color:var(--brand-dark-grey);}
  .pill-btn.solid:hover{background:var(--brand-navy); border-color:var(--brand-navy);}
  .pill-btn svg{width:14px;height:14px;flex-shrink:0;}

  .user-chip{
    display:inline-flex;
    align-items:center;
    gap:8px;
    max-width:200px;
    padding:6px 14px 6px 6px;
    border-radius:999px;
    border:1.5px solid var(--line);
    background:var(--card-bg);
    font-size:13px;
    font-weight:500;
  }
  .user-chip .avatar{
    width:26px;height:26px;border-radius:50%;
    background:var(--brand-peach);
    display:flex;align-items:center;justify-content:center;
    font-size:12px;font-weight:700;color:var(--ink-on-brand);
    flex-shrink:0;
  }
  /* ชื่อจริงจาก Google login ยาวไม่เท่ากัน — ตัดด้วย ellipsis กันดันเลย์เอาต์ header ล้นขวา (บั๊กที่เจอจริง
     หลัง login ครั้งแรกบนมือถือ, อาร์ธแจ้งไว้) */
  .user-chip .name{
    min-width:0;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
  }

  .hamburger-btn{
    display:none;
    width:40px;height:40px;
    border-radius:50%;
    border:1.5px solid var(--line);
    background:var(--card-bg);
    align-items:center;justify-content:center;
    color:var(--ink);
    flex-shrink:0;
  }
  .hamburger-btn svg{width:19px;height:19px;}

  @media (max-width:640px){
    .site-nav{
      display:none;
      position:absolute; top:100%; right:20px; left:20px;
      z-index:30;
      flex-direction:column; align-items:stretch; gap:8px;
      margin-top:8px; padding:12px;
      border:1.5px solid var(--line); border-radius:14px;
      background:var(--card-bg);
      box-shadow:0 8px 24px var(--shadow-card);
    }
    .site-nav.open{display:flex;}
    .pill-btn{justify-content:center;}
    .hamburger-btn{display:flex;}
    body:not(.landing) .topbar-head{position:relative;}
  }

  /* ============ Search ============ */
  .search-row{display:flex; gap:10px; align-items:stretch;}
  .search-box{
    flex:1; min-width:0;
    background:var(--input-bg);
    border:1.5px solid var(--line);
    border-radius:14px;
    padding:16px 20px;
    font-size:16px;
    color:var(--ink);
  }
  .search-box::placeholder{color:var(--ink-soft);}
  .search-box:focus{border-color:var(--focus-ring);}
  .search-btn{
    flex-shrink:0;
    background:var(--brand-dark-grey);
    color:var(--fg-inverse);
    border:1.5px solid var(--line);
    border-radius:14px;
    padding:0 28px;
    font-size:15px;
    font-weight:600;
    letter-spacing:0.01em;
    cursor:pointer;
    transition:background .15s ease, border-color .15s ease;
  }
  .search-btn:hover{background:var(--brand-orange-red); color:var(--ink-on-brand); border-color:var(--brand-orange-red);}

  .meta-row{
    display:flex; align-items:center; justify-content:space-between;
    flex-wrap:wrap; gap:12px;
    margin-top:16px;
  }
  body.landing .meta-row{justify-content:center;}
  .meta-controls{display:flex; align-items:center; gap:10px; flex-wrap:wrap;}
  .result-summary{font-size:13px; color:var(--ink-soft);}
  body.landing .result-summary{display:none;}

  .nearme-btn{
    position:relative;
    display:flex; align-items:center; gap:6px;
    height:42px; padding:0 15px;
    border:1.5px solid var(--line);
    background:var(--input-bg);
    border-radius:11px;
    font-size:13px; color:var(--ink);
    cursor:pointer;
    transition:background .15s ease, color .15s ease, border-color .15s ease;
  }
  .nearme-btn svg{width:14px;height:14px;flex-shrink:0;}
  .nearme-btn:hover{border-color:var(--ink);}
  .nearme-btn.active{background:var(--accent); border-color:var(--line); color:var(--accent-fg);}

  .radius-select{
    appearance:none; -webkit-appearance:none;
    background:var(--input-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236B7280' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 14px center;
    border:1.5px solid var(--line);
    border-radius:11px;
    height:42px; padding:0 34px 0 14px;
    font-size:13px; color:var(--ink);
    line-height:1.9;
    cursor:pointer;
  }
  .radius-select:focus{border-color:var(--focus-ring);}

  .tag-row{display:flex; flex-wrap:wrap; gap:8px; margin-top:16px;}
  body.landing .tag-row{justify-content:center;}
  .tag-btn{
    border:1.5px solid var(--line);
    background:var(--card-bg);
    border-radius:999px;
    padding:8px 15px;
    font-size:13px; color:var(--ink);
    cursor:pointer;
    transition:background .15s ease, color .15s ease;
  }
  .tag-btn:hover{background:var(--brand-yellow); color:var(--ink-on-brand); border-color:var(--brand-yellow);}

  /* ============ Hero copy (landing only) ============ */
  .hero-copy{
    max-width:520px; margin:22px auto 0; text-align:center;
    color:var(--ink-soft); font-size:14px; line-height:1.6;
    display:none;
  }
  body.landing .hero-copy{display:block;}

  /* ============ Results ============ */
  .results{
    max-width:1800px; margin:0 auto;
    padding:6px 32px 100px;
    display:none;
  }
  body:not(.landing) .results{display:block;}

  .empty-state{
    padding:70px 0; text-align:center; color:var(--ink-soft);
  }
  .empty-state svg{width:46px;height:46px; color:var(--line); margin-bottom:14px;}
  .empty-state .glyph-wrap{display:flex; justify-content:center;}

  .book-grid{
    display:grid;
    grid-template-columns:repeat(3, 1fr);
    gap:26px;
  }
  @media (max-width:980px) and (min-width:641px){
    .book-grid{grid-template-columns:repeat(2, 1fr);}
  }
  @media (max-width:640px){
    .book-grid{grid-template-columns:1fr;}
  }
  @media (min-width:1400px){
    .book-grid{grid-template-columns:repeat(4, 1fr);}
  }

  .book-card{
    border:1.5px solid var(--line);
    border-radius:14px;
    padding:18px;
    background:var(--card-bg);
    cursor:pointer;
    display:flex; flex-direction:column; gap:14px;
    transition:transform .15s ease, box-shadow .15s ease;
    text-align:left;
  }
  .book-card:hover{transform:translateY(-3px); box-shadow:0 10px 22px var(--shadow-card);}
  .book-card:disabled{opacity:1;}

  .card-top{display:flex; gap:14px;}

  /* โพลารอยด์: จำลอง "รูปถ่ายจริง" ของเจ้าของหนังสือ ต่างจากปกสะอาดจากฐานข้อมูลห้องสมุดใน haarn เดิม
     ตั้งใจเอียงเล็กน้อย + มีกรอบขาว + เทปมุมบน เพื่อสื่อว่านี่คือรูปที่คนถ่ายเอง ไม่ใช่ปกที่ดึงจาก DB */
  .photo-frame{
    flex-shrink:0;
    width:96px; height:128px;
    background:#fff;
    padding:6px 6px 16px;
    border-radius:3px;
    box-shadow:0 3px 10px var(--shadow-card);
    transform:rotate(var(--tilt,-2deg));
    position:relative;
  }
  .photo-frame .tape{
    position:absolute; top:-7px; left:50%;
    width:34px; height:14px;
    background:rgba(255,255,255,0.55);
    border:1px solid rgba(0,0,0,0.08);
    transform:translateX(-50%) rotate(-3deg);
  }
  .photo-frame .cover{
    width:100%; height:100%;
    border-radius:1px;
    display:flex; align-items:flex-end;
    padding:8px;
    position:relative;
    overflow:hidden;
    background:var(--bg); /* พื้นรอ่านโหลดรูปจริง (เห็นแวบเดียวก่อน img เข้า) */
  }
  .photo-frame .cover::before{
    content:"";
    position:absolute; inset:0;
    background:linear-gradient(180deg, rgba(255,255,255,0.16), rgba(0,0,0,0.14));
    pointer-events:none;
    z-index:1;
  }
  /* รูปถ่ายจริงของหนังสือ (บังคับกรอกตอนลงหนังสือ — สเปคข้อ 2) เต็มกรอบโพลารอยด์ ก่อนหน้านี้ตอน mockup
     ยังไม่มีรูปจริงเลยใช้สีพื้น+ชื่อเรื่องแทนไปก่อน (เห็น .cover-title/.spine ด้านล่าง ยังเก็บไว้เป็น fallback
     เผื่อ photo_url โหลดไม่ขึ้น) */
  .photo-frame .cover-photo{
    position:absolute; inset:0;
    width:100%; height:100%;
    object-fit:cover; object-position:center;
  }
  .photo-frame .cover .spine{
    position:absolute; left:0; top:0; bottom:0; width:9px;
    background:rgba(0,0,0,0.14);
  }
  .photo-frame .cover-title{
    position:relative; z-index:1;
    font-size:11px; font-weight:600; line-height:1.25;
    display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden;
  }

  .card-info{flex:1 1 auto; min-width:0; display:flex; flex-direction:column; gap:7px;}
  .status-badge{
    display:inline-flex; align-items:center; gap:5px;
    align-self:flex-start;
    font-size:11px; font-weight:600;
    padding:4px 10px; border-radius:999px;
  }
  .status-badge.available{background:var(--status-available-bg); color:var(--status-available-fg);}
  .status-badge.unavailable{background:var(--status-unavailable-bg); color:var(--status-unavailable-fg);}
  .status-badge .dot{width:6px;height:6px;border-radius:50%;background:currentColor;flex-shrink:0;}

  .card-title{
    font-size:16.5px; font-weight:600; line-height:1.3;
    display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
  }
  .card-author{font-size:12.5px; color:var(--ink-soft);}

  .card-meta{display:flex; align-items:center; gap:6px; flex-wrap:wrap; font-size:12px; color:var(--ink-soft);}
  .distance-chip{
    display:inline-flex; align-items:center; gap:4px;
    font-weight:600; color:var(--ink);
  }
  .distance-chip svg{width:11px;height:11px;}
  .meta-sep{color:var(--ink-soft);}

  .card-bottom{
    margin-top:auto;
    display:flex; align-items:center; justify-content:space-between; gap:10px;
    padding-top:12px; border-top:1px solid var(--line);
  }
  .owner-row{display:flex; align-items:center; gap:7px; min-width:0;}
  .owner-avatar{
    width:24px;height:24px;border-radius:50%;
    background:var(--brand-ice-blue);
    display:flex;align-items:center;justify-content:center;
    font-size:11px;font-weight:700; color:var(--ink-on-brand);
    flex-shrink:0;
  }
  .owner-stars{display:flex; align-items:center; gap:2px; flex-shrink:0;}
  .owner-stars svg{width:11px;height:11px;}
  .owner-name{font-size:12px; color:var(--ink-soft); overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}

  .contact-btn{
    flex-shrink:0;
    background:var(--brand-dark-grey);
    color:var(--fg-inverse);
    border:1.5px solid var(--line);
    border-radius:999px;
    padding:8px 16px;
    font-size:12.5px; font-weight:600;
    cursor:pointer;
    transition:background .15s ease;
  }
  .contact-btn:hover{background:var(--brand-orange-red); color:var(--ink-on-brand); border-color:var(--brand-orange-red);}
  .contact-btn:disabled{
    background:transparent; color:var(--ink-soft); cursor:not-allowed;
    border-color:var(--ink-soft);
  }

  /* ============ Modal ============ */
  .modal-overlay{
    position:fixed; inset:0; z-index:60;
    background:var(--shadow-modal);
    display:flex; align-items:center; justify-content:center;
    padding:20px;
    opacity:0; pointer-events:none;
    transition:opacity .18s ease;
  }
  .modal-overlay.open{opacity:1; pointer-events:auto;}
  .modal-box{
    width:100%; max-width:460px;
    max-height:88vh; overflow-y:auto;
    background:var(--card-bg);
    border:1.5px solid var(--line);
    border-radius:18px;
    padding:26px;
    transform:translateY(10px);
    transition:transform .18s ease;
  }
  .modal-overlay.open .modal-box{transform:translateY(0);}
  .modal-close{
    float:right;
    width:32px;height:32px;
    border-radius:50%;
    border:1.5px solid var(--line);
    background:var(--card-bg);
    display:flex; align-items:center; justify-content:center;
    cursor:pointer;
    color:var(--ink);
  }
  .modal-close svg{width:14px;height:14px;}
  .modal-head{display:flex; gap:16px; margin-bottom:16px;}
  .modal-head .photo-frame{width:110px; height:148px;}
  .modal-title{font-size:19px; font-weight:600; line-height:1.3; margin-bottom:4px;}
  .modal-author{font-size:13px; color:var(--ink-soft); margin-bottom:10px;}
  .modal-owner{display:flex; align-items:center; gap:8px; font-size:13px;}

  .modal-section{margin-top:18px; padding-top:16px; border-top:1px solid var(--line);}
  .modal-section-label{font-size:11px; font-weight:600; letter-spacing:0.05em; color:var(--ink-soft); text-transform:uppercase; margin-bottom:10px;}

  .gate-box{
    display:flex; flex-direction:column; align-items:center; gap:12px;
    text-align:center; padding:18px 12px;
    background:var(--bg); border:1.5px dashed var(--line); border-radius:12px;
  }
  .gate-box p{margin:0; font-size:13px; color:var(--ink-soft); line-height:1.6;}
  .google-btn{
    display:inline-flex; align-items:center; gap:9px;
    background:var(--card-bg); color:var(--ink);
    border:1.5px solid var(--line); border-radius:999px;
    padding:10px 20px; font-size:13.5px; font-weight:500;
    cursor:pointer;
  }
  .google-btn:hover{border-color:var(--focus-ring);}
  .google-btn svg{width:16px;height:16px;}

  .contact-reveal{
    display:flex; flex-direction:column; gap:12px;
  }
  .contact-line{
    display:flex; align-items:center; justify-content:space-between; gap:10px;
    background:var(--bg); border:1.5px solid var(--line); border-radius:10px;
    padding:10px 14px; font-size:13.5px; font-weight:500;
  }
  .contact-line .undecided{font-size:11px; color:var(--ink-soft); font-weight:400;}

  /* ---------- แผนที่ในโมดัล (เหมือน .map-toggle-btn/.modal-map-wrap ของ haarn ห้องสมุด) ----------
     ต่างจาก haarn เดิมตรงที่ตรงนี้ "จำลอง" แผนที่ด้วย SVG เอง ไม่ได้ต่อ Leaflet+OpenStreetMap จริง
     (แซนด์บ็อกซ์ของ artifact บล็อกการโหลด map tile จากเซิร์ฟเวอร์ภายนอกอยู่แล้ว) และตั้งใจให้ตำแหน่งเจ้าของ
     ออกมาเป็น "จุดโดยประมาณ + วงเบลอ" แทนหมุดแม่นยำ ตรงกับหลักการ privacy ข้อ 6 ของสเปคเป๊ะๆ พอดี */
  .map-toggle-btn{
    display:inline-flex; align-items:center; gap:7px;
    align-self:flex-start;
    background:var(--card-bg); color:var(--ink);
    border:1.5px solid var(--line); border-radius:999px;
    padding:8px 15px; font-size:12.5px; font-weight:500;
    cursor:pointer;
    transition:background .15s ease, color .15s ease;
  }
  .map-toggle-btn svg{width:14px;height:14px;flex-shrink:0;}
  .map-toggle-btn:hover{background:var(--brand-ice-blue); color:var(--ink-on-brand); border-color:var(--brand-ice-blue);}

  .modal-map-wrap{display:none; flex-direction:column; gap:10px;}
  .modal-map-wrap.open{display:flex;}
  .map-radius-row{display:flex; align-items:center; gap:8px;}
  .map-radius-row label{font-size:12px; color:var(--ink-soft);}
  .map-radius-select{
    appearance:none; -webkit-appearance:none;
    background:var(--input-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236B7280' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center;
    border:1.5px solid var(--line);
    border-radius:9px;
    height:36px; padding:0 30px 0 12px;
    font-size:12.5px; color:var(--ink);
    line-height:1.9;
    cursor:pointer;
  }
  .map-radius-select:focus{border-color:var(--focus-ring);}

  .map-canvas-frame{
    border:1.5px solid var(--line);
    border-radius:12px;
    overflow:hidden;
    background:var(--bg);
    aspect-ratio:4/3;
  }
  .map-canvas-frame svg{display:block; width:100%; height:100%;}
  .map-street{stroke:var(--ink-soft); stroke-width:1; opacity:0.28;}
  .map-radius-ring{fill:none; stroke:var(--ink-soft); stroke-width:1.3; stroke-dasharray:4 4; opacity:0.65;}
  .map-fuzz-zone{fill:var(--accent); opacity:0.22;}
  .map-you-ring{fill:none; stroke:var(--focus-ring); stroke-width:1.5; opacity:0.55; transform-origin:center; transform-box:fill-box; animation:mapPulse 2.4s ease-out infinite;}
  .map-you-dot{fill:var(--focus-ring); stroke:var(--card-bg); stroke-width:2;}
  .map-owner-pin{fill:var(--accent); stroke:var(--ink); stroke-width:1;}
  .map-caption{font-size:12px; color:var(--ink-soft); line-height:1.55;}
  .map-caption b{color:var(--ink); font-weight:600;}
  @keyframes mapPulse{
    0%{transform:scale(0.4); opacity:0.6;}
    100%{transform:scale(1.9); opacity:0;}
  }
  @media (prefers-reduced-motion: reduce){
    .map-you-ring{animation:none; opacity:0.35;}
  }

  .interest-btn{
    background:var(--brand-dark-grey); color:var(--fg-inverse);
    border:1.5px solid var(--line); border-radius:12px;
    padding:12px; font-size:14px; font-weight:600; cursor:pointer;
    transition:background .15s ease;
  }
  .interest-btn:hover{background:var(--brand-orange-red); color:var(--ink-on-brand); border-color:var(--brand-orange-red);}
  .interest-btn:disabled{background:var(--status-available-bg); color:var(--status-available-fg); cursor:default; border-color:transparent;}

  .disclaimer-text{font-size:11.5px; color:var(--ink-soft); line-height:1.6; margin-top:14px;}

  .toggle-link{
    background:none; border:none; padding:0; margin-top:14px;
    font-size:12.5px; color:var(--ink-soft); text-decoration:underline; cursor:pointer;
  }
  .interest-list{display:none; flex-direction:column; gap:8px; margin-top:12px;}
  .interest-list.open{display:flex;}
  .interest-item{
    display:flex; align-items:center; justify-content:space-between; gap:10px;
    font-size:12.5px; background:var(--bg); border:1px solid var(--line); border-radius:9px; padding:8px 12px;
  }
  .interest-item .who{display:flex; align-items:center; gap:7px;}
  .interest-item .when{color:var(--ink-soft);}

  /* ============ Toast ============ */
  .toast{
    position:fixed; left:50%; bottom:26px; z-index:70;
    transform:translate(-50%, 20px);
    background:var(--brand-dark-grey); color:var(--fg-inverse);
    padding:12px 20px; border-radius:12px;
    font-size:13.5px; display:flex; align-items:center; gap:8px;
    opacity:0; pointer-events:none;
    transition:opacity .2s ease, transform .2s ease;
    max-width:calc(100vw - 40px);
  }
  .toast.show{opacity:1; transform:translate(-50%, 0);}
  .toast svg{width:16px;height:16px; color:var(--status-available-fg); flex-shrink:0;}

  /* ============ Footer ============ */
  .site-footer{
    max-width:1800px; margin:0 auto;
    padding:26px 32px 46px;
    display:none;
  }
  body:not(.landing) .site-footer{display:block;}
  .footer-disclaimer{
    font-size:12px; line-height:1.7; color:var(--ink-soft);
    border-top:1.5px solid var(--line); padding-top:18px;
    max-width:900px;
  }

  @media (max-width:640px){
    .topbar{padding:28px 18px 16px;}
    .results{padding:6px 18px 90px;}
    .site-footer{padding:20px 18px 40px;}
    body.landing .topbar{padding-top:14vh;}
    .card-top{gap:12px;}
    .photo-frame{width:82px; height:112px;}
    .brand-logo{height:32px;}
    body.landing .brand-logo{height:48px;}
  }

  /* ============ หน้าอื่นที่ไม่ใช่หน้าค้นหา (list-book.html ฯลฯ) ============
     ใช้ header เบากว่า .topbar เดิม (ไม่มี search-row/landing state machine เพราะหน้านี้ไม่ต้องค้นหา) */
  .page-topbar{
    max-width:900px; margin:0 auto;
    padding:32px 24px 0;
    display:flex; align-items:center; justify-content:space-between;
    flex-wrap:wrap; row-gap:10px; gap:12px;
  }
  .page-main{max-width:900px; margin:0 auto; padding:24px 24px 100px;}
  .page-title{font-size:24px; font-weight:700; margin-bottom:6px; text-wrap:balance;}
  .page-subtitle{font-size:13.5px; color:var(--ink-soft); margin-bottom:28px; line-height:1.6;}
  @media (max-width:640px){
    .page-topbar{padding:24px 18px 0;}
    .page-main{padding:20px 18px 90px;}
  }

  /* ---------- ฟอร์ม (ลงหนังสือ) ---------- */
  .form-card{
    background:var(--card-bg); border:1.5px solid var(--line); border-radius:16px;
    padding:24px; margin-bottom:28px;
  }
  .form-field{display:flex; flex-direction:column; gap:6px; margin-bottom:18px;}
  .form-field:last-child{margin-bottom:0;}
  .form-field label{font-size:13px; font-weight:600;}
  .form-field .hint{font-size:11.5px; color:var(--ink-soft); font-weight:400;}
  .text-input, .textarea-input, .field-select{
    background:var(--input-bg);
    border:1.5px solid var(--line);
    border-radius:10px;
    padding:11px 14px;
    font-size:14.5px;
    font-family:inherit;
    color:var(--ink);
  }
  .text-input:focus, .textarea-input:focus, .field-select:focus{border-color:var(--focus-ring);}
  .textarea-input{resize:vertical; min-height:80px; line-height:1.5;}
  .field-select{
    appearance:none; -webkit-appearance:none;
    background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236B7280' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat:no-repeat; background-position:right 14px center;
    padding-right:34px;
    cursor:pointer;
  }

  .photo-drop{
    border:1.5px dashed var(--line); border-radius:14px;
    padding:18px; display:flex; align-items:center; gap:16px;
    background:var(--bg); cursor:pointer;
  }
  .photo-drop input[type="file"]{display:none;}
  .photo-drop-text{flex:1; min-width:0; font-size:13px; color:var(--ink-soft); line-height:1.6;}
  .photo-drop-text b{color:var(--ink); font-weight:600;}
  .photo-preview-frame{
    width:88px; height:118px; flex-shrink:0;
    border:1.5px solid var(--line); border-radius:8px; overflow:hidden;
    background:var(--card-bg);
    display:flex; align-items:center; justify-content:center;
  }
  .photo-preview-frame img{width:100%; height:100%; object-fit:cover;}
  .photo-preview-frame svg{width:22px; height:22px; color:var(--ink-soft);}

  .geo-row{display:flex; align-items:center; gap:10px; flex-wrap:wrap;}
  .geo-status{
    flex:1; min-width:180px;
    display:flex; align-items:center; gap:8px;
    font-size:12.5px; padding:10px 14px;
    border:1.5px solid var(--line); border-radius:10px;
    background:var(--bg); color:var(--ink-soft);
  }
  .geo-status.ok{border-color:transparent; background:var(--status-available-bg); color:var(--status-available-fg);}
  .geo-status.err{border-color:transparent; background:var(--status-unavailable-bg); color:var(--status-unavailable-fg);}
  .geo-status svg{width:14px; height:14px; flex-shrink:0;}

  /* ---------- ลากปรับหมุดได้ก่อน submit (อาร์ธขอ 13 ส.ค. 2569 — เดิมปักครั้งเดียวแก้ไม่ได้) ----------
     v2 (13 ส.ค. 2569 บ่าย — อาร์ธขอเปลี่ยน): เดิมจำลองด้วย SVG เอง ไม่มีภาพแผนที่จริงให้ดูว่าขยับไปไหน
     เปลี่ยนมาใช้ Leaflet + OpenStreetMap ของจริงแทน (ตัวเดียวกับที่ haarn ห้องสมุดใช้ในหน้ารายละเอียดหนังสือ
     — ดู index.html เดิมของ haarn ฟังก์ชัน renderModalMap) ต่างจากหน้าค้นหา (assets/js/home.js) ที่ยังคง
     ใช้แผนที่ SVG จำลองอยู่ เพราะจุดประสงค์ต่างกัน: ตรงนั้นแค่โชว์ตำแหน่งโดยประมาณเฉยๆ ไม่ต้องแม่นยำ แต่ตรงนี้
     ผู้ใช้ต้อง "เห็นถนน/สถานที่จริง" ถึงจะปักหมุดได้อย่างมั่นใจว่าใกล้-ไกลจากบ้านตัวเองแค่ไหน
     วงกลมรัศมี (สร้างจาก L.circle ใน list-book.js) = ระยะที่ลากปรับได้ (ค่าคงที่ PIN_ADJUST_RADIUS_M ใน
     list-book.js ตอนนี้ 1 กม. ตามที่อาร์ธเสนอ แก้เป็นตัวเลขอื่นทีหลังได้ที่จุดเดียว — ดู
     docs/haarn-kangban-project-spec.md ข้อ 9 ยังไม่ฟันธงตัวเลข XXX เมตรสุดท้าย) จุดเทาเล็ก = ตำแหน่ง GPS
     จริงที่กดปักหมุดไว้ ไม่ขยับ

     v3 (13 ส.ค. 2569 เย็น — อาร์ธขอเปลี่ยนหลังทดลองบนมือถือจริง): หมุดสีชมพูเปลี่ยนจาก Leaflet marker
     ที่ลากตรงๆ (จุดกดเล็ก นิ้วบังตอนลากบนมือถือ) มาเป็นแพทเทิร์นแบบ Uber/Airbnb แทน — หมุด (.pin-center-marker)
     ลอยนิ่งอยู่กึ่งกลางจอด้วย position:absolute ทับแผนที่ตลอดเวลา ไม่ใช่ marker ของ Leaflet เอง (ไม่ pan
     ตามแผนที่ — มันคือสิ่งเดียวในแผงที่ "ไม่ขยับ" บนหน้าจอ) ผู้ใช้ลาก "ตัวแผนที่" แทน (touch target ใหญ่
     กว่าเดิมมาก = ทั้งจอ) ตำแหน่งที่บันทึกจริงคือพิกัด ณ กึ่งกลางจอตอนหยุดลาก — ลากออกนอกวงรัศมีไม่ได้
     (pan สแนปกลับขอบอัตโนมัติใน onPinMoveEnd ของ list-book.js) */
  .pin-map-wrap{display:none; flex-direction:column; gap:10px; margin-top:12px; width:100%;}
  .pin-map-wrap.open{display:flex;}
  .pin-map-frame{
    position:relative;
    width:100%; height:260px;
    border:1.5px solid var(--line); border-radius:12px; overflow:hidden;
    background:var(--bg);
  }
  /* ต้องอยู่เหนือ pane ของ Leaflet เสมอ (z-index มาตรฐานของ Leaflet อยู่แถวๆ 200-650) และไม่รับ
     pointer event เอง ไม่งั้นจะบังการลากแผนที่ที่อยู่ข้างใต้ */
  .pin-center-marker{
    position:absolute; left:50%; top:50%;
    transform:translate(-50%, -100%); /* ปลายแหลมของหมุดต้องชี้จุดกึ่งกลางเป๊ะ ไม่ใช่กึ่งกลางไอคอน */
    z-index:1000;
    pointer-events:none;
    filter:drop-shadow(0 2px 3px rgba(20,20,26,0.35));
  }
  .pin-center-marker svg{display:block;}
  .pin-map-caption{font-size:12px; color:var(--ink-soft); line-height:1.6;}
  .pin-map-caption b{color:var(--ink); font-weight:600;}

  .submit-btn{
    width:100%; padding:14px;
    background:var(--brand-dark-grey); color:var(--fg-inverse);
    border:1.5px solid var(--line); border-radius:12px;
    font-size:15px; font-weight:600; cursor:pointer; font-family:inherit;
    transition:background .15s ease;
  }
  .submit-btn:hover:not(:disabled){background:var(--brand-orange-red); color:var(--ink-on-brand); border-color:var(--brand-orange-red);}
  .submit-btn:disabled{opacity:.55; cursor:not-allowed;}

  .form-error{
    font-size:12.5px; color:var(--status-unavailable-fg);
    background:var(--status-unavailable-bg); border-radius:8px;
    padding:9px 12px; margin-top:-6px; margin-bottom:16px;
    display:none;
  }
  .form-error.show{display:block;}

  /* ---------- หนังสือของฉัน (จัดการสถานะเอง — สเปคข้อ 4.6) ---------- */
  .my-books-section{margin-top:8px;}
  .section-title{font-size:16px; font-weight:600; margin-bottom:14px;}
  .my-books-list{display:flex; flex-direction:column; gap:12px;}
  .my-book-row{
    display:flex; align-items:center; gap:14px;
    padding:12px 14px;
    border:1.5px solid var(--line); border-radius:12px;
    background:var(--card-bg);
  }
  .my-book-thumb{
    width:48px; height:64px; flex-shrink:0;
    border-radius:6px; overflow:hidden;
    border:1.5px solid var(--line); background:var(--bg);
  }
  .my-book-thumb img{width:100%; height:100%; object-fit:cover;}
  .my-book-info{flex:1; min-width:0;}
  .my-book-title{
    font-size:14px; font-weight:600; margin-bottom:4px;
    overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  }
  .my-book-meta{font-size:11.5px; color:var(--ink-soft);}
  .my-book-actions{display:flex; align-items:center; gap:8px; flex-shrink:0;}
  .status-toggle-btn{
    font-size:12px; font-weight:600; padding:7px 13px;
    border-radius:999px; border:1.5px solid var(--line);
    background:var(--card-bg); color:var(--ink); cursor:pointer;
  }
  .status-toggle-btn.is-available{background:var(--status-available-bg); color:var(--status-available-fg); border-color:transparent;}
  .status-toggle-btn.is-unavailable{background:var(--status-unavailable-bg); color:var(--status-unavailable-fg); border-color:transparent;}
  .icon-danger-btn{
    width:32px; height:32px; flex-shrink:0;
    border-radius:50%; border:1.5px solid var(--line);
    background:var(--card-bg); color:var(--ink-soft);
    display:flex; align-items:center; justify-content:center; cursor:pointer;
  }
  .icon-danger-btn:hover{border-color:var(--status-unavailable-fg); color:var(--status-unavailable-fg);}
  .icon-danger-btn svg{width:14px; height:14px;}
  .my-books-empty{
    font-size:13px; color:var(--ink-soft);
    padding:20px; text-align:center;
    border:1.5px dashed var(--line); border-radius:12px;
  }
