
  :root {
    --primary: #4f46e5; --primary-dark: #4338ca; --accent: #06b6d4;
    --bg: #f8fafc; --card: #ffffff; --text: #1e293b; --muted: #64748b;
    --border: #e2e8f0; --success: #10b981; --error: #ef4444;
    --radius: 14px; --shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; line-height: 1.5; transition: background 0.3s, color 0.3s; }
  header { background: var(--card); border-bottom: 1px solid var(--border); padding: 14px 24px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 100; overflow: visible; }
  .logo { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 700; cursor: pointer; }
  .logo-icon { width: 34px; height: 34px; background: linear-gradient(135deg, var(--primary), var(--accent)); border-radius: 9px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 18px; }
  .hero { text-align: center; padding: 48px 24px 32px; max-width: 900px; margin: 0 auto; }
  .hero h1 { font-size: 38px; font-weight: 800; margin-bottom: 12px; background: linear-gradient(135deg, var(--primary), var(--accent)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
  .hero p { color: var(--muted); font-size: 16px; max-width: 600px; margin: 0 auto; }
  .tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; max-width: 1280px; margin: 0 auto; padding: 0 24px 60px; }
  .tool-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 16px; text-align: center; cursor: pointer; transition: all 0.2s; box-shadow: var(--shadow); }
  .tool-card:hover { transform: translateY(-4px); border-color: var(--primary); box-shadow: 0 12px 28px rgba(79, 70, 229, 0.15); }
  .tool-icon { font-size: 32px; margin-bottom: 10px; display: block; }
  .tool-card h3 { font-size: 15px; font-weight: 600; }
  .modal-overlay { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(4px); z-index: 1000; align-items: center; justify-content: center; padding: 20px; }
  .modal-overlay.active { display: flex; overscroll-behavior: contain; }
  .modal { background: var(--card); border-radius: 18px; width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; padding: 28px; position: relative; animation: pop 0.2s ease; }
  @keyframes pop { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
  .modal-close { position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; border: none; background: var(--bg); border-radius: 50%; cursor: pointer; font-size: 18px; color: var(--muted); }
  .modal-close:hover { background: var(--border); }
  .modal h2 { font-size: 22px; margin-bottom: 6px; padding-right: 40px; }
  .modal .desc { color: var(--muted); font-size: 14px; margin-bottom: 20px; }
  .drop-zone { border: 2px dashed var(--border); border-radius: 12px; padding: 32px 16px; text-align: center; color: var(--muted); cursor: pointer; transition: all 0.2s; margin-bottom: 16px; }
  .drop-zone:hover, .drop-zone.dragover { border-color: var(--primary); background: #f0f0ff; color: var(--primary); }
  .drop-zone input { display: none; }
  .drop-zone .big { font-size: 36px; display: block; margin-bottom: 8px; }
  .file-list { list-style: none; margin-bottom: 16px; max-height: 300px; overflow-y: auto; }
  .file-list li { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: var(--bg); border-radius: 8px; margin-bottom: 8px; font-size: 14px; }
  .file-list li.draggable { cursor: grab; }
  .file-list li.dragging { opacity: 0.4; background: #eef2ff; border: 2px dashed var(--primary); }
  .file-list li.drag-over-top { border-top: 3px solid var(--primary); }
  .file-list li.drag-over-bottom { border-bottom: 3px solid var(--primary); }
  .file-list .drag-handle { margin-right: 10px; color: var(--muted); font-size: 18px; }
  .file-list .file-index { display: inline-block; min-width: 22px; font-weight: 700; color: var(--primary); margin-right: 6px; }
  .file-list .remove { background: none; border: none; color: var(--error); font-size: 20px; cursor: pointer; padding: 0 8px; font-weight: bold; }
  .btn { width: 100%; padding: 14px; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; border: none; border-radius: 10px; font-size: 16px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
  .btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(79, 70, 229, 0.35); }
  .btn:disabled { opacity: 0.5; cursor: not-allowed; }
  .status-msg { margin-top: 14px; font-size: 14px; text-align: center; padding: 10px; border-radius: 8px; }
  .status-msg.ok { color: var(--success); background: #ecfdf5; }
  .status-msg.err { color: var(--error); background: #fef2f2; }
  .status-msg.info { color: var(--primary); background: #eef2ff; }
  .hidden { display: none !important; }
  .options { margin-bottom: 16px; }
  .options label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
  .options input[type="text"], .options input[type="number"], .options select { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; margin-bottom: 12px; font-family: inherit; background: var(--card); color: var(--text); }
  .options input:focus, .options select:focus { outline: none; border-color: var(--primary); }
  footer { text-align: center; padding: 24px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--border); }
  .header-right { display: flex; flex-direction: row; align-items: center; gap: 10px; overflow: visible; }
  .lv-clock { display: flex; flex-direction: column; align-items: flex-end; padding: 4px 12px; background: var(--bg); border-radius: 8px; line-height: 1.1; min-width: 100px; }
  .clock-city { font-size: 10px; color: var(--muted); font-weight: 600; letter-spacing: 0.5px; }
  .clock-time { font-size: 15px; font-weight: 700; color: var(--primary); font-variant-numeric: tabular-nums; font-family: 'SF Mono', Consolas, Monaco, monospace; }
  .icon-btn { width: 38px; height: 38px; border: none; background: var(--bg); border-radius: 9px; cursor: pointer; font-size: 18px; display: flex; align-items: center; justify-content: center; transition: all 0.15s; color: var(--text); }
  .icon-btn:hover { background: var(--primary); color: #fff; transform: scale(1.05); }
  .icon-btn.ringing { background: var(--error); animation: pulse 1s infinite; }
  @keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.15); } }
  .donate-btn { display: flex; align-items: center; gap: 8px; padding: 10px 18px; background: linear-gradient(135deg, #f59e0b, #ef4444); color: #fff; border: none; border-radius: 10px; cursor: pointer; font-weight: 700; font-size: 14px; font-family: inherit; }
  .lang-dropdown { position: relative; }
  .lang-btn { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border: none; background: var(--bg); border-radius: 9px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--text); font-family: inherit; }
  .lang-btn:hover { background: var(--primary); color: #fff; }
  .lang-menu { position: absolute; top: calc(100% + 6px); right: 0; background: var(--card); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.15); min-width: 180px; padding: 6px; display: none; z-index: 500; }
  .lang-dropdown.open .lang-menu { display: block; }
  .lang-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: none; background: transparent; border-radius: 7px; cursor: pointer; font-size: 14px; color: var(--text); text-align: left; font-family: inherit; }
  .lang-menu button:hover { background: var(--bg); }
  .lang-menu button.active { background: var(--primary); color: #fff; }
  .why-section { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; max-width: 1100px; margin: 0 auto 40px; padding: 0 24px; }
  .why-item { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 18px; text-align: center; }
  .why-icon { font-size: 32px; margin-bottom: 8px; display: inline-block; }
  .why-item h3 { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
  .why-item p { font-size: 13px; color: var(--muted); line-height: 1.5; }
  .editor-wrapper { max-width: 95vw !important; width: 100%; }
  .editor-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px; background: var(--bg); border-radius: 10px; margin-bottom: 12px; }
  .tool-btn { width: 40px; height: 40px; border: 2px solid var(--border); background: var(--card); border-radius: 8px; cursor: pointer; font-size: 18px; display: flex; align-items: center; justify-content: center; color: var(--text); position: relative; }
  .tool-btn:hover { border-color: var(--primary); }
  .tool-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
  .tool-divider { width: 1px; height: 28px; background: var(--border); margin: 0 4px; }
  .zoom-controls { display: inline-flex; align-items: center; gap: 4px; background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 2px; margin-left: auto; }
  .zoom-btn { width: 30px; height: 30px; border: none; background: transparent; border-radius: 6px; cursor: pointer; font-size: 16px; font-weight: 700; color: var(--text); display: flex; align-items: center; justify-content: center; font-family: inherit; }
  .zoom-btn:hover { background: var(--primary); color: #fff; }
  .zoom-level { font-size: 12px; font-weight: 700; color: var(--muted); min-width: 44px; text-align: center; font-family: 'SF Mono', Consolas, monospace; }
  .line-width-picker { display: flex; gap: 3px; align-items: center; background: var(--bg); border-radius: 8px; padding: 4px; }
  .line-width-btn { width: 26px; height: 26px; border: none; background: transparent; border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; position: relative; }
  .line-width-btn:hover { background: var(--border); }
  .line-width-btn.active { background: var(--primary); }
  .line-width-btn .lw-dot { display: block; background: var(--text); border-radius: 50%; }
  .line-width-btn.active .lw-dot { background: #fff; }
  .line-width-btn[data-lw="2"] .lw-dot { width: 4px; height: 4px; }
  .line-width-btn[data-lw="4"] .lw-dot { width: 8px; height: 8px; }
  .line-width-btn[data-lw="8"] .lw-dot { width: 12px; height: 12px; }
  .line-width-btn[data-lw="14"] .lw-dot { width: 18px; height: 18px; }
  .color-swatch { width: 28px; height: 28px; border-radius: 50%; cursor: pointer; border: 3px solid transparent; position: relative; }
  .color-swatch.active { border-color: var(--text); }
  .editor-canvas-wrap { position: relative; background: #525659; border-radius: 10px; overflow: hidden; max-height: 65vh; }
  .editor-canvas-scroll { width: 100%; max-height: 65vh; overflow: auto; cursor: grab; position: relative; display: flex; align-items: flex-start; justify-content: center; padding: 20px; overscroll-behavior: contain; }
  .editor-canvas-scroll.panning { cursor: grabbing; }
  .editor-canvas-inner { display: inline-block; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
  #editorCanvas, #textEditorCanvas { background: #fff; display: block; cursor: crosshair; height: auto; touch-action: none; }
  .editor-pages { display: flex; gap: 8px; justify-content: center; margin-top: 12px; align-items: center; }
  .page-nav-btn { padding: 8px 16px; border: 1px solid var(--border); background: var(--card); border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--text); }
  .page-nav-btn:hover { border-color: var(--primary); color: var(--primary); }
  .page-nav-btn:disabled { opacity: 0.4; cursor: not-allowed; }
  .page-counter { color: var(--muted); font-size: 14px; font-weight: 600; padding: 0 12px; }
  .inline-text-input { position: absolute; background: rgba(255,255,255,0.95); border: 2px dashed var(--primary); border-radius: 4px; padding: 4px 8px; font-size: 16px; color: #000; outline: none; min-width: 80px; z-index: 10000; font-family: inherit; box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
  .te-mode-group { display: flex; gap: 4px; background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 3px; }
  .te-mode-btn { width: 34px; height: 34px; border: none; background: transparent; border-radius: 6px; cursor: pointer; font-size: 17px; display: flex; align-items: center; justify-content: center; font-family: inherit; position: relative; }
  .te-mode-btn:hover { background: var(--bg); }
  .te-mode-btn.active { background: var(--primary); }
  .text-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px; background: var(--bg); border-radius: 10px; margin-bottom: 12px; }
  .text-toolbar label { font-size: 12px; font-weight: 600; color: var(--muted); margin-right: 4px; }
  .text-toolbar select, .text-toolbar input[type="number"] { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; background: var(--card); color: var(--text); font-family: inherit; }
  .text-toolbar input[type="number"] { width: 60px; }
  .toolbar-divider { width: 1px; height: 24px; background: var(--border); margin: 0 4px; }
  body.dark { --bg: #0f172a; --card: #1e293b; --text: #f1f5f9; --muted: #94a3b8; --border: #334155; --shadow: 0 4px 20px rgba(0, 0, 0, 0.4); }
  body.dark .tool-card:hover { box-shadow: 0 12px 28px rgba(79, 70, 229, 0.3); }
  body.dark .drop-zone:hover, body.dark .drop-zone.dragover { background: #1e1b4b; }
  body.dark .file-list li { background: #0f172a; }
  body.dark .lv-clock, body.dark .icon-btn, body.dark .lang-btn { background: #0f172a; }
  body.dark .inline-text-input { background: #1e293b; color: #fff; border-color: var(--primary); }
  @media (max-width: 700px) {
    .hero h1 { font-size: 26px; }
    .tools-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 0 14px 40px; }
    .tool-card { padding: 16px 10px; }
    .tool-icon { font-size: 26px; }
    .tool-card h3 { font-size: 13px; }
    header { padding: 12px 16px; }
    .editor-canvas-scroll { max-height: 55vh; padding: 10px; }
    .editor-canvas-wrap { max-height: 55vh; }
  }
  .cookie-banner { position: fixed; bottom: 0; left: 0; right: 0; background: var(--card); border-top: 1px solid var(--border); padding: 16px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; z-index: 9999; box-shadow: 0 -4px 20px rgba(0,0,0,0.1); flex-wrap: wrap; }
  .cookie-banner.hidden { display: none; }
  .cookie-text { font-size: 13px; color: var(--text); flex: 1; min-width: 200px; }
  .cookie-buttons { display: flex; gap: 8px; }
  .cookie-btn { padding: 8px 18px; border-radius: 8px; border: none; font-weight: 600; font-size: 13px; cursor: pointer; font-family: inherit; }
  .cookie-accept { background: var(--primary); color: #fff; }
  .cookie-decline { background: transparent; color: var(--muted); border: 1px solid var(--border); }
  .footer-buttons { display: flex; justify-content: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
  .footer-btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px; background: transparent; color: var(--primary); border: 2px solid var(--primary); border-radius: 10px; font-weight: 600; font-size: 13px; font-family: inherit; cursor: pointer; text-decoration: none; }
  .footer-btn:hover { background: var(--primary); color: #fff; }
  .footer-btn.contact-btn { color: #10b981; border-color: #10b981; }
  .footer-btn.contact-btn:hover { background: #10b981; color: #fff; }
  .footer-btn.mirror-btn-footer { color: #10b981; border-color: #10b981; }
  .footer-btn.mirror-btn-footer:hover { background: #10b981; color: #fff; }
  .about-modal, .contact-modal { max-width: 600px !important; }
  .about-content { display: flex; flex-direction: column; gap: 14px; margin: 20px 0 24px; }
  .about-block { display: flex; gap: 14px; padding: 14px 16px; background: var(--bg); border-radius: 12px; border-left: 3px solid var(--primary); }
  .about-icon { font-size: 26px; flex-shrink: 0; line-height: 1.2; }
  .about-block strong { display: block; font-size: 15px; font-weight: 700; margin-bottom: 4px; }
  .about-block p { font-size: 13px; color: var(--muted); line-height: 1.5; margin: 0; }
  .contact-content { display: flex; flex-direction: column; gap: 16px; margin: 20px 0 24px; }
  .contact-block { display: flex; align-items: center; gap: 16px; padding: 18px 20px; background: var(--bg); border-radius: 12px; text-decoration: none; color: var(--text); }
  .contact-icon { font-size: 32px; flex-shrink: 0; width: 50px; height: 50px; display: flex; align-items: center; justify-content: center; background: var(--card); border-radius: 12px; }
  .contact-info strong { display: block; font-size: 15px; font-weight: 700; margin-bottom: 3px; }
  .contact-info span { font-size: 13px; color: var(--muted); word-break: break-all; }
  .contact-note { text-align: center; font-size: 13px; color: var(--muted); line-height: 1.5; padding: 12px; background: var(--bg); border-radius: 10px; }
  .timer-display { font-size: 48px; font-weight: 800; text-align: center; color: var(--primary); font-variant-numeric: tabular-nums; font-family: 'SF Mono', Consolas, Monaco, monospace; padding: 20px 0; margin-bottom: 16px; letter-spacing: 2px; background: var(--bg); border-radius: 12px; }
  .btn-secondary { background: #fff; color: var(--error); border: 2px solid var(--error); }
  .time-24 { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
  .time-24 input { width: 80px !important; padding: 10px 12px !important; border: 1px solid var(--border) !important; border-radius: 8px !important; font-size: 18px !important; text-align: center; font-family: 'SF Mono', Consolas, Monaco, monospace; font-weight: 700; color: var(--primary); margin-bottom: 0 !important; background: var(--card); }
  .time-24 span { font-size: 22px; font-weight: 700; color: var(--muted); }
  .alarm-list { list-style: none; margin-top: 16px; max-height: 220px; overflow-y: auto; }
  .alarm-list li { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: var(--bg); border-radius: 8px; margin-bottom: 8px; font-size: 14px; }
  .alarm-list li.active { background: #eef2ff; border-left: 3px solid var(--primary); }
  .alarm-list .alarm-time { font-weight: 700; color: var(--primary); font-family: 'SF Mono', Consolas, monospace; }
  .alarm-list .alarm-del { background: none; border: none; color: var(--error); font-size: 18px; cursor: pointer; padding: 0 6px; }
  .page-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); gap: 8px; margin-bottom: 16px; max-height: 340px; overflow-y: auto; padding: 4px; }
  .page-item { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 12px 6px; border: 2px solid var(--border); border-radius: 10px; background: var(--card); cursor: pointer; user-select: none; position: relative; }
  .page-item:hover { border-color: var(--primary); }
  .page-item.selected { background: var(--error); border-color: var(--error); color: #fff; }
  .page-num { font-weight: 700; font-size: 14px; color: var(--primary); }
  .page-item.selected .page-num { color: #fff; text-decoration: line-through; }
  .page-hint { color: var(--muted); font-size: 13px; text-align: center; margin-bottom: 12px; }
  .save-choice-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
  .save-choice-item { display: flex; align-items: center; gap: 14px; padding: 16px 18px; background: var(--card); border: 2px solid var(--border); border-radius: 12px; cursor: pointer; text-align: left; width: 100%; font-family: inherit; color: var(--text); }
  .save-choice-item:hover { border-color: var(--primary); }
  .save-choice-icon { font-size: 24px; }
  .save-choice-text strong { font-size: 15px; font-weight: 700; display: block; }
  .save-choice-text small { font-size: 12px; color: var(--muted); }
  .donate-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
  .donate-item { display: flex; align-items: center; gap: 14px; padding: 16px 18px; background: var(--card); border: 2px solid var(--border); border-radius: 12px; cursor: pointer; text-decoration: none; color: var(--text); }
  .donate-item:hover { border-color: var(--primary); }
  .donate-icon { font-size: 26px; }
  .donate-text strong { font-size: 15px; font-weight: 700; display: block; }
  .donate-text small { font-size: 12px; color: var(--muted); }
  .donate-thanks { text-align: center; font-size: 13px; color: var(--muted); margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
  .qr-section { text-align: center; margin-bottom: 20px; padding: 16px; background: var(--bg); border-radius: 14px; border: 2px dashed var(--border); }
  .qr-label { font-size: 13px; font-weight: 700; margin-bottom: 12px; }
  .qr-wrapper { display: inline-block; padding: 12px; background: #fff; border-radius: 12px; box-shadow: 0 4px 14px rgba(0,0,0,0.08); }
  #qrContainer { display: flex; align-items: center; justify-content: center; width: 200px; height: 200px; }
  #qrContainer img, #qrContainer canvas { width: 200px !important; height: 200px !important; }
  .sig-tabs { display: flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: 10px; margin-bottom: 16px; }
  .sig-tab { flex: 1; padding: 10px 12px; border: none; background: transparent; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--muted); font-family: inherit; }
  .sig-tab.active { background: var(--card); color: var(--primary); }
  .sig-tab-content { display: none; }
  .sig-tab-content.active { display: block; }
  .sig-pad-wrap { background: var(--bg); border: 2px dashed var(--border); border-radius: 12px; padding: 8px; margin-bottom: 14px; text-align: center; }
  #sigCanvas { background: #fff; border-radius: 8px; cursor: crosshair; touch-action: none; max-width: 100%; display: block; margin: 0 auto; }
  .sig-tools { display: flex; gap: 8px; justify-content: center; margin-bottom: 14px; }
  .sig-color { width: 30px; height: 30px; border-radius: 50%; cursor: pointer; border: 3px solid transparent; }
  .sig-color.active { border-color: var(--text); }
  .sig-preview-wrap { background: var(--bg); border: 2px dashed var(--border); border-radius: 12px; padding: 16px; min-height: 120px; display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
  #sigPreview { font-size: 48px; color: #1e293b; text-align: center; min-height: 60px; display: flex; align-items: center; justify-content: center; }
  #sigFilePreview { max-width: 100%; max-height: 150px; border-radius: 8px; }
  .sig-font-picker { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 14px; }
  .sig-font-btn { padding: 12px; border: 2px solid var(--border); background: var(--card); border-radius: 10px; cursor: pointer; font-size: 20px; color: var(--text); font-family: inherit; }
  .sig-font-btn.active { border-color: var(--primary); background: #eef2ff; color: var(--primary); }
  .stamp-preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-bottom: 16px; }
  .stamp-preset { padding: 14px 8px; border: 3px solid; border-radius: 10px; background: transparent; cursor: pointer; font-weight: 900; font-size: 14px; text-align: center; letter-spacing: 1px; font-family: 'Arial Black', Arial, sans-serif; transform: rotate(-3deg); }
  .stamp-preset.active { box-shadow: 0 0 0 3px var(--primary); }
  .footer-copy { display: inline-block; margin-top: 8px; font-weight: 600; color: var(--primary); font-size: 12px; letter-spacing: 0.5px; }
  .ad-slot { display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; border-radius: 9px; font-size: 12px; font-weight: 600; text-decoration: none; white-space: nowrap; cursor: pointer; position: relative; }
  .mirror-btn { display: flex; align-items: center; gap: 6px; padding: 8px 14px; background: linear-gradient(135deg, #10b981, #059669); color: #fff; border-radius: 9px; font-size: 12px; font-weight: 700; text-decoration: none; white-space: nowrap; cursor: pointer; transition: all 0.15s; position: relative; }
  .mirror-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(16,185,129,0.35); }
  .proxy-banner { display: none; position: sticky; top: 0; z-index: 200; background: linear-gradient(135deg, #f59e0b, #ef4444); color: #fff; padding: 14px 24px; text-align: center; font-size: 14px; line-height: 1.5; box-shadow: 0 4px 16px rgba(0,0,0,0.15); }
  .proxy-banner.show { display: block; }
  .proxy-banner strong { display: block; margin-bottom: 4px; font-size: 15px; }
  .proxy-banner a { color: #fff; font-weight: 700; text-decoration: underline; }
  .proxy-banner .close { position: absolute; top: 8px; right: 12px; background: rgba(255,255,255,0.2); border: none; color: #fff; width: 26px; height: 26px; border-radius: 50%; cursor: pointer; font-size: 14px; line-height: 1; }
  .proxy-banner .close:hover { background: rgba(255,255,255,0.35); }
  .ed-selection-box { position: absolute; border: 2px dashed var(--primary); background: rgba(79, 70, 229, 0.08); pointer-events: none; z-index: 999; border-radius: 4px; }
  .ed-selection-handle { position: absolute; width: 12px; height: 12px; background: var(--primary); border: 2px solid #fff; border-radius: 50%; pointer-events: auto; z-index: 1000; }
  .ed-selection-handle.rot { cursor: grab; width: 16px; height: 16px; background: #f59e0b; }
  .ed-selection-handle.rot::after { content: '↻'; position: absolute; top: -22px; left: 50%; transform: translateX(-50%); font-size: 14px; color: #f59e0b; }
  .ed-rotate-line { position: absolute; width: 2px; background: #f59e0b; pointer-events: none; z-index: 998; }
  .recent-card { position: relative; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 12px; cursor: pointer; transition: all 0.2s; box-shadow: var(--shadow); text-align: left; }
  .recent-card:hover { transform: translateY(-3px); border-color: var(--primary); }
  .recent-card .rc-del { position: absolute; top: 8px; right: 10px; background: none; border: none; color: var(--error); font-size: 18px; cursor: pointer; }
  .te-format-panel { display: none; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 12px; background: linear-gradient(135deg, #eef2ff, #e0e7ff); border-radius: 10px; margin-bottom: 12px; border: 1px solid var(--primary); }
  .te-format-panel.active { display: flex; }
  .te-format-panel label { font-size: 12px; font-weight: 600; color: var(--primary); }
  .te-format-panel select, .te-format-panel input[type="number"] { padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; background: var(--card); color: var(--text); font-family: inherit; }
  .te-format-panel input[type="number"] { width: 60px; }
  .te-format-btn { padding: 6px 10px; border: 1px solid var(--border); background: var(--card); border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 700; color: var(--text); font-family: inherit; position: relative; }
  .te-format-btn:hover { border-color: var(--primary); color: var(--primary); }
  .te-format-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
  .help-item { display: flex; gap: 14px; padding: 14px 16px; background: var(--bg); border-radius: 12px; border-left: 3px solid var(--primary); transition: all 0.15s; }
  .help-item:hover { border-left-color: var(--accent); transform: translateX(3px); }
  .help-item .help-icon { font-size: 26px; flex-shrink: 0; line-height: 1.2; }
  .help-item .help-text strong { display: block; font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
  .help-item .help-text p { font-size: 13px; color: var(--muted); line-height: 1.5; margin: 0; }
  .help-group-title { font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--primary); margin: 12px 0 4px 4px; }
  /* ====== TOOLTIPS ====== */
  [data-tooltip] { position: relative; overflow: visible; }
  [data-tooltip]::before,
  [data-tooltip]::after {
    position: absolute;
    z-index: 2147483647;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s, transform 0.15s;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    white-space: nowrap;
  }
  [data-tooltip]::after {
    content: attr(data-tooltip);
    bottom: -34px;
    left: 50%;
    transform: translate(-50%, 4px) scale(0.95);
    background: #1e293b;
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
    letter-spacing: 0.2px;
    max-width: none;
  }
  [data-tooltip]::before {
    content: '';
    bottom: -8px;
    left: 50%;
    transform: translate(-50%, 4px);
    border: 5px solid transparent;
    border-bottom-color: #1e293b;
    width: 0;
    height: 0;
  }
  [data-tooltip]:hover::after { opacity: 1; transform: translate(-50%, 0) scale(1); }
  [data-tooltip]:hover::before { opacity: 1; transform: translate(-50%, 0); }
  [data-tooltip-pos="top"]::after { bottom: auto; top: -34px; transform: translate(-50%, -4px) scale(0.95); }
  [data-tooltip-pos="top"]:hover::after { transform: translate(-50%, 0) scale(1); }
  [data-tooltip-pos="top"]::before { bottom: auto; top: -8px; transform: translate(-50%, -4px); border-bottom-color: transparent; border-top-color: #1e293b; }
  [data-tooltip-pos="top"]:hover::before { transform: translate(-50%, 0); }
  [data-tooltip-pos="right"]::after { bottom: auto; top: 50%; left: calc(100% + 10px); transform: translate(-4px, -50%) scale(0.95); }
  [data-tooltip-pos="right"]:hover::after { transform: translate(0, -50%) scale(1); }
  [data-tooltip-pos="right"]::before { bottom: auto; top: 50%; left: calc(100% + 4px); transform: translate(-4px, -50%); border-bottom-color: transparent; border-right-color: #1e293b; }
  [data-tooltip-pos="right"]:hover::before { transform: translate(0, -50%); }
  [data-tooltip-pos="left"]::after { bottom: auto; top: 50%; right: calc(100% + 10px); left: auto; transform: translate(4px, -50%) scale(0.95); }
  [data-tooltip-pos="left"]:hover::after { transform: translate(0, -50%) scale(1); }
  [data-tooltip-pos="left"]::before { bottom: auto; top: 50%; right: calc(100% + 4px); left: auto; transform: translate(4px, -50%); border-bottom-color: transparent; border-left-color: #1e293b; }
  [data-tooltip-pos="left"]:hover::before { transform: translate(0, -50%); }



/* marge-PDF interface upgrade */
:root { --primary:#6554e8; --primary-dark:#5141c9; --accent:#089db3; --bg:#f5f6fb; --radius:18px; --shadow:0 6px 24px rgba(32,35,80,.045); }
body { font-family:Inter,system-ui,-apple-system,"Segoe UI",sans-serif; }
header { padding:16px max(20px,calc((100vw - 1240px)/2)); gap:18px; flex-wrap:wrap; }
.header-right { flex-wrap:wrap; gap:8px; }
header .ad-slot { display:none; } header .mirror-btn,header .lv-clock { display:flex; }
.logo { letter-spacing:-.6px; }
.hero { max-width:1000px; padding:64px 24px 28px; }
.hero h1 { font-size:clamp(30px,5vw,54px); line-height:1.12; letter-spacing:-1.8px; }
.hero p { margin-top:18px; line-height:1.7; }
.why-section { max-width:1240px; gap:12px; margin-bottom:28px; }
.why-item { padding:16px; text-align:left; border-radius:14px; }
.why-icon { font-size:22px; margin-bottom:5px; }
.why-item p { margin-top:5px; }
.tools-grid { max-width:1240px; grid-template-columns:repeat(4,minmax(0,1fr)); gap:16px; padding-bottom:36px; }
.tool-card { position:relative; text-align:left; padding:24px; min-height:176px; box-shadow:var(--shadow); }
.tool-card:hover { transform:translateY(-3px); }
.tool-icon { display:flex; align-items:center; justify-content:center; width:48px; height:48px; font-size:25px; background:var(--bg); border-radius:14px; margin-bottom:16px; }
.tool-card h3 { padding-right:20px; font-size:16px; }
.v2-description { color:var(--muted); font-size:13px; margin-top:8px; line-height:1.6; }
.v2-star { position:absolute; right:12px; top:12px; border:0; border-radius:8px; background:transparent; color:var(--muted); font-size:23px; cursor:pointer; padding:4px 8px; }
.v2-star[aria-pressed="true"] { color:#a86a00; background:#fff4d6; }
.v2-controls { max-width:1240px; padding:0 24px; margin:0 auto 20px; }
.v2-search { width:100%; padding:16px 18px; border:1px solid var(--border); border-radius:14px; background:var(--card); color:var(--text); font:inherit; }
.v2-tabs { display:flex; flex-wrap:wrap; gap:8px; margin-top:14px; }
.v2-tabs button { padding:10px 15px; border:1px solid var(--border); border-radius:100px; color:var(--muted); background:var(--card); font:inherit; font-size:13px; cursor:pointer; }
.v2-tabs button[aria-pressed="true"] { background:var(--primary); color:white; border-color:var(--primary); }
.v2-summary { display:flex; align-items:center; justify-content:space-between; gap:12px; margin:18px 0 0; color:var(--muted); font-size:13px; }
.v2-summary button { border:0; background:transparent; color:var(--primary); cursor:pointer; font:inherit; }
.v2-empty { grid-column:1/-1; padding:36px; text-align:center; color:var(--muted); }
.v2-notice { max-width:1192px; margin:16px auto; padding:14px 18px; border:1px solid #e9bc65; border-radius:12px; background:#fff8e8; color:#674711; font-size:14px; }
.v2-quick { display:flex; justify-content:center; gap:10px; flex-wrap:wrap; margin-top:24px; }
.v2-quick button { padding:13px 20px; border:1px solid var(--border); border-radius:12px; background:var(--card); color:var(--text); font:inherit; font-weight:600; cursor:pointer; }
.v2-quick button:first-child { background:var(--primary); border-color:var(--primary); color:white; }
.v2-diagnostics { max-width:1192px; margin:0 auto 30px; padding:16px; border:1px solid var(--border); border-radius:14px; background:var(--card); font-size:13px; }
.v2-diagnostics summary { cursor:pointer; font-weight:600; }
.v2-diagnostics ul { margin:14px 0 0 20px; color:var(--muted); line-height:1.9; }
:focus-visible { outline:3px solid var(--accent); outline-offset:4px; }
body.dark { --bg:#101321; --card:#1b2033; --border:#30374f; --text:#f1f3ff; --muted:#a7b0c8; }
body.dark .v2-star[aria-pressed="true"] { background:#45351d; color:#ffd57c; }
.modal { border:1px solid var(--border); box-shadow:0 24px 100px rgba(0,0,0,.25); }
footer { padding:32px 24px; }
@media(max-width:1000px) { .tools-grid { grid-template-columns:repeat(3,minmax(0,1fr)); } }
@media(max-width:720px) { .tools-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; padding:0 14px 30px; } .tool-card { padding:18px 14px; } .hero { padding-top:36px; } .v2-controls { padding:0 14px; } header { position:relative; } .why-section { grid-template-columns:repeat(2,minmax(0,1fr)); padding:0 14px; } }
@media(max-width:380px) { .tools-grid { grid-template-columns:1fr; } }
@media(prefers-reduced-motion:reduce) { *,*::before,*::after { animation:none!important; transition:none!important; scroll-behavior:auto!important; } }



#toolsGrid.tools-grid {grid-template-columns:repeat(6,minmax(0,1fr));gap:12px;}
#toolsGrid .tool-card {min-width:0;padding:18px 12px;}
#toolsGrid .tool-card h3,#toolsGrid .v2-description {overflow-wrap:anywhere;}
@media(max-width:1024px) and (orientation:portrait){
#toolsGrid.tools-grid {grid-template-columns:repeat(4,minmax(0,1fr));gap:7px;padding-left:8px;padding-right:8px;}
#toolsGrid .tool-card {padding:28px 6px 12px;min-height:132px;}
#toolsGrid .tool-card h3 {font-size:11px;line-height:1.35;padding-right:0;}
#toolsGrid .tool-icon {width:34px;height:34px;font-size:21px;margin-bottom:9px;}
#toolsGrid .v2-description {display:none;}
#toolsGrid .v2-star {top:2px;right:2px;font-size:20px;padding:2px 6px;}
}
@media(max-width:1200px) and (orientation:landscape){
#toolsGrid.tools-grid {grid-template-columns:repeat(6,minmax(0,1fr));gap:8px;padding-left:10px;padding-right:10px;}
#toolsGrid .tool-card {padding:27px 8px 12px;min-height:132px;}
#toolsGrid .tool-card h3 {font-size:12px;line-height:1.35;padding-right:0;}
#toolsGrid .tool-icon {width:36px;height:36px;font-size:22px;margin-bottom:10px;}
#toolsGrid .v2-description {display:none;}
#toolsGrid .v2-star {top:2px;right:2px;font-size:20px;padding:2px 6px;}
}


.support-goal {padding:16px;border:1px solid var(--border);border-radius:12px;background:var(--bg);margin:16px 0;}
.support-goal p {color:var(--muted);font-size:14px;line-height:1.6;margin-top:8px;}
.support-result {position:fixed;bottom:18px;right:18px;z-index:10020;width:min(420px,calc(100vw - 28px));padding:20px;background:var(--card);color:var(--text);border:1px solid var(--primary);border-radius:16px;box-shadow:0 12px 45px rgba(0,0,0,.22);}
.support-result[hidden] {display:none!important;}
.support-result h2 {font-size:18px;margin-bottom:8px;}
.support-result p {font-size:14px;color:var(--muted);line-height:1.6;}
.support-result-actions {display:flex;gap:10px;flex-wrap:wrap;margin-top:16px;}
.support-result-actions button {padding:10px 14px;border-radius:9px;border:1px solid var(--border);background:var(--bg);color:var(--text);font:inherit;cursor:pointer;}
.support-result-actions button:first-child {background:var(--primary);color:white;border-color:var(--primary);}
@media(max-width:700px){header .donate-btn {padding:9px 11px;font-size:12px;} .support-result {bottom:12px;right:14px;padding:16px;}}

header .lv-clock {justify-content:center;align-items:center;min-width:96px;min-height:38px;}

.ux-box {max-width:1192px;margin:18px auto;padding:20px;border:1px solid var(--border);border-radius:16px;background:var(--card);color:var(--text);}
.ux-actions {display:flex;gap:8px;flex-wrap:wrap;margin:12px 0;align-items:center;}
.ux-button {padding:10px 14px;border:1px solid var(--border);border-radius:9px;background:var(--bg);color:var(--text);font:inherit;font-size:13px;cursor:pointer;}
.ux-button:disabled {opacity:.5;cursor:not-allowed;}
.ux-note {color:var(--muted);font-size:13px;line-height:1.6;margin:8px 0;}
.ux-preview-grid {display:grid;grid-template-columns:repeat(auto-fill,minmax(115px,1fr));gap:12px;}
.ux-page {border:1px solid var(--border);border-radius:10px;padding:8px;min-width:0;}
.ux-page canvas {width:100%;height:auto;display:block;background:white;}
.ux-page label {display:block;font-size:13px;margin:8px 0;}
.ux-page .ux-button {padding:5px 9px;}
#uxPreview .modal {max-width:900px;}
#uxProgress progress {width:100%;margin-top:10px;}
#uxProgress {border:1px solid var(--border);border-radius:10px;padding:12px;margin:12px 0;}
#uxFeedback textarea {width:100%;min-height:140px;padding:12px;border:1px solid var(--border);border-radius:10px;background:var(--bg);color:var(--text);font:inherit;}
#uxFeedback select {max-width:100%;padding:10px;background:var(--bg);color:var(--text);border:1px solid var(--border);border-radius:8px;}
#uxResult[hidden],#uxPreview[hidden],#uxFeedback[hidden] {display:none!important;}
@media(max-width:700px){.ux-box{margin:14px;padding:16px;}}

/* Direct typing belongs to the white PDF page, never to the dark UI theme. */
.page-direct-text,body.dark .page-direct-text {
 position:absolute;display:inline-block;z-index:20;min-width:2px;
 background:transparent!important;border:0!important;border-radius:0!important;
 box-shadow:none!important;outline:none!important;padding:0!important;margin:0!important;
 white-space:pre;line-height:normal;letter-spacing:normal;text-indent:0;
 text-align:left;cursor:text;-webkit-text-fill-color:currentColor;
}
.page-direct-text::selection {background:rgba(70,130,240,.25);}
