/* ========================== RESET & GLOBAL ========================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  overflow-x: hidden;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  background: #ebebeb;
  color: #222;
  line-height: 1.5;
}

/* ========================== NAVIGATION ========================== */

nav {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;

  gap: 12px;

  padding: 16px;
  border-bottom: 1px solid #ddd;
}

nav a {
  text-decoration: none;
  color: #333;
  font-weight: 600;

  font-size: clamp(14px, 3vw, 22px);
}

nav a:hover {
  opacity: 0.7;
}

/* ========================== BANNER ========================== */

.banner-link {
  display: flex;
  justify-content: center;
  width: 100%;
  overflow: hidden;
}

.banner {
  width: 100%;
  height: auto;
  display: block;
}

/* ========================== READER ========================== */

.reader-container {
  width: 100%;
  max-width: 1400px;

  margin: 0 auto;

  padding: 12px;

  display: flex;
  flex-direction: column;
  align-items: center;
}

.reader {
  width: 100%;

  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ========================== NAVIGATION BUTTONS ========================== */

.top-navigation,
.bottom-navigation {
  width: 100%;

  display: flex;
  justify-content: center;
  flex-wrap: wrap;

  gap: 8px;

  margin: 10px 0;
}

.navigation button {
  padding: 10px 14px;

  border: none;
  border-radius: 8px;

  background: #222;
  color: white;

  font-size: clamp(12px, 2vw, 14px);

  cursor: pointer;

  transition: 0.2s ease;
}

.navigation button:hover {
  background: #444;
}

/* ========================== PAGE SELECTOR ========================== */

.page-selector {
  margin: 12px 0;

  display: flex;
  align-items: center;
  gap: 10px;

  flex-wrap: wrap;
}

.page-selector label {
  font-weight: bold;
}

.page-selector select {
  padding: 8px 10px;
  font-size: 14px;
}

/* ========================== READER IMAGE ========================== */

#reader-image {
  width: 100%;
  max-width: 1240px;

  height: auto;

  display: block;

  border-radius: 8px;

  object-fit: contain;

  transition:
    opacity 0.15s ease,
    transform 0.25s ease;
}

/* ========================== ZOOM CONTROL ========================== */

.zoom-control {
  position: fixed;

  bottom: 20px;
  right: 15px;

  display: flex;
  flex-direction: column;
  align-items: center;

  gap: 6px;

  z-index: 1200;
}

.zoom-label {
  font-size: 12px;
  font-weight: bold;

  background: rgba(0, 0, 0, 0.75);
  color: #fff;

  padding: 4px 8px;

  border-radius: 6px;
}

#zoom-toggle {
  width: 52px;
  height: 52px;

  border-radius: 50%;
  border: none;

  background: #222;
  color: #fff;

  font-size: 14px;
  font-weight: bold;

  cursor: pointer;

  box-shadow: 0 4px 10px rgba(0,0,0,0.3);

  transition: 0.2s ease;
}

#zoom-toggle:hover {
  transform: scale(1.05);
}

/* ========================== THANK YOU SECTION ========================== */

.thankyou-section {
  width: 100%;

  padding: 60px 12px;

  display: flex;
  flex-direction: column;
  align-items: center;
}

.thankyou-title {
  text-align: center;

  font-size: clamp(28px, 5vw, 48px);

  font-weight: 800;
  letter-spacing: 1px;

  margin-bottom: 30px;
}

/* ========================== MESSAGE LIST ========================== */

.message-list-wrapper {
  width: 100%;
  max-width: 1000px;

  height: 500px;

  display: flex;
  flex-direction: column;

  background: rgba(255,255,255,0.95);

  border-radius: 12px;

  box-shadow: 0 10px 30px rgba(0,0,0,0.2);

  overflow: hidden;
}

/* ========================== HEADER + ROWS ========================== */

.message-list-header,
.message-row {
  display: grid;

  grid-template-columns:
    50px
    140px
    1fr;

  gap: 10px;

  align-items: start;
}

.message-list-header {
  background: #222;
  color: #fff;

  font-weight: bold;

  padding: 14px;
}

.message-list-body {
  flex: 1;
  overflow-y: auto;
}

.message-row {
  padding: 14px;

  border-bottom: 1px solid #ddd;

  transition: background 0.2s ease;
}

.message-row:nth-child(even) {
  background: #f5f5f5;
}

.message-row:hover {
  background: #ebebeb;
}

.message-cell {
  word-break: break-word;
  font-size: 14px;
}

/* ========================== FOOTER ========================== */

footer {
  text-align: center;

  padding: 24px;

  border-top: 1px solid #ddd;

  font-size: 14px;
}

/* ========================== MOBILE ========================== */

@media (max-width: 768px) {

  .navigation button {
    flex: 1 1 calc(50% - 8px);
    min-width: 140px;
  }

  .message-list-header,
  .message-row {
    grid-template-columns:
      35px
      90px
      1fr;

    font-size: 12px;
  }

  .message-list-wrapper {
    height: 420px;
  }

  .zoom-control {
    bottom: 15px;
    right: 10px;
  }
}

/* ========================== EXTRA SMALL PHONES ========================== */

@media (max-width: 480px) {

  nav {
    gap: 8px;
  }

  .navigation button {
    width: 100%;
    min-width: unset;

    font-size: 12px;
    padding: 10px;
  }

  .page-selector {
    flex-direction: column;
    align-items: stretch;

    width: 100%;
  }

  .page-selector select {
    width: 100%;
  }

  .message-list-header,
  .message-row {
    grid-template-columns:
      30px
      80px
      1fr;

    padding: 10px;
  }

  .message-cell {
    font-size: 12px;
  }

  .thankyou-title {
    line-height: 1.2;
  }
}