:root {
  --color-navy: #163a5f;
  --color-primary: #2f80ed;
  --color-primary-dark: #1f6fd1;
  --color-light-blue: #eaf3ff;

  --color-background: #d9e7f5;
  --color-surface: #ffffff;

  --color-text: #1f2937;
  --color-muted: #6b7280;

  --color-border: #d9e2ec;
  --color-success: #2e8b57;

  --shadow-soft: 0 8px 24px rgba(22, 58, 95, 0.08);
  --shadow-card: 0 4px 14px rgba(22, 58, 95, 0.10);

  --radius-small: 8px;
  --radius-medium: 14px;
  --radius-large: 20px;

  --page-max-width: 1200px;
}

/* Reset */

* {
  box-sizing: border-box;
}

html {
  margin: 0;
  padding: 0;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;

  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;

  background: var(--color-background);
  color: var(--color-text);
}

/* General */

img {
  max-width: 100%;
  height: auto;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

/* Main page */

.page {
  width: 100%;
  max-width: var(--page-max-width);
  margin: 0 auto;
  padding: 16px;
}

/* Header */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;

  padding: 10px 0 18px;
}

.logo-container {
  display: flex;
  align-items: center;
}

.booksmap-logo {
  width: 170px;
  max-width: 55vw;
  display: block;
}

.language-select {
  min-width: 70px;
  padding: 9px 10px;

  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);

  background: var(--color-surface);
  color: var(--color-text);
}

/* Hero */

.hero {
  text-align: center;
  padding: 16px 6px 22px;
}

.hero h1 {
  margin: 0 0 12px;

  font-size: clamp(1.8rem, 7vw, 3rem);
  line-height: 1.1;

  color: var(--color-navy);
}

.hero-text {
  max-width: 520px;
  margin: 0 auto 22px;

  font-size: 1rem;
  line-height: 1.55;

  color: var(--color-muted);
}

/* Buttons */

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  min-height: 52px;
  padding: 13px 24px;

  border: 0;
  border-radius: var(--radius-medium);

  background: var(--color-primary);
  color: #ffffff;

  font-weight: 700;
  font-size: 1rem;

  box-shadow: var(--shadow-card);

  transition:
    background 0.2s ease,
    transform 0.2s ease;
}

.primary-button:hover {
  background: var(--color-primary-dark);
}

.primary-button:active {
  transform: scale(0.98);
}

.secondary-button {
  min-height: 46px;
  padding: 10px 18px;

  border: 1px solid var(--color-border);
  border-radius: var(--radius-medium);

  background: var(--color-surface);
  color: var(--color-navy);

  font-weight: 600;
}

/* Section */

.section {
  margin-top: 22px;
}

.section-title {
  margin: 0 0 12px;

  font-size: 1.15rem;
  font-weight: 700;

  color: var(--color-navy);
}

/* Map */

.map-card {
  width: 100%;
  min-height: 360px;

  overflow: hidden;

  border: 1px solid var(--color-border);
  border-radius: var(--radius-large);

  background: var(--color-light-blue);

  box-shadow: var(--shadow-soft);
}

.map-placeholder {
  min-height: 360px;

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

  padding: 24px;
  text-align: center;

  color: var(--color-muted);
}

/* Account actions */

.account-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;

  margin-top: 18px;
}

/* Cards */

.card {
  padding: 16px;

  border: 1px solid var(--color-border);
  border-radius: var(--radius-medium);

  background: var(--color-surface);

  box-shadow: var(--shadow-soft);
}

/* Modal / bottom sheet */

.modal-backdrop {
  position: fixed;
  inset: 0;

  display: none;
  align-items: flex-end;
  justify-content: center;

  padding: 0;

  background: rgba(15, 23, 42, 0.48);

  z-index: 1000;
}

.modal-backdrop.is-open {
  display: flex;
}

.login-sheet {
  width: 100%;
  max-width: 520px;

  padding: 22px;

  border-radius: 22px 22px 0 0;

  background: var(--color-surface);

  box-shadow: 0 -8px 30px rgba(15, 23, 42, 0.16);
}

.login-sheet h2 {
  margin-top: 0;
  color: var(--color-navy);
}

.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  margin-bottom: 6px;

  font-weight: 600;
  color: var(--color-text);
}

.form-input {
  width: 100%;
  min-height: 48px;

  padding: 11px 12px;

  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);

  background: #ffffff;
  color: var(--color-text);
}

.form-input:focus {
  outline: 2px solid rgba(47, 128, 237, 0.18);
  border-color: var(--color-primary);
}

/* Bottom navigation */

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;

  display: flex;
  justify-content: space-around;

  padding:
    8px
    8px
    calc(8px + env(safe-area-inset-bottom));

  border-top: 1px solid var(--color-border);

  background: rgba(255, 255, 255, 0.96);

  z-index: 500;
}

.bottom-nav a,
.bottom-nav button {
  flex: 1;

  border: 0;
  background: transparent;

  padding: 8px 4px;

  text-align: center;
  font-size: 0.78rem;

  color: var(--color-muted);
}

.bottom-nav .active {
  color: var(--color-primary);
  font-weight: 700;
}

/* Footer */

.site-footer {
  margin-top: 32px;
  padding: 20px 0 90px;

  text-align: center;

  color: var(--color-muted);
  font-size: 0.85rem;
}

/* Desktop */

@media (min-width: 768px) {
  .page {
    padding: 24px 32px;
  }

  .booksmap-logo {
    width: 210px;
  }

  .hero {
    padding-top: 32px;
    padding-bottom: 30px;
  }

  .hero-text {
    font-size: 1.1rem;
  }

  .map-card,
  .map-placeholder {
    min-height: 500px;
  }

  .modal-backdrop {
    align-items: center;
    padding: 24px;
  }

  .login-sheet {
    border-radius: var(--radius-large);
  }

  .bottom-nav {
    display: none;
  }

  .site-footer {
    padding-bottom: 24px;
  }
}
@media (max-width: 767px) {
  #isbnModal .login-sheet {
    max-height: 92vh;
    overflow-y: auto;
  }

  #scannerReader {
    min-height: 340px;
  }

  #scannerReader video {
    width: 100% !important;
    height: auto !important;
    object-fit: cover;
  }
}
