* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(180deg, #EDF1F6 0%, #F2F5F9 100%);
  color: #111827;
  min-height: 100vh;
}
.page { max-width: 842px; margin: 0 auto; padding: 40px 16px 32px; display: flex; flex-direction: column; min-height: 100vh; }
.header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon { width: 38px; height: 38px; background: #2563EB; border-radius: 9px; display: flex; align-items: center; justify-content: center; }
.logo-text { font-size: 17px; font-weight: 800; letter-spacing: -0.02em; }
.logo-blue { color: #2563EB; }
.lang-toggle { display: flex; background: #fff; border: 1px solid #E2E8F0; border-radius: 8px; padding: 3px; }
.lang-btn { border: 0; background: transparent; padding: 5px 14px; border-radius: 6px; min-height: 28px; font-weight: 700; font-size: 13px; color: #64748B; cursor: pointer; }
.lang-btn.active { background: #2563EB; color: #fff; }
.card { background: #fff; border-radius: 16px; box-shadow: 0 8px 30px rgba(15, 23, 42, 0.06); padding: 28px; text-align: center; }
.segmented { display: inline-flex; background: #F1F5F9; border-radius: 10px; padding: 4px; margin-bottom: 24px; }
.seg-btn { border: 0; background: transparent; padding: 8px 20px; border-radius: 8px; min-height: 36px; font-weight: 600; font-size: 14px; color: #475569; cursor: pointer; }
.seg-btn.active { background: #2563EB; color: #fff; }
.label { color: #2563EB; font-size: 11px; font-weight: 800; letter-spacing: 0.04em; margin-bottom: 10px; text-align: left; }
.address-box { display: flex; align-items: center; gap: 10px; background: #EEF4FF; border: 1px solid #DBEAFE; border-radius: 12px; padding: 12px 12px 12px 16px; min-height: 68px; }
.address-input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 19px; font-weight: 700; color: #111827; outline: none; }
.copy-btn { border: 0; background: #2563EB; color: #fff; width: 42px; height: 42px; border-radius: 9px; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.copy-btn:hover { background: #1D4ED8; }
.badge-row { text-align: left; }
.badge { display: inline-flex; align-items: center; gap: 6px; background: #DCFCE7; color: #15803D; font-size: 12px; font-weight: 500; padding: 5px 12px; border-radius: 999px; margin-top: 14px; }
.actions { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr; gap: 10px; margin-top: 20px; }
.btn { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 10px; padding: 11px 10px; min-height: 44px; font-size: 14px; font-weight: 600; cursor: pointer; border: 1px solid transparent; }
.btn-primary { background: #2563EB; color: #fff; box-shadow: 0 4px 14px rgba(37, 99, 235, 0.28); }
.btn-primary:hover { background: #1D4ED8; }
.btn-white { background: #fff; border-color: #B9C6D6; color: #1F2937; }
.btn-white:hover { background: #F8FAFC; }
.btn-block { width: 100%; margin-top: 16px; }
.btn-small { flex: none; padding: 6px 14px; font-size: 13px; }
.api-list { text-align: left; display: flex; flex-direction: column; gap: 10px; }
.api-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: #F8FAFC; border: 1px solid #E2E8F0; border-radius: 10px; padding: 10px 12px; }
.method { font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 6px; color: #fff; }
.method.get { background: #16A34A; } .method.post { background: #2563EB; } .method.del { background: #DC2626; }
.api-row code { font-size: 13px; font-weight: 600; }
.api-desc { color: #64748B; font-size: 13px; }
.api-note { color: #64748B; font-size: 13px; margin-top: 14px; text-align: left; }
.api-intro { color: #475569; font-size: 13px; line-height: 1.6; text-align: left; }
.api-h { font-size: 13px; font-weight: 800; color: #1E3A5F; margin: 18px 0 8px; text-align: left; }
.api-flow, .api-notes { margin: 0; padding-left: 18px; color: #475569; font-size: 13px; line-height: 1.7; text-align: left; }
.api-endpoint { display: flex; flex-direction: column; gap: 6px; }
.api-params { color: #64748B; font-size: 12.5px; margin: 0; text-align: left; line-height: 1.6; }
.api-params code { background: #F1F5F9; padding: 1px 5px; border-radius: 5px; font-size: 12px; }
.api-code { background: #0F172A; color: #E2E8F0; border-radius: 10px; padding: 12px; font-size: 12px; line-height: 1.6; overflow-x: auto; text-align: left; margin: 0; white-space: pre; }
.inbox { margin-top: 28px; flex: 1; }
.notif-banner { background: #EFF6FF; border: 1px solid #BFDBFE; border-radius: 14px; padding: 12px 14px; margin-bottom: 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.notif-banner[hidden] { display: none; }
.notif-text { flex: 1; min-width: 200px; font-size: 13px; color: #1E3A5F; display: flex; flex-direction: column; gap: 2px; }
.notif-actions { display: flex; gap: 8px; }
.history { background: #fff; border-radius: 16px; box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06); padding: 16px 20px; margin-bottom: 20px; }
.history[hidden] { display: none; }
.history-title { font-size: 12px; font-weight: 800; color: #2563EB; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 10px; }
.history-list { display: flex; flex-direction: column; gap: 6px; }
.history-empty { color: #94A3B8; font-size: 13px; text-align: center; padding: 10px 0; }
.history-row { display: flex; align-items: center; gap: 8px; border: 1px solid #E2E8F0; border-radius: 10px; padding: 8px 10px; background: #F8FAFC; cursor: pointer; text-align: left; width: 100%; font: inherit; }
.history-row.active { border-color: #2563EB; background: #EFF6FF; }
.history-addr { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-remove { border: none; background: transparent; color: #94A3B8; font-size: 16px; line-height: 1; cursor: pointer; padding: 2px 6px; }
.inbox-title { font-size: 18px; font-weight: 800; margin-bottom: 14px; }
.inbox-count { color: #94A3B8; font-weight: 600; }
.empty { text-align: center; padding: 28px 0 20px; color: #475569; }
.empty svg { width: 38px; height: 30px; }
.empty p { margin-top: 10px; font-size: 15px; font-weight: 600; color: #475569; }
.message-list { display: flex; flex-direction: column; gap: 10px; }
.message-item { background: #fff; border: 1px solid #E2E8F0; border-radius: 14px; padding: 14px 16px; cursor: pointer; text-align: left; width: 100%; }
.message-item:hover { border-color: #BFDBFE; }
.message-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.message-from { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-time { color: #94A3B8; font-size: 12px; flex-shrink: 0; }
.message-subject { font-size: 14px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-preview { color: #64748B; font-size: 13px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.otp-chip { display: inline-block; background: #EFF6FF; color: #2563EB; border: 1px solid #BFDBFE; font-weight: 800; font-size: 12px; padding: 2px 9px; border-radius: 999px; margin-top: 7px; letter-spacing: 0.06em; }
.footer { text-align: center; margin-top: 36px; }
.footer-links { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; color: #94A3B8; font-size: 14px; }
.footer-links a { color: #475569; text-decoration: none; font-weight: 500; }
.footer-links a:hover { text-decoration: underline; }
.copyright { color: #94A3B8; font-size: 13px; margin-top: 8px; }
.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal[hidden] { display: none; }
.modal-card { background: #fff; border-radius: 18px; padding: 26px; width: 100%; max-width: 440px; position: relative; max-height: 92vh; overflow-y: auto; display: flex; flex-direction: column; }
.modal-wide { max-width: 640px; }
.modal-card h3 { font-size: 19px; font-weight: 800; margin-bottom: 16px; }
.modal-close { position: absolute; top: 12px; right: 16px; border: 0; background: transparent; font-size: 26px; color: #94A3B8; cursor: pointer; line-height: 1; }
.modal-label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.modal-input { width: 100%; border: 1px solid #E2E8F0; border-radius: 10px; padding: 11px 13px; font-size: 15px; outline: none; }
.modal-input:focus { border-color: #2563EB; }
.modal-help { color: #64748B; font-size: 13px; margin-top: 8px; }
.msg-subject { padding-right: 28px; }
.msg-meta { color: #64748B; font-size: 13px; margin-bottom: 14px; line-height: 1.6; word-break: break-word; }
.otp-box { display: flex; align-items: center; gap: 12px; background: #EFF6FF; border: 1px solid #BFDBFE; border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; }
.otp-label { font-size: 11px; font-weight: 800; color: #2563EB; letter-spacing: 0.1em; }
.otp-code { font-size: 22px; font-weight: 800; letter-spacing: 0.14em; flex: 1; }
.msg-body { white-space: pre-wrap; word-break: break-word; font-size: 14px; line-height: 1.65; color: #1F2937; }
.msg-frame { width: 100%; flex: 1; min-height: 380px; border: 1px solid #E2E8F0; border-radius: 10px; margin-top: 12px; background: #fff; }
.attachments { margin-top: 4px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 10px; }
.attachments:empty { display: none; }
.att-title { font-size: 12px; font-weight: 800; color: #2563EB; letter-spacing: 0.08em; }
.att-item { border: 1px solid #E2E8F0; border-radius: 12px; padding: 10px 12px; background: #F8FAFC; }
.att-img { max-width: 100%; border-radius: 8px; display: block; margin-bottom: 8px; cursor: pointer; }
.att-chip { display: inline-block; margin-top: 6px; margin-left: 6px; background: #EEF2FF; color: #4338CA; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.att-row { display: flex; align-items: center; gap: 10px; }
.att-name { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-size { color: #94A3B8; font-size: 12px; flex-shrink: 0; }
.msg-actions { margin-top: 18px; display: flex; gap: 8px; }
.msg-actions .btn { width: 100%; }
.info-body { font-size: 14px; line-height: 1.7; color: #334155; }
.info-body p { margin-bottom: 10px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #111827; color: #fff; font-size: 14px; font-weight: 600; padding: 11px 20px; border-radius: 999px; z-index: 60; box-shadow: 0 10px 30px rgba(0,0,0,0.25); max-width: 90vw; text-align: center; }
.toast[hidden] { display: none; }
@media (max-width: 560px) {
  .card { padding: 20px 16px; }
  .actions { grid-template-columns: 1fr; }
  .address-input { font-size: 14px; }
  .logo-text { font-size: 17px; }
  .modal { padding: 10px; }
  .modal-card { padding: 20px 16px; max-height: 94vh; }
  .msg-subject { font-size: 17px; line-height: 1.35; }
  .msg-frame { min-height: 320px; }
}

.api-docs { display: grid; grid-template-columns: 205px 1fr; gap: 22px; text-align: left; }
.api-side { position: sticky; top: 14px; align-self: start; max-height: calc(100vh - 28px); overflow-y: auto; }
.api-side-head { margin-bottom: 10px; }
.api-docs-badge { background: #EFF6FF; color: #2563EB; font-size: 10px; font-weight: 800; letter-spacing: 0.1em; padding: 3px 8px; border-radius: 6px; }
.api-search { width: 100%; border: 1px solid #E2E8F0; border-radius: 999px; padding: 8px 14px; font-size: 13px; outline: none; margin-bottom: 14px; }
.api-search:focus { border-color: #2563EB; }
.api-nav { display: flex; flex-direction: column; gap: 2px; }
.api-nav-group { font-size: 10.5px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: #94A3B8; margin: 12px 0 6px; }
.api-nav-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: 8px; font-size: 13px; color: #475569; cursor: pointer; border-left: 3px solid transparent; }
.api-nav-item:hover { background: #F8FAFC; }
.api-nav-item.active { background: #EFF6FF; color: #1D4ED8; border-left-color: #2563EB; font-weight: 700; }
.api-nav-item .method { font-size: 9px; padding: 2px 5px; }
.api-main { min-width: 0; }
.api-hero { background: linear-gradient(135deg, #0F172A, #1E3A5F); color: #fff; border-radius: 14px; padding: 24px; }
.api-hero-badge { background: rgba(37,99,235,0.35); color: #BFDBFE; font-size: 11px; font-weight: 800; letter-spacing: 0.06em; padding: 4px 10px; border-radius: 999px; }
.api-hero h2 { font-size: 24px; margin: 12px 0 8px; letter-spacing: -0.01em; }
.api-hero p { color: #CBD5E1; font-size: 13.5px; line-height: 1.65; }
.api-stats { display: flex; gap: 0; margin-top: 18px; flex-wrap: wrap; }
.api-stats div { padding: 0 18px; border-left: 1px solid rgba(255,255,255,0.18); display: flex; flex-direction: column; gap: 2px; }
.api-stats div:first-child { padding-left: 0; border-left: 0; }
.api-stats strong { font-size: 20px; color: #93C5FD; }
.api-stats span { font-size: 11px; color: #94A3B8; }
.api-sec { padding: 26px 0 6px; border-bottom: 1px solid #EDF2F7; }
.api-sec[hidden] { display: none; }
.api-eyebrow { color: #2563EB; font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 6px; }
.api-sec h3 { font-size: 20px; color: #0F172A; letter-spacing: -0.01em; margin-bottom: 6px; }
.api-sec-desc { color: #64748B; font-size: 13.5px; line-height: 1.6; margin-bottom: 12px; }
.api-table-wrap { border: 1px solid #E2E8F0; border-radius: 10px; overflow-x: auto; margin-top: 12px; }
.api-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.api-table th { background: #F8FAFC; text-align: left; font-size: 10.5px; letter-spacing: 0.07em; text-transform: uppercase; color: #64748B; padding: 9px 12px; }
.api-table td { padding: 9px 12px; border-top: 1px solid #EDF2F7; color: #475569; vertical-align: top; }
.api-table td code { font-weight: 700; color: #1D4ED8; font-size: 12.5px; }
.api-table td small { display: block; color: #94A3B8; font-size: 11px; margin-top: 2px; }
.pill { font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.pill.req { background: #FEE2E2; color: #B91C1C; }
.pill.opt { background: #F1F5F9; color: #64748B; }
.api-code-card { background: #0F172A; border-radius: 12px; overflow: hidden; margin-top: 12px; }
.api-code-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: #1E293B; padding: 7px 12px; }
.api-code-label { color: #94A3B8; font-size: 10.5px; font-weight: 800; letter-spacing: 0.08em; }
.api-code-tabs { display: flex; gap: 4px; }
.code-tab { background: transparent; border: 0; color: #94A3B8; padding: 4px 11px; border-radius: 999px; cursor: pointer; font-weight: 700; font-size: 12px; }
.code-tab.active { background: #020617; color: #fff; }
.code-copy { background: transparent; border: 1px solid #334155; color: #E2E8F0; border-radius: 6px; padding: 3px 9px; font-size: 10.5px; font-weight: 700; cursor: pointer; }
.code-copy:hover { border-color: #64748B; }
.api-code-card .api-code { background: transparent; border-radius: 0; }
.api-callout { border-radius: 10px; padding: 11px 14px; font-size: 13px; line-height: 1.6; margin-top: 10px; }
.api-callout.warn { background: #FEF9C3; color: #854D0E; }
.api-callout.info { background: #EFF6FF; color: #1E40AF; }
.api-callout.ok { background: #DCFCE7; color: #166534; }
@media (max-width: 720px) {
  .api-docs { grid-template-columns: 1fr; }
  .api-side { position: static; max-height: none; overflow: visible; }
  .api-nav { flex-direction: row; flex-wrap: wrap; }
  .api-nav-group { display: none; }
  .api-nav-item { border: 1px solid #E2E8F0; border-left: 1px solid #E2E8F0; }
  .api-nav-item.active { border-color: #2563EB; }
  .api-stats div { padding: 0 12px; }
}

/* API background effects (API tab only) */
.api-docs {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid #E2E8F0;
  background:
    radial-gradient(520px 260px at 8% -10%, rgba(37, 99, 235, 0.15), transparent 60%),
    radial-gradient(480px 240px at 100% 0%, rgba(20, 184, 166, 0.13), transparent 60%),
    radial-gradient(520px 320px at 55% 115%, rgba(139, 92, 246, 0.09), transparent 60%),
    linear-gradient(180deg, #F8FAFC 0%, #EFF6FF 100%);
}
.api-docs::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, rgba(100, 116, 139, 0.14) 1px, transparent 1.4px);
  background-size: 24px 24px;
  opacity: 0.35;
  -webkit-mask-image: radial-gradient(ellipse 95% 60% at 50% 0%, #000 25%, transparent 75%);
  mask-image: radial-gradient(ellipse 95% 60% at 50% 0%, #000 25%, transparent 75%);
}
.api-docs::after {
  content: "";
  position: absolute;
  inset: -20%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(360px 240px at 20% 24%, rgba(59, 130, 246, 0.18), transparent 65%),
    radial-gradient(340px 230px at 82% 20%, rgba(45, 212, 191, 0.15), transparent 65%),
    radial-gradient(400px 300px at 60% 85%, rgba(167, 139, 250, 0.12), transparent 65%);
  filter: blur(42px);
  opacity: 0.6;
  animation: apiBgFloat 20s ease-in-out infinite alternate;
}
@keyframes apiBgFloat {
  from { transform: translate3d(-1.5%, -1%, 0) scale(1); }
  to { transform: translate3d(1.5%, 1.5%, 0) scale(1.06); }
}
.api-side, .api-main { position: relative; z-index: 1; }
.api-hero { position: relative; overflow: hidden; }
.api-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(340px 200px at 88% -20%, rgba(45, 212, 191, 0.28), transparent 65%),
    radial-gradient(300px 220px at -6% 115%, rgba(59, 130, 246, 0.30), transparent 65%);
}
.api-hero > * { position: relative; z-index: 1; }
.api-side { background: rgba(255, 255, 255, 0.78); border: 1px solid #E2E8F0; border-radius: 12px; padding: 12px; }
@media (max-width: 720px) {
  .api-docs { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .api-docs::after { animation: none; }
}

.btn-emoji { flex-direction: column; gap: 3px; padding: 8px 6px; min-height: 54px; }
.btn-emoji-icon { font-size: 20px; line-height: 1; }
.btn-emoji-label { font-size: 11px; font-weight: 600; color: #475569; }

.btn-custom-icon { width: 30px; height: 30px; border-radius: 9px; display: flex; align-items: center; justify-content: center; color: #fff; box-shadow: 0 4px 10px rgba(15, 23, 42, 0.16); }
.btn-custom-icon.ic-refresh { background: linear-gradient(135deg, #2563EB, #38BDF8); }
.btn-custom-icon.ic-custom { background: linear-gradient(135deg, #7C3AED, #EC4899); }
.btn-custom-icon.ic-history { background: linear-gradient(135deg, #0F766E, #2DD4BF); }

/* Harmonized icon colors + buttons in a row */
.btn-custom-icon.ic-refresh { background: linear-gradient(135deg, #2563EB, #38BDF8); }
.btn-custom-icon.ic-custom { background: linear-gradient(135deg, #4F46E5, #2563EB); }
.btn-custom-icon.ic-history { background: linear-gradient(135deg, #0E7490, #06B6D4); }
@media (max-width: 560px) {
  .actions { grid-template-columns: repeat(3, 1fr); }
  #newBtn { grid-column: 1 / -1; }
}

/* Softer, less striking icon buttons */
.btn-emoji { min-height: 50px; }
.btn-custom-icon { width: 26px; height: 26px; border-radius: 8px; box-shadow: none; border: 1px solid #DBEAFE; }
.btn-custom-icon.ic-refresh { background: #EFF6FF; color: #2563EB; }
.btn-custom-icon.ic-custom { background: #EEF2FF; color: #4F46E5; }
.btn-custom-icon.ic-history { background: #ECFEFF; color: #0E7490; }
.btn-emoji-label { color: #64748B; }
