/* Hộp quà bí mật: những phần mà class Tailwind sẽ phải lặp lại (tab, ô nhập, nút chọn, thẻ quà, hộp mở quà).
   Cùng bảng màu với shared/js/tailwind-theme.js. */

/* Trang không tải shared/css/app.css, và rule [hidden] của chính Tailwind thua một utility display (flex,
   grid) trên cùng element: hidden phải thắng ở mọi nơi, như app.css làm. */
[hidden] { display: none !important; }

/* Tab của trang: Quà của tôi, Quà đã gửi, Gửi quà. Điện thoại hẹp: chữ nhỏ lại để cả 3 tab nằm trên 1 hàng. */
.hq-tabs { display: flex; gap: 4px; border-bottom: 1px solid #e8ded2; }
.hq-tabs a {
  padding: 10px 12px; margin-bottom: -1px; border-bottom: 2px solid transparent;
  font-size: 0.9rem; font-weight: 600; color: #65584e; white-space: nowrap;
}
.hq-tabs a:hover { color: #7a361d; }
.hq-tabs a[aria-current="page"] { color: #7a361d; border-color: #9c4728; }
@media (max-width: 399px) { .hq-tabs a { padding: 10px 6px; font-size: 0.82rem; } }

/* Nút. */
.hq-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 18px;
  border: 1px solid #d7c8b7; border-radius: 999px; background: #faf6f0; color: #2b231e;
  font-size: 0.9rem; font-weight: 600; transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.hq-btn:hover:not(:disabled) { border-color: #9c4728; }
.hq-btn:disabled { opacity: 0.55; cursor: default; }
.hq-btn.is-primary { border-color: #9c4728; background: #9c4728; color: #fff; box-shadow: 0 8px 18px -12px rgb(156 71 40 / 0.8); }
.hq-btn.is-primary:hover:not(:disabled) { background: #7a361d; border-color: #7a361d; }
.hq-btn.is-danger { border-color: #e2b4a3; background: #fff; color: #9c2f1d; }
.hq-btn.is-danger:hover:not(:disabled) { border-color: #9c2f1d; }
.hq-btn.is-small { min-height: 36px; padding: 6px 14px; font-size: 0.82rem; }
.hq-icon-btn {
  display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 999px; border: 1px solid #d7c8b7; background: #faf6f0; font-size: 1.1rem; line-height: 1; color: #2b231e;
}
.hq-icon-btn:hover { border-color: #9c4728; }

/* Form. */
.hq-panel { border: 1px solid #e8ded2; border-radius: 28px; background: rgb(255 255 255 / 0.7); padding: 20px; }
@media (min-width: 640px) { .hq-panel { padding: 28px; } }
.hq-label { display: flex; flex-direction: column; gap: 6px; min-width: 0; font-size: 0.875rem; font-weight: 500; color: #2b231e; }
.hq-note { font-size: 0.78rem; font-weight: 400; line-height: 1.5; color: #71645a; }
.hq-warn { font-size: 0.82rem; line-height: 1.5; color: #8a4b00; }
.hq-field {
  width: 100%; min-width: 0; min-height: 44px; padding: 10px 14px;
  border: 1px solid #d7c8b7; border-radius: 14px; background: #faf6f0;
  font-size: 0.95rem; font-weight: 400; color: #2b231e;
}
.hq-field::placeholder { color: #71645a; }
.hq-field:focus { outline: none; border-color: #9c4728; box-shadow: 0 0 0 3px rgb(156 71 40 / 0.2); }
.hq-field:disabled { opacity: 0.7; }
.hq-file { max-width: 100%; font-size: 0.85rem; font-weight: 400; }
.hq-preview { display: block; max-width: 100%; max-height: 260px; border-radius: 16px; object-fit: contain; background: #f3ece2; }

/* Nút chọn loại quà và cách mở: chia đều hàng, xuống dòng khi hẹp. */
.hq-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.hq-choices button {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 8px 6px;
  border: 2px solid #e8ded2; border-radius: 16px; background: #faf6f0;
  font-size: 0.88rem; font-weight: 600; line-height: 1.25; color: #65584e; text-align: center;
}
.hq-choices button:hover:not(:disabled) { border-color: #d7c8b7; }
.hq-choices button[aria-pressed="true"] { border-color: #9c4728; background: #f6e6da; color: #2b231e; }
.hq-choices button:disabled { opacity: 0.45; cursor: default; }
@media (max-width: 399px) { .hq-choices button { flex-direction: column; gap: 2px; font-size: 0.8rem; } }

/* Thẻ quà trong "Quà của tôi": 1 cột trên điện thoại, 2 cột khi rộng. */
.hq-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 8px; }
@media (min-width: 640px) { .hq-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.hq-card {
  display: flex; gap: 14px; width: 100%; min-width: 0; padding: 16px; text-align: left;
  border: 1px solid #e8ded2; border-radius: 22px; background: #fff;
  box-shadow: 0 14px 30px -26px rgb(122 54 29 / 0.6); transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.hq-card:hover, .hq-card:focus-visible { border-color: #d7c8b7; box-shadow: 0 18px 34px -24px rgb(122 54 29 / 0.6); }
.hq-card.is-closed { background: linear-gradient(135deg, #fff 0%, #fff6ec 100%); border-color: #f0d2b8; }
.hq-card.is-ready { border-color: #9c4728; box-shadow: 0 0 0 3px rgb(242 180 90 / 0.45); }
.hq-card-icon {
  display: grid; place-items: center; width: 48px; height: 48px; flex-shrink: 0; border-radius: 16px;
  background: #efe2d3; font-size: 1.5rem;
}
.is-closed .hq-card-icon { background: linear-gradient(135deg, #f2c27a, #e2683c); }
.hq-card-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.hq-card-from { font-size: 0.8rem; font-weight: 600; color: #7a361d; overflow-wrap: anywhere; }
.hq-card-title { font-family: "Playfair Display", Georgia, serif; font-size: 1.15rem; line-height: 1.35; overflow-wrap: anywhere; }
.hq-card-line { margin-top: 4px; font-size: 0.85rem; line-height: 1.45; color: #65584e; overflow-wrap: anywhere; }
.hq-card-line.is-due, .hq-card-line.is-ready { color: #7a361d; font-weight: 600; }
.hq-pill {
  display: inline-flex; align-self: flex-start; align-items: center; gap: 4px; margin-top: 8px; padding: 4px 12px;
  border-radius: 999px; background: #9c4728; color: #fff; font-size: 0.8rem; font-weight: 600;
}
.hq-time { font-variant-numeric: tabular-nums; }

/* Một dòng của "Quà đã gửi". */
.hq-sent-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px;
  border: 1px solid #e8ded2; border-radius: 22px; background: #fff;
}
.hq-sent-open { display: flex; gap: 12px; align-items: center; min-width: 0; flex: 1 1 16rem; padding: 4px; border-radius: 14px; text-align: left; }
.hq-sent-open:hover, .hq-sent-open:focus-visible { background: #faf6f0; }
.hq-sent-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
/* Cách khoá và trạng thái: trạng thái xuống dòng cả khối khi hẹp, không gãy giữa chừng. */
.hq-sent-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 4px; font-size: 0.85rem; color: #65584e; }
.hq-tag { display: inline-block; border-radius: 10px; padding: 2px 8px; font-size: 0.75rem; font-weight: 600; line-height: 1.45; background: #efe2d3; color: #2b231e; }
.hq-tag.is-open { background: #e3f1e7; color: #245c38; }

/* Hộp mở quà. */
.hq-dialog {
  width: min(34rem, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto;
  border: 0; border-radius: 28px; padding: 24px; background: #faf6f0; color: #2b231e;
  box-shadow: 0 30px 60px -20px rgb(43 35 30 / 0.45);
}
.hq-dialog::backdrop { background: rgb(36 28 23 / 0.45); backdrop-filter: blur(2px); }
@media (max-width: 639px) {
  /* Điện thoại: một sheet trượt từ dưới lên. */
  .hq-dialog { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: 28px 28px 0 0; padding-bottom: max(24px, env(safe-area-inset-bottom)); }
}
.hq-countdown { font-family: "Playfair Display", Georgia, serif; font-size: 2rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.hq-letter {
  white-space: pre-wrap; overflow-wrap: anywhere; padding: 18px; border-radius: 18px;
  background: #fff; border: 1px solid #e8ded2; font-size: 0.98rem; line-height: 1.7;
}
.hq-photo { display: block; width: 100%; height: auto; max-height: 70vh; object-fit: contain; border-radius: 18px; background: #f3ece2; }
.hq-ticket {
  position: relative; padding: 20px; border-radius: 20px; border: 2px dashed #e2683c;
  background: linear-gradient(135deg, #fff1e7 0%, #ffe4d4 100%);
}
.hq-ticket-name { font-family: "Playfair Display", Georgia, serif; font-size: 1.4rem; line-height: 1.3; overflow-wrap: anywhere; }
.hq-ticket-text { margin-top: 6px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.92rem; line-height: 1.6; }
.hq-opening { animation: hq-open 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
@keyframes hq-open { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .hq-opening { animation: none; } }

/* "Mất kết nối, đang thử lại…" (shared/js/game/connection.js): trang không tải shared/css/app.css. */
.connection-line {
  position: fixed; top: calc(env(safe-area-inset-top) + 8px); left: 50%; z-index: 60;
  width: max-content; max-width: calc(100% - 32px); padding: 6px 14px; border-radius: 999px;
  background: #ffe2a8; color: #2b231e; border: 1px solid #f2b45a; font-size: 14px; font-weight: 600; text-align: center;
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.12); transform: translateX(-50%); pointer-events: none;
}
