:root {
  --color-primary: #0d5c63;
  --color-accent: #4fc3f7;
  --color-passage: #00acc1;
  --color-bg: #f7f7f7;
  --color-text: #111;
  --font-base: 16px;
  --line-height: 1.55;
}

* {
  box-sizing: border-box;
}

html {
  font-size: var(--font-base);
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  background: var(--color-bg);
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  padding-top: max(10px, env(safe-area-inset-top, 0px));
  background: var(--color-primary);
  color: #fff;
  font-size: 15px;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo {
  display: block;
  flex-shrink: 0;
}

.app-name {
  font-weight: 600;
  letter-spacing: 0.01em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-date {
  font-size: 13px;
  opacity: 0.9;
  margin-right: 4px;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.lang-toggle {
  min-width: 38px;
  min-height: 36px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  background: #fff;
  color: var(--color-primary);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.lang-toggle:hover,
.lang-toggle:focus-visible {
  outline: none;
  background: #e8f4f5;
}

.icon-btn:hover,
.icon-btn:focus-visible {
  background: rgba(255, 255, 255, 0.22);
  outline: none;
}

.icon-btn:active {
  background: rgba(255, 255, 255, 0.3);
}

.icon-btn--audio.playing {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-primary);
}

.icon-btn--audio.icon-btn--has-audio {
  background: rgba(79, 195, 247, 0.25);
  border-color: var(--color-accent);
}

/* Passage reference bar */
.passage-title {
  background: var(--color-passage);
  color: #fff;
  text-align: center;
  padding: 10px 12px;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.35;
  flex-shrink: 0;
}

/* Content */
.app-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 18px 20px;
  line-height: var(--line-height);
  -webkit-overflow-scrolling: touch;
}

.placeholder {
  color: #888;
  text-align: center;
  margin-top: 40px;
}

/* Bible passage */
.btext-block .section-title {
  font-weight: 600;
  margin: 0 0 8px;
}

.btext-block .passage-subtitle {
  font-style: italic;
  margin: 0 0 12px;
  color: #333;
}

.btext-block p {
  margin: 0 0 10px;
}

.btext-block sup {
  font-size: 0.65em;
  vertical-align: super;
  line-height: 0;
  font-weight: 600;
  color: var(--color-primary);
  margin-right: 2px;
}

.btext-block .chapter-num {
  font-weight: 700;
  font-size: 1.05em;
  margin: 12px 0 4px;
  display: block;
}

.btext-block .verse-line {
  margin-bottom: 6px;
}

.divider {
  border: none;
  border-top: 2px solid var(--color-accent);
  margin: 20px 0 16px;
}

/* Devotional */
.thought-block .day-topic {
  font-weight: 700;
  font-size: 1.1em;
  margin-bottom: 14px;
}

.thought-block h3 {
  font-size: 1em;
  font-weight: 700;
  margin: 16px 0 8px;
}

.thought-block p {
  margin: 0 0 10px;
}

/* Video and sharing */
.video-share-card,
.daily-share-card {
  margin-top: 24px;
  padding: 16px;
  border: 1px solid #d8e8ea;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 3px 14px rgba(13, 92, 99, 0.08);
}

.supplement-header {
  margin-bottom: 12px;
}

.supplement-header h2 {
  margin: 0;
  color: var(--color-primary);
  font-size: 1rem;
  line-height: 1.3;
}

.supplement-header p {
  margin: 4px 0 0;
  color: #667;
  font-size: 0.85rem;
  line-height: 1.35;
}

.vertical-video-frame {
  position: relative;
  width: min(100%, 240px);
  aspect-ratio: 9 / 16;
  margin: 0 auto 12px;
  overflow: hidden;
  border-radius: 18px;
  background:
    radial-gradient(circle at top, rgba(79, 195, 247, 0.35), transparent 34%),
    linear-gradient(160deg, #052f34, #0d5c63);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.video-thumbnail {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.vertical-video-frame .video-link-preview {
  position: relative;
  z-index: 1;
  background: linear-gradient(to top, rgba(5, 47, 52, 0.94), rgba(5, 47, 52, 0.35) 58%, rgba(5, 47, 52, 0.08));
}

.vertical-video-frame video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.video-link-preview {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 18px;
  color: #fff;
  text-align: center;
}

.video-source {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.video-link-preview strong {
  font-size: 1.2rem;
  line-height: 1.25;
}

.video-card-play {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.22);
  font-size: 1.35rem;
  line-height: 1;
}

.video-note {
  margin: 0 0 12px;
  color: #666;
  font-size: 0.82rem;
  line-height: 1.4;
}

.primary-link-button,
.share-form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  border: none;
  border-radius: 12px;
  background: var(--color-primary);
  color: #fff;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.share-form {
  display: grid;
  gap: 8px;
}

.share-form input,
.share-form textarea {
  width: 100%;
  border: 1px solid #ccdadd;
  border-radius: 12px;
  padding: 10px 12px;
  background: #fbfbfb;
  color: var(--color-text);
  font: inherit;
}

.share-form textarea {
  resize: vertical;
  min-height: 88px;
}

.share-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.share-empty {
  margin: 0;
  color: #777;
  font-size: 0.9rem;
}

.share-item {
  padding: 12px;
  border-radius: 12px;
  background: #f2f7f8;
}

.share-meta {
  margin-bottom: 5px;
  color: var(--color-primary);
  font-size: 0.78rem;
  font-weight: 800;
}

.share-item p {
  margin: 0;
  line-height: 1.45;
}

/* Bottom tab bar */
.app-tab-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  flex-shrink: 0;
  background: #fff;
  border-top: 1px solid #e0e0e0;
  padding-bottom: max(0px, env(safe-area-inset-bottom, 0px));
}

.app-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 8px;
  color: #667;
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
  border-top: 3px solid transparent;
}

.app-tab--active {
  color: var(--color-primary);
  border-top-color: var(--color-accent);
  background: #f2f9fa;
}

/* YouTube testimony */
.testimony-card {
  margin-top: 16px;
}

.youtube-video-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 0 auto 12px;
  overflow: hidden;
  border-radius: 14px;
  background: #111;
}

.youtube-video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.youtube-video-frame video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #000;
}

.youtube-play-button {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 100%;
  border: none;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.15) 50%, rgba(0, 0, 0, 0.35));
  color: #fff;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}

.youtube-play-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  font-size: 1.4rem;
}

/* Day navigation */
.day-nav {
  display: flex;
  align-items: stretch;
  gap: 8px;
  padding: 10px 14px 8px;
  background: #fff;
  border-top: 1px solid #e0e0e0;
  flex-shrink: 0;
}

.day-nav-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 10px;
  background: #fff;
  color: var(--color-primary);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.day-nav-btn:hover:not(:disabled),
.day-nav-btn:focus-visible:not(:disabled) {
  background: #e8f4f5;
  border-color: var(--color-primary);
  outline: none;
}

.day-nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.day-nav-btn--today {
  flex: 0 0 auto;
  min-width: 72px;
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.day-nav-btn--today:hover {
  background: #0a4a50;
}

.day-nav-arrow {
  font-size: 1.1em;
}

/* Font size levels */
html[data-text-size="small"] { --font-base: 14px; }
html[data-text-size="medium"] { --font-base: 16px; }
html[data-text-size="large"] { --font-base: 19px; }
html[data-text-size="xlarge"] { --font-base: 23px; }

@media (min-width: 481px) {
  body {
    background: #e0e0e0;
  }

  .app {
    margin-top: 24px;
    margin-bottom: 24px;
    min-height: calc(100dvh - 48px);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  }
}
