*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: sans-serif;
  font-size: 15px;
  color: #222;
  background: #fff;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

#mobile-app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* ── Header ── */

#mobile-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid #ddd;
  background: #fafafa;
}

#mobile-logo {
  height: 28px;
  width: auto;
  flex-shrink: 0;
}

#mobile-title {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
}

/* ── Content ── */

#mobile-content {
  flex: 1;
  padding: 16px;
}

/* ── Navigation bar ── */

#mobile-nav {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #ddd;
  background: #fafafa;
  position: sticky;
  bottom: 0;
}

#mobile-nav:empty {
  display: none;
}

.mobile-nav-btn {
  flex: 1;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 500;
  border: 1px solid #ccc;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  text-align: center;
}

.mobile-nav-btn:active {
  background: #f0f0f0;
}

/* ── Home screen ── */

.mobile-home {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 24px;
}

.mobile-home-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.mobile-home-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px 14px 20px;
  border: 2px solid #333;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  text-align: center;
}

.mobile-home-card:active {
  background: #f0f0f0;
}

.mobile-home-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #f0f0f0;
  color: #333;
  flex-shrink: 0;
}

.mobile-home-card-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  color: #111;
}

.mobile-home-card-desc {
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  color: #666;
}

.mobile-big-btn {
  width: 100%;
  padding: 18px 16px;
  font-size: 16px;
  font-weight: 600;
  border: 2px solid #333;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  text-align: center;
}

.mobile-big-btn:active {
  background: #f0f0f0;
}

.mobile-full-table-btn {
  width: 100%;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid #bbb;
  border-radius: 8px;
  background: #f5f5f5;
  color: #555;
  cursor: pointer;
  text-align: center;
}

.mobile-full-table-btn:active {
  background: #e8e8e8;
}

/* ── Screen titles ── */

.mobile-screen-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

.mobile-subtitle {
  font-size: 14px;
  color: #666;
  margin-bottom: 12px;
}

/* ── List items ── */

.mobile-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 8px;
}

.mobile-list-item {
  display: block;
  width: 100%;
  padding: 14px 12px;
  font-size: 15px;
  text-align: left;
  border: none;
  border-bottom: 1px solid #eee;
  background: #fff;
  cursor: pointer;
  line-height: 1.3;
}

.mobile-list-item:active {
  background: #f0f4ff;
}

/* ── Zone select list ── */

.mobile-zone-select-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.mobile-zone-select-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  text-align: left;
}

.mobile-zone-select-item:active {
  background: #f5f5f5;
}

.mobile-zone-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 4px;
  flex-shrink: 0;
  text-align: center;
}

.mobile-zone-select-name {
  font-size: 13px;
  color: #444;
  line-height: 1.3;
}

/* ── Classification result screen ── */

.mobile-result-header {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #ddd;
}

.mobile-result-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 6px;
  line-height: 1.3;
}

.mobile-result-def {
  font-size: 13px;
  color: #444;
  line-height: 1.45;
  margin-bottom: 8px;
}

/* ── Zone cards (transposed results) ── */

.mobile-zone-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mobile-zone-card {
  display: flex;
  align-items: center;
  gap: 0;
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  cursor: pointer;
  text-align: left;
}

.mobile-zone-card:active {
  background: #f5f5f5;
}

.mobile-zone-card-label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  padding: 8px 10px;
  min-width: 0;
}

.mobile-zone-card-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  padding: 3px 6px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 3px;
  flex-shrink: 0;
  text-align: center;
}

.mobile-zone-card-name {
  font-size: 12px;
  color: #555;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-zone-card-value {
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  border-left: 1px solid #ddd;
  min-width: 60px;
  flex-shrink: 0;
}

/* ── Zone result screen ── */

.mobile-zone-header {
  padding: 14px 16px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.mobile-zone-header h2 {
  font-size: 20px;
  font-weight: 700;
}

.mobile-zone-header div {
  font-size: 13px;
  opacity: 0.85;
  margin-top: 2px;
}

.mobile-zone-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.mobile-zone-table th,
.mobile-zone-table td {
  padding: 8px 10px;
  border: 1px solid #ddd;
  font-size: 13px;
  text-align: left;
  vertical-align: top;
}

.mobile-zone-table th {
  font-weight: 600;
  font-size: 12px;
  position: sticky;
  top: 0;
  z-index: 1;
}

.mobile-zone-table th:first-child {
  background: #f0f0f0;
}

.mobile-zone-table td:first-child {
  line-height: 1.3;
}

.mobile-zone-table td:last-child {
  text-align: center;
  font-weight: 600;
  cursor: pointer;
}

.mobile-zone-table tbody tr:active td {
  background: #f0f4ff;
}

/* ── Overlay / popup ── */

.mobile-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.mobile-overlay[hidden] {
  display: none;
}

.mobile-popup {
  background: #fff;
  border-radius: 16px 16px 0 0;
  padding: 20px 16px 24px;
  width: 100%;
  max-height: 85dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mobile-popup-title {
  font-size: 17px;
  font-weight: 700;
  color: #111;
}

.mobile-popup-text {
  font-size: 14px;
  color: #444;
  line-height: 1.45;
}

.mobile-popup-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #333;
}

.mobile-popup-row svg {
  flex-shrink: 0;
  color: #666;
}

.mobile-popup-link,
.mobile-popup-link-inline {
  color: #1a5fa8;
  text-decoration: none;
  font-size: 14px;
}

.mobile-popup-link:active,
.mobile-popup-link-inline:active {
  text-decoration: underline;
}

.mobile-popup-footnote {
  font-size: 13px;
  color: #555;
  padding-top: 4px;
  border-top: 1px solid #eee;
}

.mobile-popup-photo {
  display: block;
  max-width: 100%;
  max-height: 200px;
  border-radius: 6px;
  margin-top: 4px;
  object-fit: cover;
}

.mobile-popup-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.mobile-popup-btn {
  flex: 1;
  padding: 14px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
}

.mobile-popup-cancel {
  background: #f0f0f0;
  color: #333;
}

.mobile-popup-cancel:active {
  background: #e0e0e0;
}

.mobile-popup-confirm {
  background: #1a5fa8;
  color: #fff;
}

.mobile-popup-confirm:active {
  background: #15508e;
}

.mobile-popup-close-only {
  width: 100%;
  margin-top: 8px;
}

/* ── Search input ── */

.mobile-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  background: #fff;
  margin-bottom: 8px;
}

.mobile-search-icon {
  flex-shrink: 0;
  color: #999;
  line-height: 0;
}

.mobile-search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 15px;
  background: transparent;
  color: #222;
}

.mobile-search-input::placeholder {
  color: #aaa;
}

.mobile-search-empty {
  padding: 24px 12px;
  text-align: center;
  font-size: 14px;
  color: #999;
}

/* ── Classification detail screen ── */

.mobile-detail-def {
  font-size: 14px;
  color: #444;
  line-height: 1.5;
  margin-top: 8px;
}

.mobile-detail-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 14px;
  color: #1a5fa8;
  text-decoration: none;
}

.mobile-detail-link:active {
  text-decoration: underline;
}

.mobile-detail-photo {
  display: block;
  max-width: 100%;
  max-height: 220px;
  border-radius: 8px;
  margin-top: 12px;
  object-fit: cover;
}

.mobile-detail-footnotes {
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid #eee;
}

.mobile-detail-footnotes-title {
  font-size: 13px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.mobile-detail-footnote-item {
  font-size: 13px;
  color: #555;
  line-height: 1.45;
  padding: 4px 0;
}

/* ── Summary screen ── */

.mobile-summary-section {
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid #eee;
}

.mobile-summary-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.mobile-summary-section-label {
  font-size: 11px;
  font-weight: 700;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}

.mobile-summary-def {
  font-size: 14px;
  color: #444;
  line-height: 1.5;
  margin-top: 6px;
}

.mobile-summary-zone-header {
  padding: 12px 14px;
  border-radius: 8px;
  margin-top: 4px;
}

.mobile-summary-zone-name {
  font-size: 20px;
  font-weight: 700;
}

.mobile-summary-zone-fullname {
  font-size: 13px;
  opacity: 0.85;
  margin-top: 2px;
}

.mobile-summary-value-badge {
  display: inline-block;
  padding: 8px 16px;
  font-size: 16px;
  font-weight: 700;
  border-radius: 8px;
  border: 1px solid #ddd;
  background: #f5f5f5;
  margin-bottom: 8px;
}

.mobile-summary-caption {
  font-size: 14px;
  color: #444;
  line-height: 1.5;
  margin-bottom: 8px;
}

/* ── Nav primary button ── */

.mobile-nav-btn-primary {
  background: #1a5fa8;
  color: #fff;
  border-color: #1a5fa8;
}

.mobile-nav-btn-primary:active {
  background: #15508e;
}
