* {
  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;
}

.home-screen h1 {
  font-size: 3.4rem;
  font-weight: 300;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #1a1a1a 0%, #5a5a5a 50%, #1a1a1a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  padding-top: 1.5rem;
}

.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;
}

.museum-rotator {
  display: inline-block;
  font-weight: 600;
  transition: opacity 0.4s ease;
}

.museum-rotator.fading {
  opacity: 0;
}

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

.camera-button {
  width: 260px;
  height: 260px;
  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: 105px;
  height: 105px;
  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;
  animation: artwork-fade-in 0.25s ease;
}

@keyframes artwork-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.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;
}

.info-button {
  position: absolute;
  top: 1rem;
  right: 20px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid #d0d0d0;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  z-index: 10;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.info-button span {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.05rem;
  font-style: italic;
  color: #6b6b6b;
  line-height: 1;
  transition: color 0.2s ease;
}

.info-button:hover {
  border-color: #9b9b9b;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

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

.back-button {
  position: absolute;
  top: calc(max(0.75rem, env(safe-area-inset-top, 0px)) + 2px);
  left: max(12px, env(safe-area-inset-left, 0px));
  z-index: 10;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.055);
  color: #2c2c2c;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: background 0.15s ease, transform 0.12s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.back-button:hover {
  background: rgba(0, 0, 0, 0.09);
  color: #1a1a1a;
}

.back-button:active {
  background: rgba(0, 0, 0, 0.12);
  transform: scale(0.96);
}

.back-button:focus-visible {
  outline: 2px solid #2c2c2c;
  outline-offset: 2px;
}

.back-button-icon {
  display: block;
  flex-shrink: 0;
  pointer-events: none;
}

.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;
  border-radius: 16px;
}

.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;
  inset: 0;
  z-index: 1001;
  background: rgba(255, 255, 255, 0.92);
  align-items: center;
  justify-content: center;
}

.loading.show {
  display: flex;
}

.loading-card {
  text-align: center;
  padding: 2rem 2.5rem;
}

.loading-dots {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2c2c2c;
  animation: loading-dot 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes loading-dot {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.3;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.loading-phrase {
  font-size: 1rem;
  color: #4a4a4a;
  font-weight: 400;
  letter-spacing: 0.01em;
  min-height: 1.5em;
  transition: opacity 0.35s ease;
}

.loading-phrase.fade {
  opacity: 0;
}

.hidden-audio {
  display: none;
}

/* Skeleton loading screen */
@keyframes skeleton-shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.skeleton-el {
  background: linear-gradient(90deg, #f0f0f0 25%, #e4e4e4 50%, #f0f0f0 75%);
  background-size: 800px 100%;
  animation: skeleton-shimmer 1.5s infinite linear;
  border-radius: 4px;
}

.skeleton-screen {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  position: relative;
  padding-bottom: 2rem;
  overflow: hidden;
}

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

.skeleton-title-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin: 4.5rem 20px 0.75rem;
}

.skeleton-title-line {
  height: 1.75rem;
  width: 70%;
  max-width: 280px;
}


.skeleton-image-block {
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 50vh;
  border-radius: 16px;
  margin-bottom: 1rem;
}

.skeleton-artist-block {
  height: 1rem;
  width: 55%;
  max-width: 200px;
  margin: 0 auto 0.5rem;
}

.skeleton-date-block {
  height: 0.85rem;
  width: 35%;
  max-width: 130px;
  margin: 0 auto 1rem;
}

.skeleton-language-block {
  height: 48px;
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
  border-radius: 6px;
}

.skeleton-play-block {
  width: 80px;
  height: 80px;
  border-radius: 50%;
}

.skeleton-time-block {
  height: 0.85rem;
  width: 55px;
}

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

  .home-screen h1 {
    font-size: 2rem;
    padding-top: 0.85rem;
  }

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

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

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

  .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 {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    top: calc(max(0.5rem, env(safe-area-inset-top, 0px)) + 2px);
    left: max(10px, env(safe-area-inset-left, 0px));
  }

  .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;
  }

  .home-screen h1 {
    font-size: 1.75rem;
    padding-top: 0.7rem;
  }

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

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

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

  .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;
  }

  .home-screen h1 {
    font-size: 1.55rem;
    padding-top: 0.6rem;
  }

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

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

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

  .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 {
        width: 42px;
        height: 42px;
        min-width: 42px;
        min-height: 42px;
        top: calc(max(0.5rem, env(safe-area-inset-top, 0px)) + 2px);
        left: max(8px, env(safe-area-inset-left, 0px));
      }

      .back-button-icon {
        width: 20px;
        height: 20px;
      }

  .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: calc(max(0.75rem, env(safe-area-inset-top, 0px)) + 2px);
  left: max(14px, env(safe-area-inset-left, 0px));
}

@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: calc(max(0.5rem, env(safe-area-inset-top, 0px)) + 2px);
    left: max(10px, env(safe-area-inset-left, 0px));
  }
}

/* National Gallery highlights page */
.highlights-screen .container {
  max-width: 1100px;
}

.highlights-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.highlight-card {
  border: 1px solid #e8e8e8;
  border-radius: 14px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.highlight-card:has(.highlight-card-link:hover) {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
  border-color: #d0d0d0;
}

.highlight-card-link {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.highlight-card-link:active {
  opacity: 0.94;
}

.highlight-card-link:focus-visible {
  outline: 2px solid #2c2c2c;
  outline-offset: 2px;
}

.highlights-screen .privacy-content a.highlight-card-link {
  color: inherit;
  text-decoration: none;
}

.highlight-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #f8f8f8;
}

.highlight-card-body {
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.highlight-card-body h3 {
  font-size: 1.04rem;
  font-weight: 400;
  color: #2c2c2c;
  line-height: 1.35;
  margin: 0;
}

.highlight-meta {
  margin: 0;
  font-size: 0.9rem;
  color: #6b6b6b;
}
