html, body, main, header, footer {
  padding: 0px;
  margin: 0px;
}

/* ===== App Layout ===== */

#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 20px 40px;
}

#app-title {
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0 0 8px 0;
}

#app-desc {
  text-align: center;
  font-size: 15px;
  color: #666;
  margin: 0 0 28px 0;
}

/* ===== Input Section ===== */

#input-section {
  margin-bottom: 24px;
}

#input-section label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  margin-bottom: 8px;
}

#data-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 15px;
  font-family: inherit;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  resize: vertical;
  box-sizing: border-box;
  transition: border-color 0.2s;
  outline: none;
}

#data-input:focus {
  border-color: #3b82f6;
}

/* ===== Error ===== */

#input-error {
  min-height: 20px;
  font-size: 13px;
}

.error.visible {
  color: #ef4444;
  margin-top: 6px;
}

/* ===== Buttons ===== */

#button-group {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.btn-primary {
  padding: 10px 24px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background-color: #3b82f6;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-primary:hover {
  background-color: #2563eb;
}

.btn-primary:active {
  background-color: #1d4ed8;
}

.btn-secondary {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  background-color: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-secondary:hover {
  background-color: #e5e7eb;
}

.btn-secondary:active {
  background-color: #d1d5db;
}

/* ===== Result Section ===== */

#result-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ===== Mode Result ===== */

#mode-result {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
}

#mode-result-title {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 14px 0;
}

#mode-placeholder {
  text-align: center;
  color: #94a3b8;
  font-size: 14px;
  padding: 12px 0;
}

.mode-empty {
  text-align: center;
  color: #94a3b8;
  font-size: 14px;
  padding: 12px 0;
}

.mode-card {
  text-align: center;
}

.mode-type {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 6px;
}

.mode-values {
  font-size: 32px;
  font-weight: 700;
  color: #3b82f6;
  margin-bottom: 6px;
  word-break: break-all;
}

.mode-count {
  font-size: 14px;
  color: #64748b;
}

/* ===== Frequency Table ===== */

#frequency-table {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
}

#freq-table-title {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 14px 0;
}

#freq-placeholder {
  text-align: center;
  color: #94a3b8;
  font-size: 14px;
  padding: 12px 0;
}

.freq-empty {
  text-align: center;
  color: #94a3b8;
  font-size: 14px;
  padding: 12px 0;
}

.freq-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.freq-table th {
  text-align: left;
  padding: 8px 10px;
  color: #64748b;
  font-weight: 500;
  border-bottom: 2px solid #e2e8f0;
  font-size: 13px;
}

.freq-table td {
  padding: 10px 10px;
  border-bottom: 1px solid #e2e8f0;
  color: #334155;
}

.freq-value {
  font-weight: 600;
  min-width: 60px;
}

.freq-count {
  min-width: 50px;
}

.freq-percent {
  min-width: 60px;
  color: #64748b;
}

.freq-bar-cell {
  width: 100%;
  min-width: 100px;
}

.freq-bar {
  height: 8px;
  background-color: #3b82f6;
  border-radius: 4px;
  min-width: 4px;
  transition: width 0.4s ease;
}

/* ===== Fork Section ===== */

#__fork {
  max-width: 720px;
  margin: 0 auto 24px;
  padding: 0 20px;
  text-align: right;
}

#__fork button {
  padding: 6px 16px;
  font-size: 13px;
  color: #6b7280;
  background: transparent;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

#__fork button:hover {
  color: #374151;
  border-color: #9ca3af;
}

/* ===== Info Sections ===== */

#features,
#scenarios,
#FAQ {
  max-width: 720px;
  margin: 0 auto 24px;
  padding: 20px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
}

#features h2,
#scenarios h2,
#FAQ h2 {
  font-size: 18px;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 12px 0;
}

#features p {
  font-size: 14px;
  line-height: 1.8;
  color: #475569;
  margin: 0;
}

#scenarios ul {
  padding-left: 20px;
  margin: 0;
}

#scenarios li {
  font-size: 14px;
  line-height: 1.8;
  color: #475569;
  margin-bottom: 4px;
}

#FAQ dl {
  margin: 0;
}

#FAQ dt {
  font-size: 14px;
  font-weight: 600;
  color: #334155;
  margin-top: 14px;
  margin-bottom: 4px;
}

#FAQ dt:first-child {
  margin-top: 0;
}

#FAQ dd {
  font-size: 14px;
  line-height: 1.7;
  color: #475569;
  margin: 0 0 0 0;
}

/* ===== Footer ===== */

.page-info {
  text-align: center;
  font-size: 13px;
  color: #94a3b8;
  padding: 20px;
}

.page-info a {
  color: #64748b;
  text-decoration: none;
}

.page-info a:hover {
  color: #3b82f6;
}

/* ===== Responsive ===== */

@media (max-width: 640px) {
  #app {
    padding: 20px 14px 28px;
  }

  #app-title {
    font-size: 22px;
  }

  #button-group {
    flex-direction: column;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
    text-align: center;
  }

  .mode-values {
    font-size: 24px;
  }

  #features,
  #scenarios,
  #FAQ {
    padding: 16px;
    margin-left: 14px;
    margin-right: 14px;
  }
}
