/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  background: #f5f5f7;
  min-height: 100vh;
  padding: 20px;
  padding-top: calc(20px + var(--topbar-h, 60px) + 18px);
line-height: 1.6;
  color: #1d1d1f;
}

/* Typography */
h1 {
  text-align: center;
  font-size: 32px;
  font-weight: 600;
  color: #1d1d1f;
  margin: 30px 0 10px;
  letter-spacing: -0.5px;
}

h2 {
  font-size: 20px;
  font-weight: 600;
  color: #1d1d1f;
  margin: 25px 0 15px;
  letter-spacing: -0.3px;
}

.small {
  text-align: center;
  color: #86868b;
  font-size: 15px;
  margin-bottom: 30px;
}

/* Form Container */
form {
  max-width: 1000px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
}

/* Sections */
.section {
  margin-bottom: 35px;
  padding-bottom: 25px;
  border-bottom: 1px solid #e5e5e7;
}

.section:last-of-type {
  border-bottom: none;
}

/* Labels */
label {
  display: block;
  font-size: 15px;
  font-weight: 500;
  color: #1d1d1f;
  margin-bottom: 8px;
  margin-top: 15px;
}

/* Input & Select */
input[type="text"],
input[type="number"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: 12px 16px; 
  font-size: 15px;
  font-family: inherit;
  border: 1px solid #d2d2d7;
  border-radius: 10px;
  background: #ffffff;
  color: #1d1d1f;
  transition: all 0.2s ease;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #0071e3;
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
}

input::placeholder {
  color: #86868b;
}

/* Textarea */
textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.5;
}

/* textarea 1 dòng gọn như input */
.textarea-1line {
  height: 32px !important;
  min-height: 32px !important;
  line-height: 20px;
  padding: 4px 8px;
  resize: none;
  overflow: hidden;
}

/* Select Arrow */
select {
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%2386868b' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* Grid Layout */
.row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 15px;
}

.col {
  display: flex;
  flex-direction: column;
}

/* Buttons */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 30px;
  padding-top: 30px;
  border-top: 1px solid #e5e5e7;
}

button {
  padding: 14px 28px;
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #0071e3;
  color: white;
  min-width: 180px;
}

button:hover {
  background: #0077ed;
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button.secondary {
  background: #f5f5f7;
  color: #1d1d1f;
}

button.secondary:hover {
  background: #e8e8ed;
}

/* Chat Bubble */
#chat-bubble {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;

  border-radius: 14px;
  background: transparent;      /* ❌ bỏ nền xanh */
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);

  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;

  overflow: hidden;             /* 🔥 cho ảnh tràn full */
  transition: transform 0.2s ease;
  z-index: 1000;
}

#chat-bubble:hover {
  transform: scale(1.1);
}

#chat-bubble img {
  width: 100%;
  height: 100%;
  object-fit: cover;            /* 🔥 tràn full, không méo */
  display: block;
}

/* Chat Box */
/* Chat Box (slide up/down) */
#chat-panel {
  position: fixed;
  bottom: 100px;
  right: 30px;
  width: 380px;
  height: 500px;

  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);

  display: flex;                 /* luôn là flex để animate */
  flex-direction: column;
  overflow: hidden;
  z-index: 1001;

  /* trạng thái đóng */
  opacity: 0;
  transform: translateY(24px);
  pointer-events: none;

  transition:
    transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.25s ease;
}

/* trạng thái mở */
#chat-panel.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* optional: giảm motion nếu user bật reduce motion */
@media (prefers-reduced-motion: reduce) {
  #chat-panel {
    transition: none;
  }
}

@media (max-width: 480px) {
  #chat-panel {
    right: 16px;
    left: 16px;
    width: auto;
    bottom: 96px;
    height: 70vh;
    max-height: 560px;
  }
}

.chat-header {
  background: linear-gradient(135deg, #0071e3, #00a8e8);
  color: white;
  padding: 18px 20px;
  font-weight: 600;
  font-size: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#chat-close {
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  opacity: 0.9;
  transition: opacity 0.2s;
}

#chat-close:hover {
  opacity: 1;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f5f5f7;
}

.msg {
  margin-bottom: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  max-width: 80%;
  word-wrap: break-word;
  font-size: 14px;
  line-height: 1.5;
}

.msg.user {
  background: #0071e3;
  color: white;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

.msg.bot {
  background: white;
  color: #1d1d1f;
  margin-right: auto;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.chat-input {
  display: flex;
  align-items: center;
  padding: 15px;
  background: white;
  border-top: 1px solid #e5e5e7;
  gap: 10px;
}

.chat-input input {
  flex: 1 1 auto;
  padding: 10px 14px;
  border: 1px solid #d2d2d7;
  border-radius: 8px;
  font-size: 14px;
}

.chat-input button {
  flex: 0 0 auto;
  padding: 10px 20px;
  min-width: auto;
  border-radius: 8px;
  font-size: 14px;
  width: auto !important;   /* chặn rule width:100% global */
  min-width: 88px;    /* giới hạn tối thiểu */
  max-width: 120px;   /* giới hạn tối đa */
  white-space: nowrap;
}

.chat-input button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.chat-input input:disabled {
  background: #f5f5f7;
}

/* Chat loading message */
.msg.loading {
  background: transparent;
  color: #6e6e73;
  font-style: italic;
  box-shadow: none;
  padding: 8px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Dot loading animation */
.typing-dots {
  display: inline-flex;
  gap: 4px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  background: #6e6e73;
  border-radius: 50%;
  animation: blink 1.4s infinite both;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
  0% { opacity: 0.2; }
  20% { opacity: 1; }
  100% { opacity: 0.2; }
}

/* Loading Overlay */
#loadingOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 2000;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#loadingOverlay p {
  color: white;
  font-size: 16px;
  font-weight: 500;
  margin-top: 20px;
}

/* ===========================
   PREVIEW MODAL (POPUP)
   =========================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 6000; /* cao hơn loadingOverlay(2000) và chat */
}

.modal-backdrop.show {
  display: flex;
}

.modal-shell {
  width: min(980px, 100%);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #fff;
  position: relative;
  z-index: 2;
}

.modal-header .title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.modal-close {
  position: relative;
  z-index: 2;
  appearance: none;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 14px;
  border-radius: 12px;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  transition: background 0.2s ease, transform 0.2s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.modal-close:active {
  transform: translateY(0);
}

.modal-body {
  overflow: hidden;
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  background: rgba(255, 255, 255, 0.06);
}

/* iframe preview */
#previewFrame {
  width: 100%;
  height: 85vh;
  border: 0;
  display: block;
  background: #f5f5f7;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .modal-backdrop {
    padding: 14px;
  }
  .modal-shell {
    max-height: 94vh;
  }
  #previewFrame {
    height: 82vh;
  }
}


/* Responsive Design */
@media (max-width: 768px) {
  body {
    padding: 15px;
  }

  h1 {
    font-size: 26px;
    margin: 100px 0 8px;
  }

  h2 {
    font-size: 18px;
  }

  form {
    padding: 25px 20px;
    border-radius: 16px;
  }

  .row {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .actions {
    flex-direction: column;
  }

  button {
    width: 100%;
    min-width: auto;
  }

  #chat-panel {
    width: calc(100vw - 30px);
    right: 15px;
    bottom: 90px;
    height: 450px;
  }

  #chat-bubble {
    bottom: 20px;
    right: 20px;
    width: 55px;
    height: 55px;
  }

  #chat-bubble img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    display: block;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 22px;
  }

  form {
    padding: 20px 15px;
  }

  .section {
    margin-bottom: 25px;
    padding-bottom: 20px;
  }

  input[type="text"],
  input[type="number"],
  input[type="datetime-local"],
  select,
  textarea {
    padding: 10px 12px;
    font-size: 14px;
  }

  button {
    padding: 12px 20px;
    font-size: 14px;
  }

  .small {
    font-size: 14px;
  }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f5f5f7;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #d2d2d7;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #86868b;
}

/* Remove spinner (number input) */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield; /* Firefox */
}


/* =========================================================
   MOBILE OVERRIDES (Chat + Preview) — final, wins conflicts
   ========================================================= */

/* iOS safe-area helpers */
:root {
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

/* iOS: tránh zoom khi focus input */
@media (max-width: 768px) {
  .chat-input input { font-size: 16px !important; }
}

/* ---------- Chat bubble: consistent sizing + safe-area ---------- */
@media (max-width: 768px) {
  #chat-bubble {
    right: 16px !important;
    bottom: calc(16px + var(--safe-b)) !important;
    width: 56px !important;
    height: 56px !important;
    border-radius: 14px;
  }

  #chat-bubble img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    display: block;
  }
}

/* ---------- Chat box: full-width card on mobile (avoid keyboard issues) ---------- */
@media (max-width: 768px) {
  #chat-panel {
    left: 12px !important;
    right: 12px !important;
    width: auto !important;

    /* đặt nổi trên bubble + safe-area */
    bottom: calc(84px + var(--safe-b)) !important;

    /* dùng dvh để ít bị thanh địa chỉ/bàn phím làm nhảy */
    height: min(72dvh, 560px) !important;
    max-height: none !important;

    border-radius: 18px !important;
  }

  .chat-header { padding: 14px 16px; font-size: 15px; }
  .chat-messages { padding: 14px; }
  .chat-input { padding: 12px; gap: 10px; }
  .chat-input button { padding: 10px 14px; border-radius: 10px; }
}

/* màn rất nhỏ: gần full-screen */
@media (max-width: 480px) {
  #chat-panel {
    left: 10px !important;
    right: 10px !important;
    bottom: calc(78px + var(--safe-b)) !important;
    height: 78dvh !important;
  }
}

/* ---------- Preview modal: full-screen on mobile ---------- */
@media (max-width: 768px) {
  .modal-backdrop { padding: 0 !important; }

  .modal-shell {
    width: 100% !important;
    height: 100dvh !important;
    max-height: none !important;
    gap: 0 !important;
  }

  .modal-header {
    padding: calc(10px + var(--safe-t)) 12px 10px 12px !important;
    position: sticky;
    top: 0;
    z-index: 1;
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  .modal-body {
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
  }

  #previewFrame {
    height: calc(100dvh - 56px - var(--safe-t) - var(--safe-b)) !important;
    border-radius: 0 !important;
    background: #f5f5f7;
  }

  .modal-close { padding: 10px 12px; border-radius: 12px; }
}


/* =========================================================
   TOP GLASS BAR (Actions + Chat)
   ========================================================= */
:root{
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --topbar-h: 60px;
  --topbar-gap: 14px;
  --glass-bg: rgba(255,255,255,0.55);
  --glass-stroke: rgba(255,255,255,0.55);
  --glass-shadow: 0 18px 50px rgba(0,0,0,0.12);
}

/* Container */
.topbar{
  position: fixed;
  top: calc(var(--topbar-gap) + var(--safe-t));
  left: 50%;
  transform: translateX(-50%);
  width: min(1020px, calc(100% - 24px));
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  z-index: 4000; /* above modal header and chat */
}

/* Apple-ish liquid glass */
.glass{
  background: var(--glass-bg);
  border: 1px solid var(--glass-stroke);
  border-radius: 18px;
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  overflow: hidden;
  will-change: transform;
}

/* animated sheen that subtly shifts with scroll */
.glass::before{
  content:"";
  position:absolute;
  inset:-40%;
  background:
    radial-gradient(600px 260px at 20% 20%, rgba(255,255,255,0.75), transparent 60%),
    radial-gradient(520px 240px at 80% 30%, rgba(255,255,255,0.45), transparent 60%),
    radial-gradient(620px 280px at 60% 90%, rgba(255,255,255,0.35), transparent 62%);
  transform: translate3d(calc(var(--scroll-x, 0px) * 0.08), calc(var(--scroll-y, 0px) * 0.05), 0);
  pointer-events:none;
  filter: blur(0.2px);
  opacity: 0.75;
}

.glass::after{
  content:"";
  position:absolute;
  inset:0;
  background: linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0.06));
  pointer-events:none;
}

.topbar > *{ position: relative; z-index: 1; }

.tb-actions{
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:center;
  flex: 1 1 auto;
}

.tb-btn{
  appearance:none;
  border:0;
  cursor:pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  color:#1d1d1f;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.42);
  border: 1px solid rgba(255,255,255,0.55);
  box-shadow: 0 8px 18px rgba(0,0,0,0.08);
  transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
  display:flex;
  align-items:center;
  gap:8px;
  user-select:none;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.tb-btn:hover{ transform: translateY(-1px); background: rgba(255,255,255,0.55); }
.tb-btn:active{ transform: translateY(0px); }

.tb-home{
  width: 44px;
  height: 44px;
  justify-content:center;
  text-decoration:none;
}

.tb-chat{ min-width: 92px; justify-content:center; }
.tb-chat-text{ display:inline-block; }

@media (max-width: 520px){
  :root{ --topbar-h: 56px; }
  .tb-actions{ gap: 8px; }
  .tb-btn{ padding: 10px 10px; border-radius: 14px; }
  .tb-chat{ min-width: 56px; }
  .tb-chat-text{ display:none; } /* keep icon-only on small phones */
}

/* =========================================================
   CHAT PANEL (slides from top bar)
   ========================================================= */
#chat-panel{
  position: fixed;
  top: calc(var(--topbar-gap) + var(--safe-t) + var(--topbar-h) + 10px);
  right: calc(12px + max(0px, (100vw - 1020px)/2));
  width: 380px;
  height: min(560px, calc(100dvh - (var(--topbar-gap) + var(--safe-t) + var(--topbar-h) + 10px) - 16px - var(--safe-b)));
  border-radius: 18px;
  z-index: 3999;

  background: rgba(255,255,255,0.62);
  border: 1px solid rgba(255,255,255,0.65);
  box-shadow: 0 22px 70px rgba(0,0,0,0.22);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);

  display: flex;
  flex-direction: column;
  overflow: hidden;

  /* closed */
  opacity: 0;
  transform: translateY(-16px);
  pointer-events: none;

  transition:
    transform 0.32s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.22s ease;
}

#chat-panel.show{
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#chat-panel .chat-header{
  background: rgba(255,255,255,0.10);
  color: #1d1d1f;
  border-bottom: 1px solid rgba(255,255,255,0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

#chat-panel .chat-messages{ background: rgba(245,245,247,0.55); }

#chat-panel .msg.bot{
  background: rgba(255,255,255,0.7);
  border: 1px solid rgba(255,255,255,0.55);
  box-shadow: 0 8px 16px rgba(0,0,0,0.06);
}

#chat-panel .msg.user{
  background: rgba(0,113,227,0.92);
}

@media (max-width: 768px){
  #chat-panel{
    left: 12px;
    right: 12px;
    width: auto;
    height: calc(100dvh - (var(--topbar-gap) + var(--safe-t) + var(--topbar-h) + 10px) - 12px - var(--safe-b));
    border-radius: 20px;
  }
}

/* prefers-reduced-motion */
@media (prefers-reduced-motion: reduce){
  #chat-panel{ transition: none; }
  .tb-btn{ transition: none; }
}


/* Icon sizing inside topbar buttons */
.tb-btn svg,
.tb-btn img{
  width: 20px;
  height: 20px;
  display: block;
  flex: 0 0 auto;
}

.tb-chat-img{
  border-radius: 6px;
}

/* When buttons contain only icon + short label, align nicely */
.tb-actions .tb-btn span{
  display: inline-block;
}

/* Mobile: hide labels for action buttons to save space */
@media (max-width: 520px){
  .tb-actions .tb-btn span{ display:none; }
  .tb-chat{ min-width: 52px; }
}

/* =========================================================
   SHARE TAB (Apple-style)
   ========================================================= */
#share-notice{
  margin: 10px auto 14px auto;
  max-width: 1000px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.68);
  box-shadow: 0 10px 30px rgba(0,0,0,0.06);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  font-size: 14px;
  line-height: 1.35;
  display: none;
}

.share-row{
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}

.share-row .share-label{
  font-weight: 600;
  color:#1d1d1f;
}

.share-link{
  display:inline-flex;
  align-items:center;
  max-width: 100%;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(245,245,247,0.9);
  color:#1d1d1f;
  text-decoration:none;
  word-break: break-all;
}

.share-link:hover{
  background: rgba(232,232,237,0.95);
}

.share-actions{
  display:inline-flex;
  align-items:center;
  gap: 8px;
}

/* Text Copy button (reliable, Apple-ish minimal) */
.copy-btn{
  appearance:none;
  border: none;
  background: none;
  color:#007aff; /* Apple blue */
  font-size: 14px;
  font-weight: 600;
  cursor:pointer;
  padding: 6px 10px;
  border-radius: 10px;
  transition: background 0.2s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.copy-btn:hover{
  background: rgba(0,122,255,0.10);
  transform: translateY(-1px);
}

.copy-btn:active{
  transform: translateY(0);
}

.copy-btn.is-done{
  color:#34c759; /* Apple green */
  background: rgba(52,199,89,0.12);
}

.apple-icon-btn{
  appearance:none;
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(255,255,255,0.75);
  /* Global button styles set text color to white; override so text is visible */
  color:#007aff; /* Apple blue */
  border-radius: 12px;
  padding: 8px 10px;
  min-width: auto; /* override global button min-width */
  height: 36px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap: 8px;
  cursor:pointer;
  box-shadow: 0 8px 18px rgba(0,0,0,0.06);
  transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

/* Icon-only variant (Apple-ish) */
.apple-icon-btn.icon-only{
  width: 36px;
  padding: 0;
}

/* Done state: green tick */
.apple-icon-btn.is-done{
  color: #16a34a;
  border-color: rgba(22,163,74,0.25);
  background: rgba(255,255,255,0.85);
}

.apple-icon-btn.is-done:hover{
  background: rgba(255,255,255,0.95);
}

.apple-icon-btn:hover{
  background: rgba(255,255,255,0.9);
  transform: translateY(-1px);
}

.apple-icon-btn:active{
  transform: translateY(0);
  box-shadow: 0 6px 14px rgba(0,0,0,0.06);
}

.apple-icon-btn svg{
  width: 18px;
  height: 18px;
  display:block;
}

/* Keep if you ever re-enable text */
.apple-icon-btn .btn-text{
  font-size: 13px;
  font-weight: 600;
  color: currentColor;
}

/* CLS AI button: Apple green */
.cls-ai-btn{
  background: #297fe2;
  color: #fff;
  border-color: #297fe2;
  padding: 4px 8px;
  height: 28px;
  font-size: 14px;
  min-width: auto;
  width: auto;
  letter-spacing: 0;
  flex: 0 0 auto;
}
.cls-ai-btn:hover{
  background: #1c5aa0;
}

/* Keep CLS AI button inline-sized on mobile */
@media (max-width: 640px){
  .cls-ai-btn{
    width: auto !important;
  }
}

/* Override row grid for the CLS header line */
.cls-row{
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.cls-search-row .cls-label{
  font-weight: 600;
  color: #1d1d1f;
}

.cls-search-wrap{
  position: relative;
  flex: 1 1 280px;
  min-width: 220px;
}

#cls-search{
  width: 100%;
}

.cls-suggest{
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #d2d2d7;
  border-radius: 12px;
  box-shadow: 0 14px 30px rgba(0,0,0,0.12);
  max-height: 260px;
  overflow: auto;
  display: none;
  z-index: 6;
}

.cls-suggest.show{
  display: block;
}

button.cls-suggest-item{
  width: 100%;
  min-width: 0;
  padding: 8px 12px;
  text-align: left;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #1d1d1f;
  font-size: 14px;
  font-weight: 500;
  box-shadow: none;
  transform: none;
}

button.cls-suggest-item:hover,
button.cls-suggest-item.is-active{
  background: #f5f5f7;
  transform: none;
}

button.cls-suggest-item:active{
  transform: none;
}

@media (max-width: 520px){
  .apple-icon-btn .btn-text{ display:none; }
}

.share-hint{
  margin-top: 8px;
  color:#6e6e73;
}
.share-muted{
  color:#6e6e73;
}

.markdown-body {
  line-height: 1.6;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  margin: 8px 0;
  font-weight: 700;
}

.markdown-body p {
  margin: 6px 0;
}

.markdown-body strong {
  font-weight: 700;
}

.markdown-body em {
  font-style: italic;
}

.markdown-body ul {
  padding-left: 20px;
}

.markdown-body code {
  background: #f4f4f4;
  padding: 2px 6px;
  border-radius: 6px;
  font-family: monospace;
}

