:root {
  --bg-main: #202124;
  --bg-dropdown: #28292c;
  --bg-footer: #171717;
  --bg-search: #202124;
  --text-main: #e8eaed;
  --text-soft: #b0b0b0;
  --text-link: #8ab4f8;
  --text-footer: #b8b8b8;
  --border-main: 1.5px solid #36373a;
  --border-dropdown: 1.5px solid #36373a;
  --dropdown-radius: 12px;
  --dropdown-shadow: 0 4px 24px 6px rgba(0,0,0,0.32);
  --app-bg: #28292c;
  --app-hover: #36373a;
  --app-high: #35363a;
  --btn-bg: #303134;
  --btn-border: 1px solid #5f6368;
  --btn-hover: #36373a;
  --input-bg: #202124;
  --input-border: 1px solid #5f6368;
}
body.light {
  --bg-main: #fff;
  --bg-dropdown: #fff;
  --bg-footer: #f2f2f2;
  --bg-search: #fff;
  --text-main: #202124;
  --text-soft: #4d5156;
  --text-link: #1a0dab;
  --text-footer: #5f6368;
  --border-main: 1.5px solid #dadce0;
  --border-dropdown: 1.5px solid #dadce0;
  --dropdown-radius: 12px;
  --dropdown-shadow: 0 2px 8px rgba(60,64,67,.12);
  --app-bg: #fff;
  --app-hover: #f7f7f7;
  --app-high: #f1f3f4;
  --btn-bg: #f8f9fa;
  --btn-border: 1px solid #dadce0;
  --btn-hover: #f1f3f4;
  --input-bg: #fff;
  --input-border: 1px solid #dadce0;
}
body {
  background: var(--bg-main);
  color: var(--text-main);
  font-family: Arial, sans-serif;
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background 0.25s, color 0.2s;
}
header {
  width: 100%;
  padding: 20px 0 0 0;
}
nav {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box;
  padding: 0 30px;
}
.nav-left, .nav-right {
  display: flex;
  align-items: center;
  gap: 18px;
}
.nav-left a, .nav-right a {
  color: var(--text-main);
  text-decoration: none;
  font-size: 15px;
  padding: 2px 6px;
  border-radius: 2px;
}
.signin {
  background: #1a73e8;
  color: #fff !important;
  border-radius: 4px;
  padding: 8px 23px;
  font-weight: 500;
  margin-left: 10px;
  border: none;
  text-decoration: none;
  transition: background 0.2s;
}
.signin:hover {
  background: #1765c1;
}
.apps-menu {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  height: 40px;
  width: 40px;
  border-radius: 50%;
  position: relative;
  user-select: none;
  margin: 0 6px;
}
.apps-menu:focus {
  outline: none;
  background: var(--btn-hover);
}
.apps-menu:hover {
  background: var(--btn-hover);
}
.apps-icon {
  fill: var(--text-main);
}
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  margin-left: 6px;
  border: 2px solid var(--btn-hover);
  object-fit: cover;
}
.apps-dropdown {
  display: none;
  position: absolute;
  top: 48px;
  right: 0;
  background: var(--app-bg);
  border-radius: 24px;
  box-shadow: var(--dropdown-shadow);
  min-width: 340px;
  max-width: 370px;
  width: 370px;
  padding: 18px 8px 18px 8px;
  z-index: 210;
  border: var(--border-dropdown);
  max-height: 430px;
  overflow-y: auto;
  transition: opacity 0.2s;
}
.apps-dropdown.show {
  display: block;
}
.apps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px 0;
  justify-items: center;
  align-items: center;
}
.app {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100px;
  color: var(--text-main);
  text-decoration: none;
  font-size: 14px;
  padding: 7px 0;
  border-radius: 12px;
  transition: background 0.17s, color 0.17s;
  position: relative;
}
.app .app-icon {
  width: 40px;
  height: 40px;
  margin-bottom: 4px;
  border-radius: 12px;
  object-fit: contain;
  background: none;
}
.app .avatar {
  border-radius: 50%;
  border: 2px solid #444;
  width: 40px;
  height: 40px;
  object-fit: cover;
}
.app.highlight {
  background: var(--app-high);
  box-shadow: 0 1px 8px rgba(0,0,0,0.08);
}
.app:hover {
  background: var(--app-hover);
  color: #fff;
}
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.logo {
  width: 272px;
  margin: 70px 0 30px 0;
  display: block;
}
.search-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.search-bar-wrapper {
  width: 560px;
  background: var(--input-bg);
  display: flex;
  align-items: center;
  border: var(--input-border);
  box-shadow: 0 2px 4px 0 rgba(60,64,67,.07);
  border-radius: 24px;
  padding: 0 14px;
  height: 46px;
  margin-bottom: 30px;
  transition: box-shadow 0.2s, background 0.2s, border-color 0.2s;
}
.search-bar-wrapper:focus-within {
  box-shadow: 0 1px 6px 0 #20212447;
  border-color: #dfe1e5;
}
.search-bar-wrapper input[type="text"] {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px;
  padding: 12px 10px;
  background: transparent;
  color: var(--text-main);
}
.search-icon, .voice-icon, .lens-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  height: 24px;
  width: 24px;
}
.search-icon {
  margin-right: 10px;
}
.voice-icon, .lens-icon {
  margin-left: 8px;
}
.buttons {
  margin-top: 0;
  margin-bottom: 25px;
  display: flex;
  gap: 8px;
}
.buttons button {
  font-size: 14px;
  color: var(--text-main);
  background: var(--btn-bg);
  border: var(--btn-border);
  border-radius: 4px;
  padding: 10px 18px;
  cursor: pointer;
  margin: 0;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.buttons button:hover {
  border: 1px solid var(--text-main);
  background: var(--btn-hover);
}
.lang-offer {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-soft);
  text-align: center;
}
.lang-offer a {
  color: var(--text-link);
  margin: 0 2px;
  text-decoration: none;
}
.lang-offer a:hover {
  text-decoration: underline;
}
footer {
  background: var(--bg-footer);
  width: 100%;
  font-size: 15px;
  color: var(--text-footer);
  box-sizing: border-box;
  margin-top: auto;
}
.footer-top {
  padding: 15px 30px;
  border-bottom: 1px solid #232323;
  background: var(--bg-footer);
  text-align: left;
  color: var(--text-footer);
}
body.light .footer-top {
  border-bottom: 1px solid #e4e4e4;
}
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 30px;
  flex-wrap: wrap;
  background: var(--bg-footer);
}
.footer-links {
  display: flex;
  gap: 24px;
}
.footer-links.left {
  justify-content: flex-start;
}
.footer-links.right {
  justify-content: flex-end;
  align-items: center;
}
.footer-links a {
  color: var(--text-footer);
  text-decoration: none;
  font-size: 14px;
  transition: text-decoration 0.2s;
}
.footer-links a:hover {
  text-decoration: underline;
}
.settings-menu {
  position: relative;
  display: inline-block;
}
.settings-menu > a {
  cursor: pointer;
}
.settings-dropdown {
  display: none;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 36px;
  background-color: var(--bg-dropdown);
  border: var(--border-dropdown);
  border-radius: var(--dropdown-radius);
  box-shadow: var(--dropdown-shadow);
  padding: 8px 0;
  z-index: 300;
  min-width: 210px;
  flex-direction: column;
  transition: background 0.2s, border 0.2s;
}
.settings-dropdown.show {
  display: flex;
}
.settings-dropdown a,
.settings-dropdown button {
  color: var(--text-main);
  padding: 10px 24px;
  text-decoration: none;
  font-size: 14px;
  transition: background 0.2s;
  border-radius: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.settings-dropdown a:hover,
.settings-dropdown button:hover {
  background: var(--app-hover);
  color: #fff;
}
.settings-dropdown .toggle-mode {
  font-weight: 500;
  border-bottom: 1px solid #36373a;
  margin-bottom: 4px;
  padding-bottom: 8px;
  gap: 12px;
}
body.light .settings-dropdown .toggle-mode {
  border-bottom: 1px solid #dadce0;
}
@media (max-width: 700px) {
  .search-bar-wrapper {
    width: 95vw;
    min-width: 0;
  }
  .logo {
    width: 180px;
    margin: 40px 0 15px 0;
  }
  .footer-bottom {
    flex-direction: column;
    gap: 8px;
    padding: 12px 15px;
  }
  .apps-dropdown {
    right: 50%;
    transform: translateX(50%);
    min-width: 200px;
    width: 95vw;
    max-width: 99vw;
  }
  .apps-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 400px) {
  .search-bar-wrapper {
    width: 99vw;
    padding: 0 4px;
  }
  .settings-dropdown {
    left: 50%;
    transform: translateX(-50%);
    min-width: 110px;
  }
  .apps-dropdown {
    min-width: 120px;
    width: 99vw;
    max-width: 99vw;
  }
}

.lucky-button {
  display: inline-block;
  padding: 10px 20px;
  background: linear-gradient(to bottom, #3c4043, #2c2f33); /* Slight gradient */
  color: white;
  text-decoration: none;
  border: 1px solid #5f6368;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.3s ease;
  text-align: center;
}

.lucky-button:hover {
  background: linear-gradient(to bottom, #5f6368, #3c4043);
}
.lucky-button:active {
  background: linear-gradient(to bottom, #2c2f33, #3c4043);
}