/*
 * Mobile comfort layer for the participant app (/) and the operator console.
 * Loaded after every other stylesheet. Desktop widths are unchanged.
 * Targets: 16px inputs (no iOS focus zoom), 44px+ tap targets, 12px+ supporting text,
 * consistent 16px side gutters and safe-area aware edges.
 */
@media (max-width: 760px) {
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  /* ---------- Form controls ---------- */
  input, select, textarea { font-size: 16px !important; }
  input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="file"]):not([type="range"]), select { min-height: 44px; }
  .form-input { padding: 12px 14px; }
  .form-textarea { padding: 12px 14px; line-height: 1.75; }
  .grant-input, .check-bar input[type="number"] { min-height: 44px; padding: 10px 12px; }
  input[type="checkbox"]:not(.toggle-switch > input), input[type="radio"] { width: 22px; height: 22px; flex: 0 0 auto; accent-color: var(--gb); }
  label:has(> input[type="checkbox"]):not(.toggle-switch), label:has(> input[type="radio"]) { min-height: 44px; }
  .toggle-switch::after { content: ""; position: absolute; inset: -8px -6px; }
  input[type="file"] { min-height: 48px; }
  input[type="file"]::file-selector-button { min-height: 36px; }

  /* ---------- Buttons and links ---------- */
  .btn-primary, .btn-secondary { min-height: 48px; font-size: 15px; }
  .btn-action { min-height: 48px; }
  .btn-grant, .btn-ban, .btn-reduce { min-height: 44px; padding: 10px 14px; font-size: 14px; }
  .chip { min-height: 44px; padding: 10px 14px; font-size: 14px; }
  .btn-text:not([hidden]) { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; font-size: 14px; }
  .offer-link { display: flex; align-items: center; justify-content: center; min-height: 48px; font-size: 14px; }
  details > summary { padding-top: 12px; padding-bottom: 12px; }
  .post-actions, .react-row { gap: 4px 12px; }
  .board-chips { gap: 8px; }

  /* Inline styles generated by app.js: lift 10-11px helper text to 12px on phones. */
  #screen-seminar [style*="font-size:10px"], #screen-seminar [style*="font-size:11px"],
  #screen-admin [style*="font-size:10px"], #screen-admin [style*="font-size:11px"],
  .profile-modal [style*="font-size:10px"], .profile-modal [style*="font-size:11px"],
  .modal-box [style*="font-size:10px"], .modal-box [style*="font-size:11px"] { font-size: 12px !important; }

  /* ---------- Text sizes ---------- */
  .header-badge { font-size: 14px; }
  .post-name { font-size: 15px; }
  .post-time, .comment-time { font-size: 12px; }
  .post-tag { font-size: 12px; padding: 2px 10px; }
  .post-text { font-size: 15px; line-height: 1.85; }
  .post-link { font-size: 14px; padding: 6px 0; }
  .post-badge, .reaction-badge { font-size: 13px; }
  .comment-row { font-size: 14px; }
  .kunio-reply { font-size: 14px; padding: 10px 12px; }
  .kunio-reply .tag { font-size: 13px; }
  .kunio-reply .when { font-size: 12px; }
  .profile-operator-badge { font-size: 12px; padding: 1px 7px; }
  .notice-title { font-size: 15px; }
  .notice-body { font-size: 14px; }
  .intro-label { font-size: 14px; }
  .intro-label .req { font-size: 12px; }
  .intro-q { font-size: 13px; }
  .intro-chip { font-size: 13px; }
  .intro-radio label, .intro-checks label { min-height: 44px; font-size: 15px; }
  .intro-cta .big { font-size: 18px; }
  .intro-cta .sub { font-size: 14px; }
  .name-hint { font-size: 14px; }
  .offer-title { font-size: 17px; }
  .offer-count { font-size: 13px; }
  .offer-timer { padding: 12px 10px; }
  .offer-timer .lbl { font-size: 13px; }
  .offer-calc .row { font-size: 14px; }
  .bank-box { font-size: 14px; }
  .warn-box { font-size: 13px; }
  .join-course { min-height: 52px; font-size: 15px; }
  .join-course input { width: 22px; height: 22px; }
  .rank-row { min-height: 52px; }
  .rank-name { font-size: 15px; }
  .rank-coin { font-size: 19px; }
  .rank-coin-unit { font-size: 12px; }
  .badge-banned { font-size: 12px; }
  .loading { font-size: 14px; }
  .toast { font-size: 14px; top: calc(12px + env(safe-area-inset-top)); }
  .settings-label, .field-label { font-size: 13px; }
  .profile-photo-note, .profile-photo-caption, .profile-photo-status { font-size: 13px; }
  .profile-photo-help { font-size: 12px; }
  .profile-photo-panel .profile-photo-label { font-size: 14px; }
  .profile-photo-panel .profile-photo-actions button { font-size: 14px; }
  .profile-avatar-comment { width: 28px; height: 28px; font-size: 12px; }

  /* ---------- Modals ---------- */
  .modal-overlay { padding: 16px; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .modal-box { padding: 24px 20px; max-height: calc(100dvh - 32px); overflow-y: auto; }
  .profile-head { padding: calc(8px + env(safe-area-inset-top)) 16px 8px; min-height: 60px; }
  .profile-body { padding: 16px 16px calc(28px + env(safe-area-inset-bottom)); }

  /* ---------- Operator console ---------- */
  .operator-console-nav { flex-wrap: wrap; gap: 0 16px; padding: 2px 16px; font-size: 14px; }
  .operator-console-nav strong { font-size: 13px; }
  .operator-console-nav a { display: inline-flex; align-items: center; min-height: 44px; }
  #screen-admin .header { position: relative; top: auto; height: auto; min-height: 64px; padding: 10px 16px; gap: 4px 10px; flex-wrap: wrap; }
  #screen-admin .header .header-title { white-space: nowrap; }
  #screen-admin .header-left { min-height: 44px; }
  #screen-admin .operator-profile-heading { gap: 8px; min-width: 0; margin-left: auto; }
  #screen-admin #operator-profile-name { font-size: 13px; max-width: 120px; }
  #screen-admin .content { padding: 16px 16px 40px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  #screen-admin .tabbar { top: env(safe-area-inset-top, 0px); gap: 8px; padding: 4px; margin-bottom: 18px; }
  #screen-admin .tab-btn { min-height: 48px; padding: 8px 2px; font-size: 13px; line-height: 1.35; }
  #screen-admin .card { padding: 20px 16px; margin-bottom: 16px; }
  #screen-admin .section-title { font-size: 14px; margin-bottom: 14px; }
  #screen-admin .code-card { padding: 14px; }
  .user-row { padding: 14px 0; }
  .user-info-name { font-size: 15px; }
  .user-info-email { font-size: 12px; }
  .user-coins-badge { font-size: 16px; }
  .user-check { width: 22px; height: 22px; }
  .user-row-actions { flex-wrap: wrap; justify-content: flex-start; gap: 8px; margin-top: 10px; }
  .user-row-actions .grant-input { flex: 0 0 92px; width: 92px; }
  .user-row-actions > button { flex: 1 1 auto; }
  .user-row > .grant-comment { min-height: 44px; padding: 10px 12px !important; margin-top: 10px !important; }
  .user-row > .user-row-actions { margin-top: 10px !important; }
  .user-row > button:not(.btn-text) { min-height: 44px; margin-top: 10px !important; font-size: 13px !important; }
  .user-row > .reset-link-action { margin-top: 8px; }
  #admin-ranking .user-row [onclick^="openProfile"] { display: flex; flex-direction: column; justify-content: center; min-height: 44px; }
  .post-head .post-name { min-height: 44px; padding-top: 9px; padding-bottom: 9px; }
  /* Inline 4-6px gaps between generated operator buttons become 8px on phones. */
  #screen-admin [style*="gap:4px"], #screen-admin [style*="gap:6px"] { gap: 8px !important; }
  #sort-btn, #sort-btn + button { min-height: 44px; font-size: 14px !important; }
  #bulk-checklist > label { min-height: 44px; font-size: 14px !important; }
  #perk-assign-pick > label { margin-bottom: 8px !important; }
  #admin-join-people > label { min-height: 48px; }
  .check-bar { gap: 8px; padding: 12px; }
  .check-bar-label { font-size: 13px; }
  .settings-grid { gap: 12px; }
  .settings-color-controls { gap: 10px; }
  .settings-color-controls input[type="color"] { width: 52px; height: 48px; }
  .settings-color-controls .form-input { width: 140px; min-height: 48px; }
}

@media (max-width: 374px) {
  #screen-admin .tabbar { gap: 4px; }
}
@media (max-width: 360px) {
  #screen-admin .tabbar { gap: 4px; padding: 3px; }
  #screen-admin .tab-btn { font-size: 12px; padding: 8px 1px; letter-spacing: -.2px; }
}
@media (max-width: 430px) {
  #bulk-checklist { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

/* ---------- Participant sign-in page (single column below 700px) ---------- */
@media (max-width: 700px) {
  .site-nav { height: 68px; padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); }
  .wordmark { min-height: 44px; }
  .wordmark small { font-size: 12px; letter-spacing: 1.4px; }
  #screen-login.active { gap: 24px; padding: 92px 16px 24px; }
  .story-kicker { font-size: 12px; letter-spacing: 2px; }
  .auth-story h1 { font-size: 30px; }
  .story-copy { font-size: 15px; line-height: 2; }
  .story-demo { min-height: 44px; margin-top: 6px; font-size: 14px; }
  #screen-login .coin-disclaimer { font-size: 13px; }
  .auth-panel { padding: 24px 20px 22px; border-radius: 16px; }
  .auth-panel h2 { font-size: 20px; }
  .auth-panel-sub { font-size: 14px; }
  .auth-tabs { margin-bottom: 18px; }
  .auth-tab { min-height: 44px; font-size: 15px; }
  .auth-help { font-size: 14px; min-height: 0; }
  .field-label { font-size: 14px; }
  .auth-panel .form-input { height: 52px; font-size: 16px; margin-bottom: 18px; }
  .password-field .form-input { padding-right: 56px; }
  .password-show { top: 4px; right: 4px; width: 44px; height: 44px; padding: 0; display: flex; align-items: center; justify-content: center; }
  .password-show svg { width: 20px; height: 20px; }
  .auth-panel .btn-primary { min-height: 52px; font-size: 16px; }
  .auth-panel .btn-text:not([hidden]) { display: flex; justify-content: center; min-height: 44px; font-size: 14px; }
  .auth-panel .password-reset-help { font-size: 13px; }
  .auth-panel .auth-msg { font-size: 14px; }
  .auth-privacy { font-size: 13px; }
  .auth-privacy svg { width: 14px; height: 14px; }
  .site-footer { align-items: center; padding: 4px 16px calc(12px + env(safe-area-inset-bottom)); font-size: 12px; }
  .site-footer a { display: inline-flex; align-items: center; min-height: 44px; font-size: 13px; }
  #screen-name, #screen-expired, #screen-banned { padding: 24px 16px; }
  .end-sub { font-size: 14px; }
}

/* Submission moderation: accessible tap areas at every viewport width. */
.submission-toolbar[hidden] { display: none; }
.submission-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin: 8px 0 16px; background: var(--d3); }
.submission-toolbar p { flex-basis: 100%; margin: 0; color: var(--dim); font-size: 12px; line-height: 1.7; }
.submission-toolbar .btn-ban { min-height: 44px; white-space: normal; }
.submission-select { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 10px; font-size: 14px; line-height: 1.6; cursor: pointer; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; }
.submission-select input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--gb); flex: 0 0 auto; }
.submission-delete-one { min-height: 44px; margin-top: 12px; }
#submission-selected-count { font-size: 13px; }
.participant-answer-label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 700; }
.participant-answer-help { margin: 0 0 12px; font-size: 13px; color: var(--gold); line-height: 1.7; }
@media (max-width: 560px) {
  .submission-toolbar > .submission-select, .submission-toolbar > .btn-ban { width: 100%; box-sizing: border-box; }
}
