/* ===== Root & Defaults ===== */
:root {
  color-scheme: light dark;
}

* {
  -webkit-tap-highlight-color: transparent; /* ตัด overlay เวลากดปุ่มมือถือ */
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  font-family: 'Noto Sans Thai', sans-serif;
  background: #fafafa;
  color: #222;
  margin: 0;
  padding: 20px;
}

/* ===== Layout ===== */
.container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100%;
}

.card {
  background: #fff;
  color: #222;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 0 10px rgba(0,0,0,.1);
  max-width: 420px;
  width: 100%;
  text-align: center;
}

.avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 12px;
  border: 3px solid #7a1e2e;
}

.tagline {
  font-weight: 500;
  margin: 0 0 16px;
  color: inherit;
}

/* ===== Links & Buttons (normalize) ===== */
.links {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

/* ทำให้ <a class="link"> และ <button class="link"> ดูเหมือนกัน */
.link,
.button {
  display: block;
  width: 100%;
  padding: 12px 16px;
  background: #f0f0f0;
  color: #222;
  border-radius: 8px;
  text-decoration: none;
  text-align: center;
  font-weight: 600;
  font-size: 16px;
  line-height: 1.2;
  cursor: pointer;
  transition: background .2s, transform .1s, box-shadow .2s;
}

button.link,
.button {
  border: 0;
  appearance: none;
  background: #f0f0f0;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
}

.link:hover,
.button:hover {
  background: #e0e0e0;
}

.link:active,
.button:active {
  transform: scale(0.98);
  box-shadow: 0 0 0 3px rgba(0,0,0,.05) inset;
}

.button.primary {
  background: #7a1e2e;
  color: #fff;
}

/* ===== Modal (dialog) ===== */
dialog {
  border: none;
  border-radius: 14px;
  padding: 20px;
  max-width: 420px;
  width: min(92vw, 420px);
  background: #ffffff;
  color: #222;
  box-shadow: 0 20px 60px rgba(0,0,0,.16), 0 8px 24px rgba(0,0,0,.12);
}

dialog::backdrop {
  background: rgba(0,0,0,.40);
  backdrop-filter: blur(2px);
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.button {
  display: inline-block;
}

.hint {
  font-size: 13px;
  color: #666;
  margin-top: 12px;
  text-align: left;
}

/* ===== Footer ===== */
.footer {
  margin-top: 20px;
  font-size: 13px;
  color: #777;
}

/* ===== Dark Mode ===== */
@media (prefers-color-scheme: dark) {
  body {
    background: #121212;
    color: #eee;
  }

  .card {
    background: #1e1e1e;
    color: #eee;
    box-shadow: 0 0 10px rgba(0,0,0,.6);
  }

  .tagline {
    color: #ccc;
  }

  /* ✅ ปุ่มใน dark mode */
  .link,
  .button,
  button.link {
    background: #2a2a2a !important;
    color: #eee !important;
    border: none;
  }

  .link:hover,
  .button:hover,
  button.link:hover {
    background: #333 !important;
  }

  .button.primary {
    background: #bb2649 !important; /* maroon */
    color: #fff !important;
  }

  .button.primary:hover {
    background: #d13b60 !important;
  }

  /* ✅ โมดัลให้เด่นขึ้น */
  dialog {
    background: #242424;
    color: #f1f1f1;
    border: 1px solid #3a3a3a;
    box-shadow: 0 28px 80px rgba(0,0,0,.55), 0 12px 32px rgba(0,0,0,.45);
  }

  dialog::backdrop {
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(3px);
  }

  .hint {
    color: #aaa;
  }

  .footer {
    color: #999;
  }
}

/* ===== Responsive ===== */
@media (min-width: 480px) {
  .card { padding: 24px; }
  .link, .button { padding: 14px 18px; }
}

@media (min-width: 768px) {
  .card { padding: 28px; }
  .link, .button { font-size: 17px; }
}
