* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  height: 100%;
  -webkit-overflow-scrolling: touch;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #ffffff;
  min-height: 100%;
  width: 100%;
  overflow-x: hidden;
  padding: 0;
  margin: 0;
  color: #2c2c2c;
  position: relative;
}

/* Desktop notice: show when viewport is desktop-sized (e.g. not a phone) */
.desktop-notice {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: #f8f8f8;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  box-sizing: border-box;
}

.desktop-notice.show {
  display: flex;
}

.desktop-notice-content {
  text-align: center;
  max-width: 420px;
}

.desktop-notice-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1.5rem;
  color: #6b6b6b;
}

.desktop-notice-icon svg {
  width: 100%;
  height: 100%;
}

.desktop-notice-title {
  font-size: 1.5rem;
  font-weight: 400;
  color: #2c2c2c;
  margin: 0 0 1rem;
  letter-spacing: -0.02em;
}

.desktop-notice-text {
  font-size: 1.05rem;
  font-weight: 300;
  color: #4a4a4a;
  line-height: 1.6;
  margin: 0 0 1.25rem;
}

.desktop-notice-url {
  font-size: 1rem;
  font-weight: 400;
  color: #2c2c2c;
  margin: 0;
  letter-spacing: 0.02em;
}

.container {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  padding: 0 20px;
  box-sizing: border-box;
}

.home-screen .container {
  height: var(--actual-vh, 100vh); /* Use JavaScript-calculated actual viewport height (excludes browser UI) */
  max-height: var(--actual-vh, 100vh);
  min-height: 0;
  justify-content: space-between;
  align-items: stretch;
  padding-top: 0;
  padding-bottom: 0;
  overflow: hidden;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.artwork-screen .container {
  padding-top: 0;
  padding-bottom: 2rem;
  display: flex;
  flex-direction: column;
}

h1 {
  font-size: 2.5rem;
  font-weight: 400;
  padding-top: 0.75rem;
  margin-bottom: 0;
  margin-top: 0;
  line-height: 1.2;
  color: #2c2c2c;
  letter-spacing: -0.03em;
  flex-shrink: 0;
  flex-grow: 0;
  padding-bottom: 0;
}

.button-container {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 1;
  padding: 0.5rem 0;
  min-height: 0;
  overflow: hidden;
}

.instructions {
  padding-bottom: 0.75rem;
  padding-top: 0;
  margin-top: 0;
  margin-bottom: 0;
  font-size: 1.1rem;
  font-weight: 400;
  color: #4a4a4a;
  line-height: 1.5;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
  flex-shrink: 0;
  flex-grow: 0;
}

@keyframes float {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}

.camera-button {
  width: 200px;
  height: 200px;
  background: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  transition: all 0.2s ease;
  border: 1px solid #e8e8e8;
  position: relative;
  animation: float 3s ease-in-out infinite;
}

.camera-button:active {
  animation: none;
  transform: scale(0.98);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.camera-button:hover {
  animation: none;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
  border-color: #d0d0d0;
  transform: translateY(-2px) scale(1.02);
}

.camera-icon {
  width: 80px;
  height: 80px;
  color: #6b6b6b;
  position: relative;
}

.camera-icon svg {
  width: 100%;
  height: 100%;
}

#file-input {
  display: none;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #2c2c2c;
  color: #ffffff;
  padding: 14px 24px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 300;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1000;
  max-width: 90%;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Preview area (optional, for testing) */
.preview-container {
  margin-top: 2rem;
  display: none;
}

.preview-container.show {
  display: block;
}

.preview-image {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Artwork display screen */
.artwork-screen {
  display: none;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  position: relative;
  padding-bottom: 2rem;
}

.artwork-screen.show {
  display: flex;
}

.home-screen {
  display: flex;
  flex-direction: column;
  height: var(--actual-vh, 100vh); /* Use JavaScript-calculated actual viewport height (excludes browser UI) */
  max-height: var(--actual-vh, 100vh);
  min-height: var(--actual-vh, 100vh);
  width: 100%;
  position: relative;
  overflow: hidden;
}

.home-screen.hidden {
  display: none;
}

.back-button {
  position: absolute;
  top: 1rem;
  left: 20px;
  background: none;
  border: none;
  font-size: 2rem;
  color: #6b6b6b;
  cursor: pointer;
  padding: 12px;
  z-index: 10;
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.back-button:hover {
  color: #2c2c2c;
}

.artwork-title {
  font-size: 1.75rem;
  font-weight: 400;
  color: #2c2c2c;
  margin-top: 4.5rem;
  margin-bottom: 0.75rem;
  line-height: 1.3;
  padding: 0 20px;
  text-align: center;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
  flex-shrink: 0;
  flex-grow: 0;
  box-sizing: border-box;
  word-wrap: break-word;
  overflow-wrap: break-word;
  position: relative;
}

.artwork-image-container {
  margin-top: 0;
  margin-bottom: 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  min-height: 200px;
  max-height: 50vh;
  overflow: hidden;
}

.artwork-image {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  object-fit: contain;
}

.artwork-info {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding-bottom: 1.5rem;
  min-height: 0;
  gap: 1rem;
}

.artwork-artist {
  font-size: 1.1rem;
  font-weight: 300;
  color: #6b6b6b;
  margin-bottom: 0.25rem;
}

.artwork-date {
  font-size: 0.95rem;
  font-weight: 300;
  color: #9b9b9b;
  margin-bottom: 1rem;
}

.language-selector {
  margin-bottom: 1rem;
}

.language-select {
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 300;
  color: #2c2c2c;
  background: #ffffff;
  border: 1px solid #e8e8e8;
  border-radius: 6px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b6b6b' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

.language-select:hover {
  border-color: #d0d0d0;
}

.language-select:focus {
  outline: none;
  border-color: #6b6b6b;
}

.audio-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.play-pause-button {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: #2c2c2c;
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(44, 44, 44, 0.2);
  transition: all 0.2s ease;
}

.play-pause-button:hover {
  background: #1a1a1a;
  box-shadow: 0 6px 20px rgba(44, 44, 44, 0.3);
  transform: scale(1.05);
}

.play-pause-button:active {
  transform: scale(0.95);
}

.play-pause-icon {
  width: 32px;
  height: 32px;
  fill: currentColor;
}

.time-display {
  font-size: 0.9rem;
  font-weight: 300;
  color: #6b6b6b;
  font-variant-numeric: tabular-nums;
}

.source-link {
  display: block;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 300;
  color: #6b6b6b;
  text-decoration: underline;
  margin-top: 1rem;
  padding-top: 0.5rem;
  padding-bottom: 1.5rem;
  flex-shrink: 0;
  transition: color 0.2s ease;
}

.source-link:hover {
  color: #2c2c2c;
}

.loading {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1001;
}

.loading.show {
  display: block;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e8e8e8;
  border-top-color: #2c2c2c;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.hidden-audio {
  display: none;
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.5rem;
    padding-top: 0.5rem;
    padding-bottom: 0;
  }

  .instructions {
    font-size: 0.95rem;
    padding-bottom: 0.5rem;
    padding-top: 0;
    line-height: 1.5;
    font-weight: 400;
    color: #4a4a4a;
  }

  .camera-button {
    width: 140px;
    height: 140px;
  }

  .camera-icon {
    width: 55px;
    height: 55px;
  }

  .button-container {
    padding: 0.25rem 0;
  }

  .artwork-title {
    font-size: 1.5rem;
    margin-top: 4rem;
    margin-bottom: 0.5rem;
    padding: 0 20px;
    max-width: 100%;
  }

  .back-button {
    font-size: 1.75rem;
    width: 52px;
    height: 52px;
    padding: 10px;
  }

  .artwork-artist {
    font-size: 1rem;
  }

  .artwork-date {
    margin-bottom: 0.75rem;
  }

  .artwork-image-container {
    margin-bottom: 0.75rem;
    max-height: 40vh;
  }

  .language-selector {
    margin-bottom: 0.75rem;
  }

  .artwork-info {
    padding-bottom: 1rem;
  }
}

@media (max-width: 360px) {
  h1 {
    font-size: 1.3rem;
    padding-top: 0.4rem;
    padding-bottom: 0;
  }

  .instructions {
    font-size: 0.9rem;
    padding-bottom: 0.4rem;
    padding-top: 0;
    line-height: 1.5;
    font-weight: 400;
    color: #4a4a4a;
  }

  .camera-button {
    width: 120px;
    height: 120px;
  }

  .camera-icon {
    width: 45px;
    height: 45px;
  }

  .button-container {
    padding: 0.2rem 0;
  }
}

/* Very small screens (iPhone SE, etc.) */
@media (max-width: 375px) and (max-height: 667px) {
  h1 {
    font-size: 1.2rem;
    padding-top: 0.3rem;
    padding-bottom: 0;
  }

  .instructions {
    font-size: 0.85rem;
    padding-bottom: 0.3rem;
    padding-top: 0;
    line-height: 1.5;
    font-weight: 400;
    color: #4a4a4a;
  }

  .camera-button {
    width: 110px;
    height: 110px;
  }

  .camera-icon {
    width: 40px;
    height: 40px;
  }

  .button-container {
    padding: 0.15rem 0;
  }
}

      .artwork-title {
        font-size: 1.35rem;
        margin-top: 3.5rem;
        margin-bottom: 0.5rem;
        padding: 0 15px;
        max-width: 100%;
      }

      .back-button {
        font-size: 1.5rem;
        width: 48px;
        height: 48px;
        padding: 8px;
        top: 0.75rem;
        left: 15px;
      }

  .artwork-artist {
    font-size: 0.95rem;
  }

  .artwork-date {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
  }

  .play-pause-button {
    width: 70px;
    height: 70px;
  }

  .play-pause-icon {
    width: 28px;
    height: 28px;
  }
}

/* Footer */
.footer {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  padding: 1rem 0;
  margin-top: auto;
  flex-shrink: 0;
  border-top: 1px solid #e8e8e8;
  padding-top: 1rem;
}

.footer-button {
  font-size: 0.9rem;
  font-weight: 300;
  color: #6b6b6b;
  text-decoration: none;
  padding: 0.5rem 1rem;
  transition: color 0.2s ease;
  background: none;
  border: none;
  cursor: pointer;
}

.footer-button:hover {
  color: #2c2c2c;
}

/* Privacy Policy Page */
.privacy-screen {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  position: relative;
  padding-bottom: 2rem;
}

.privacy-screen .container {
  max-width: 700px;
  padding: 2rem 20px;
  text-align: left;
}

.privacy-screen h1 {
  text-align: center;
  margin-bottom: 2rem;
  padding-top: 3rem;
}

.privacy-content {
  line-height: 1.7;
  color: #2c2c2c;
}

.privacy-content section {
  margin-bottom: 2rem;
}

.privacy-content h2 {
  font-size: 1.3rem;
  font-weight: 400;
  color: #2c2c2c;
  margin-bottom: 0.75rem;
  margin-top: 0;
}

.privacy-content p {
  font-size: 0.95rem;
  font-weight: 300;
  color: #4a4a4a;
  margin-bottom: 1rem;
}

.privacy-content ul,
.privacy-content ol {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
  padding-left: 0;
}

.privacy-content li {
  font-size: 0.95rem;
  font-weight: 300;
  color: #4a4a4a;
  margin-bottom: 0.5rem;
  list-style-type: disc;
}

.privacy-content ol li {
  list-style-type: decimal;
}

.privacy-content a {
  color: #6b6b6b;
  text-decoration: underline;
  transition: color 0.2s ease;
}

.privacy-content a:hover {
  color: #2c2c2c;
}

.privacy-content strong {
  font-weight: 400;
  color: #2c2c2c;
}

.last-updated {
  font-size: 0.85rem;
  color: #9b9b9b;
  font-style: italic;
  margin-bottom: 2rem;
  text-align: center;
}

.privacy-screen .back-button {
  position: absolute;
  top: 1rem;
  left: 20px;
}

@media (max-width: 480px) {
  .privacy-screen .container {
    padding: 1.5rem 15px;
  }

  .privacy-screen h1 {
    font-size: 1.5rem;
    padding-top: 2.5rem;
    margin-bottom: 1.5rem;
  }

  .privacy-content h2 {
    font-size: 1.1rem;
  }

  .privacy-content p,
  .privacy-content li {
    font-size: 0.9rem;
  }

  .footer {
    gap: 1rem;
    padding: 0.75rem 0;
    padding-top: 0.75rem;
  }

  .footer-button {
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
  }

  .privacy-screen .back-button {
    top: 0.75rem;
    left: 15px;
  }
}
