@import url('https://fonts.googleapis.com/css2?family=Rubik:wght@400;500;600;700&display=swap');

:root {
  color-scheme: light;
  --bg: #ffffff;
  --text: #202124;
  --muted: #70757a;
  --line: #e1e4e8;
  --surface: #f8f9fa;
  --card: #ffffff;
  --blue: #4285f4;
  --telegram: #229ed9;
  --focus: #8ab4f8;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 "Rubik", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
body.dark {
  color-scheme: dark;
  --bg: #202124;
  --text: #e8eaed;
  --muted: #a0a4aa;
  --line: #4a4c50;
  --surface: #303134;
  --card: #202124;
  --blue: #8ab4f8;
  --focus: #8ab4f8;
}
button, input, a { -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #4285f466; outline-offset: 3px; }
a { color: inherit; text-decoration: none; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.topbar { height: 64px; padding: 0 28px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.add-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
}
.add-button:hover {
  background: var(--line);
  color: var(--blue);
}
.add-button svg { width: 16px; height: 16px; stroke-width: 2.2; }

/* 9-Dots Apps Drawer */
.apps-drawer {
  position: fixed;
  top: 70px;
  right: 24px;
  width: min(360px, calc(100vw - 32px));
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22);
  z-index: 1000;
  padding: 18px;
  animation: drawerFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.drawer-title { font-size: 16px; font-weight: 600; }
.apps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.app-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 4px;
  border-radius: 16px;
  border: 1px solid transparent;
  background: var(--surface);
  cursor: pointer;
  transition: all 0.18s ease;
}
.app-tile:hover {
  background: var(--line);
  transform: translateY(-2px);
}
.app-tile-icon { font-size: 26px; margin-bottom: 6px; line-height: 1; }
.app-tile-name { font-size: 11px; font-weight: 500; text-align: center; line-height: 1.25; color: var(--text); }
.drawer-footer {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.drawer-add-action {
  width: 100%;
  padding: 10px;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--blue);
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.drawer-add-action:hover { background: var(--line); }

.drawer-claim-action {
  width: 100%;
  padding: 10px;
  background: #fdf5e6;
  border: 1px solid #f9d8a0;
  border-radius: 14px;
  color: #b86200;
  font-weight: 500;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
body.dark .drawer-claim-action {
  background: #3b2f1e;
  border-color: #634b29;
  color: #ffd175;
}
.drawer-claim-action:hover { opacity: 0.9; }

/* Claim Modal Body */
.claim-body { display: flex; flex-direction: column; gap: 14px; }
.claim-intro { font-size: 13.5px; line-height: 1.45; color: var(--text); margin: 0; }
.claim-steps { display: flex; flex-direction: column; gap: 10px; margin: 4px 0; }
.claim-step { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--muted); }
.step-num { flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; font-weight: 600; font-size: 12px; color: var(--blue); }
.claim-action-btn { display: inline-flex; align-items: center; justify-content: center; background: var(--blue); color: #fff; text-decoration: none; padding: 12px; border-radius: 14px; font-weight: 600; font-size: 14px; text-align: center; margin-top: 4px; transition: opacity 0.15s; }
.claim-action-btn:hover { opacity: 0.9; }

/* Submission Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
  z-index: 999;
}
.submit-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1001;
  padding: 16px;
}
.modal-box {
  width: min(460px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  animation: modalScaleIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.modal-title { font-size: 18px; font-weight: 600; }
.modal-form { display: flex; flex-direction: column; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 500; color: var(--muted); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--blue);
  outline: none;
}
.type-pills { display: flex; gap: 8px; }
.type-pill {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
}
.type-pill.active {
  background: #e8f0fe;
  border-color: var(--blue);
  color: #1967d2;
}
body.dark .type-pill.active {
  background: #2a3b5c;
  color: #8ab4f8;
}
.type-pill input { display: none; }
.submit-action-btn {
  background: var(--blue);
  color: #ffffff;
  border: 0;
  border-radius: 14px;
  padding: 12px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  margin-top: 6px;
  transition: opacity 0.15s;
}
.submit-action-btn:hover { opacity: 0.9; }
.form-status {
  padding: 10px;
  border-radius: 10px;
  font-size: 13px;
  text-align: center;
}
.form-status.success { background: #e6f4ea; color: #137333; }
.form-status.error { background: #fce8e6; color: #c5221f; }
body.dark .form-status.success { background: #1e3a29; color: #81c995; }
body.dark .form-status.error { background: #3d1c1c; color: #f28b82; }

@keyframes drawerFadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes modalScaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.icon-button { width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); display: grid; place-items: center; }
.icon-button:hover { background: var(--surface); }

main { width: min(760px, calc(100% - 40px)); margin: 0 auto; flex: 1; }
.search-section { padding-top: 105px; position: relative; z-index: 3; }
#intro { text-align: center; margin-bottom: 29px; }
.wordmark {
  display: inline-block;
  font-family: "Rubik", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 58px;
  font-weight: 500;
  letter-spacing: -2.8px;
  line-height: 1.08;
  font-feature-settings: "kern" 1;
  background: linear-gradient(105deg, #4285f4 0 27%, #229ed9 42%, #20a889 60%, #34a853 75%, #f4b400 94%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
#intro p { color: var(--muted); font-size: 15px; margin: 12px 0 0; }

.search-box { position: relative; background: var(--card); border: 1px solid #dfe1e5; border-radius: 28px; box-shadow: 0 1px 6px #20212422; }
.search-box:focus-within { border-color: var(--focus); box-shadow: 0 1px 9px #20212433; }
.input-row { min-height: 56px; display: flex; align-items: center; gap: 8px; padding: 7px 13px 7px 18px; }
.search-icon { width: 21px; height: 21px; color: #9aa0a6; flex: 0 0 auto; }
input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 16px; padding: 8px 3px; }
input::placeholder { color: #80868b; opacity: 1; }
input::-webkit-search-cancel-button { display: none; }
.tool-button { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border: 0; border-radius: 50%; color: #5f6368; background: transparent; padding: 0; }
.tool-button:hover, .tool-button.listening { background: var(--surface); color: var(--blue); }
.tool-button svg { width: 21px; height: 21px; }
#clear { width: 30px; height: 30px; font-size: 25px; line-height: 1; color: #73787d; }

#dropdown { position: absolute; left: -1px; right: -1px; top: calc(100% - 1px); background: var(--card); border: 1px solid var(--focus); border-top: 0; border-radius: 0 0 22px 22px; box-shadow: 0 8px 16px #20212426; padding: 0 0 4px; }
.search-box.open { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.suggestion-heading { margin: 0 16px; padding: 11px 8px 6px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
ul { list-style: none; padding: 0; margin: 0; }
.suggestion { display: flex; align-items: center; gap: 14px; padding: 11px 23px; color: var(--text); font-size: 16px; cursor: pointer; }
.suggestion:hover, .suggestion.selected { background: var(--surface); }
.suggestion svg { width: 19px; height: 19px; color: #9aa0a6; flex: 0 0 auto; }
.suggestion-label { flex: 1; }
.suggestion strong { font-weight: 650; }
.suggestion .fill { color: #9aa0a6; font-size: 20px; }
.suggestion-footer { display: flex; gap: 16px; margin: 5px 24px 0; padding: 10px 0 7px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }

.home-actions { display: flex; justify-content: center; margin-top: 29px; }
.search-action { min-height: 40px; padding: 10px 18px; border: 1px solid transparent; border-radius: 4px; background: var(--surface); color: var(--text); font-size: 14px; box-shadow: 0 1px 1px #00000014; }
.search-action:hover { border-color: #dadce0; color: var(--blue); box-shadow: 0 1px 2px #0000001a; }
.notice { min-height: 22px; margin-top: 13px; color: var(--muted); font-size: 13px; text-align: center; }
.notice:not(.visible) { visibility: hidden; }

.catalog-section { margin: 58px 0 52px; }
body:not(.searching) .catalog-section { display: none; }
.catalog-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
h2 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -.3px; }
.filters-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filters { display: flex; gap: 3px; padding: 4px; border-radius: 12px; background: var(--surface); }
.filters button { padding: 6px 14px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 14px; }
.filters button.active { background: var(--card); color: var(--text); box-shadow: 0 1px 4px #00000014; }
.sort-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--muted); font-size: 13px; cursor: pointer; }
.sort-toggle:hover { color: var(--text); border-color: var(--focus); }
.sort-toggle svg { width: 14px; height: 14px; }
.lang-bar { display: flex; gap: 6px; overflow-x: auto; padding: 6px 0 8px; scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; }
.lang-bar::-webkit-scrollbar { display: none; }
.lang-chip { flex: 0 0 auto; padding: 5px 11px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--muted); font-size: 12.5px; font-weight: 500; cursor: pointer; transition: all 0.15s ease; display: inline-flex; align-items: center; gap: 4px; }
.lang-chip:hover { border-color: var(--focus); color: var(--text); }
.lang-chip.active { background: #e8f0fe; color: #1967d2; border-color: var(--blue); }
body.dark .lang-chip.active { background: #2a3b5c; color: #8ab4f8; }
.category-bar { display: flex; gap: 6px; overflow-x: auto; padding: 6px 0 10px; scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; }
.category-bar::-webkit-scrollbar { display: none; }
.cat-pill { flex: 0 0 auto; padding: 6px 12px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); color: var(--muted); font-size: 13px; cursor: pointer; transition: all 0.15s ease; }
.cat-pill:hover { border-color: var(--focus); color: var(--text); }
.cat-pill.active { background: var(--blue); color: #fff; border-color: var(--blue); font-weight: 500; }
.offline-badge { display: inline-block; padding: 4px 10px; border-radius: 6px; background: #fff3cd; color: #856404; font-size: 12px; margin-top: 10px; font-weight: 500; }
body.dark .offline-badge { background: #423512; color: #ffe69c; }
.load-more-container { text-align: center; margin: 24px 0 16px; }
.load-more-btn { padding: 10px 24px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); color: var(--blue); font-size: 14px; font-weight: 500; cursor: pointer; }
.load-more-btn:hover { background: var(--card); border-color: var(--focus); }
.empty-suggestions { margin: 16px 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.empty-chip { padding: 6px 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--blue); font-size: 13px; cursor: pointer; }
.empty-chip:hover { background: var(--card); border-color: var(--focus); }
.results-info { margin: 13px 0 20px; color: var(--muted); font-size: 14px; }
.results { display: grid; grid-template-columns: 1fr; gap: 0; }
.result-card { display: flex; align-items: flex-start; gap: 14px; padding: 18px 4px; border-bottom: 1px solid var(--line); }
.result-card:hover { background: var(--surface); border-radius: 12px; }
.avatar { position: relative; width: 48px; height: 48px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: var(--avatar-bg); color: var(--avatar-color); font-size: 16px; font-weight: 650; overflow: hidden; }
.avatar-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; z-index: 1; }
.avatar-initials { position: relative; z-index: 0; }
.card-content { min-width: 0; flex: 1; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--blue); font-size: 19px; font-weight: 600; line-height: 1.35; }
.card-title svg { width: 15px; height: 15px; color: var(--muted); flex: 0 0 auto; }
.card-username { margin-top: 3px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.card-description { margin: 5px 0 8px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.card-tag { display: inline-flex; align-items: center; gap: 5px; color: var(--telegram); font-size: 12px; }
.card-tag svg { width: 13px; height: 13px; }
.correction { margin-top: 20px; color: var(--muted); font-size: 15px; }
.correction strong { color: var(--text); }
.correction button { padding: 0; border: 0; background: transparent; color: var(--blue); font-size: inherit; }
.empty { padding: 36px 0; text-align: center; }
.empty-icon { display: block; color: var(--muted); font-size: 50px; }
.empty p { color: var(--muted); font-size: 15px; }
.text-button { padding: 10px 16px; border: 0; border-radius: 10px; background: #e8f0fe; color: #1967d2; font-size: 14px; }

footer { width: min(760px, calc(100% - 40px)); display: flex; justify-content: space-between; gap: 14px; margin: 0 auto; padding: 18px 0 24px; color: var(--muted); font-size: 12px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

body.searching .search-section { padding-top: 27px; }
body.searching #intro { display: none; }
body.searching .catalog-section { display: block; margin-top: 28px; }
body.searching .home-actions, body.searching .notice { display: none; }

@media (max-width: 600px) {
  .topbar { height: 56px; padding: 0 17px; }
  main { width: calc(100% - 32px); }
  .search-section { padding-top: 72px; }
  .wordmark { font-size: 42px; letter-spacing: -2.1px; }
  #intro { margin-bottom: 25px; }
  #intro p { font-size: 14px; }
  .search-box { border-radius: 25px; }
  .input-row { min-height: 54px; gap: 4px; padding-left: 15px; }
  .tool-button { width: 32px; height: 32px; }
  .input-row input { font-size: 16px; }
  .home-actions { margin-top: 24px; }
  .search-action { padding: 9px 15px; }
  .catalog-section { margin-top: 38px; }
  .catalog-head { gap: 9px; }
  h2 { font-size: 17px; }
  .filters button { padding: 6px 10px; font-size: 13px; }
  footer { width: calc(100% - 40px); flex-wrap: wrap; }
  body.searching .search-section { padding-top: 13px; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
