* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: linear-gradient(135deg, #eff6ff, #e0e7ff);
  min-height: 100vh;
  padding: 16px;
}

.container {
  max-width: 448px;
  margin: 0 auto;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 24px;
  animation: fadeInDown 0.5s ease;
}

.header-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #3b82f6, #4f46e5);
  border-radius: 16px;
  box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.4);
  margin-bottom: 12px;
}

.header-icon i {
  font-size: 28px;
  color: white;
}

.header h1 {
  font-size: 24px;
  font-weight: 700;
  color: #1f2937;
}

.header p {
  font-size: 14px;
  color: #6b7280;
  margin-top: 4px;
}

/* Card */
.card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.12);
  padding: 20px;
  margin-bottom: 16px;
  animation: fadeInUp 0.5s ease both;
}

.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.2s; }

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.card-title i {
  font-size: 18px;
}

.card-title h2 {
  font-size: 15px;
  font-weight: 600;
  color: #374151;
}

/* Truck type buttons */
.truck-types {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.truck-btn {
  padding: 12px 8px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #f3f4f6;
  color: #4b5563;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.truck-btn:hover {
  background: #e5e7eb;
}

.truck-btn.active {
  background: #3b82f6;
  color: white;
  box-shadow: 0 8px 20px -6px rgba(59, 130, 246, 0.5);
}

.truck-btn:active {
  transform: scale(0.95);
}

/* Custom truck inputs */
.custom-inputs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
  margin-bottom: 0;
}

.custom-inputs.visible {
  max-height: 120px;
  opacity: 1;
  margin-bottom: 16px;
}

.input-group label {
  display: block;
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
}

.input-group input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.input-group input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.input-group.indigo input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Info bar */
.info-bar {
  background: #eff6ff;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px;
}

.info-bar.indigo {
  background: #eef2ff;
}

.info-bar span {
  font-size: 13px;
  color: #6b7280;
}

.info-bar .value {
  font-weight: 500;
  color: #3b82f6;
}

.info-bar.indigo .value {
  color: #6366f1;
}

/* Cargo inputs */
.cargo-inputs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

/* Buttons */
.btn-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
  animation: fadeInUp 0.5s ease 0.3s both;
}

.btn-calc {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #3b82f6, #4f46e5);
  color: white;
  padding: 12px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 20px -6px rgba(59, 130, 246, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-calc:hover {
  box-shadow: 0 10px 25px -4px rgba(59, 130, 246, 0.5);
}

.btn-calc:active {
  transform: scale(0.95);
}

.btn-reset {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #f3f4f6;
  color: #4b5563;
  padding: 12px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.btn-reset:hover {
  background: #e5e7eb;
}

.btn-reset:active {
  transform: scale(0.95);
}

/* Result */
.result-card {
  animation: fadeInUp 0.4s ease both;
}

.result-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.result-box {
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

.result-box.gray {
  background: linear-gradient(135deg, #f9fafb, #f3f4f6);
}

.result-box.green {
  background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
}

.result-box.blue {
  background: linear-gradient(135deg, #eff6ff, #eef2ff);
}

.result-box.purple {
  background: linear-gradient(135deg, #faf5ff, #fdf2f8);
}

.result-box .label {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
}

.result-box .number {
  font-weight: 700;
}

.result-box.gray .number {
  font-size: 24px;
  color: #4b5563;
}

.result-box.green .number {
  font-size: 28px;
  color: #16a34a;
}

.result-box.blue .number {
  font-size: 20px;
  color: #2563eb;
}

.result-box.purple .number {
  font-size: 20px;
  color: #9333ea;
}

.result-box .sub {
  font-size: 12px;
  color: #9ca3af;
}

/* Efficiency bar */
.efficiency-bar {
  background: #fffbeb;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.efficiency-bar i {
  color: #f59e0b;
  flex-shrink: 0;
}

.efficiency-bar p {
  font-size: 12px;
  color: #b45309;
}

.efficiency-bar .bold {
  font-weight: 700;
}

/* Layout info */
.layout-info {
  background: #f9fafb;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 16px;
}

.layout-info .title {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 8px;
}

.layout-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
}

.layout-row + .layout-row {
  margin-top: 4px;
}

.layout-row .dir {
  color: #4b5563;
}

.layout-row .count {
  font-weight: 500;
  color: #1f2937;
}

/* Remaining space */
.remaining-space {
  background: #f9fafb;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 16px;
}

.remaining-space .title {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 8px;
}

.remaining-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  text-align: center;
}

.remaining-grid .num {
  font-size: 18px;
  font-weight: 700;
  color: #374151;
}

.remaining-grid .unit {
  font-size: 12px;
  color: #9ca3af;
}

/* Warnings */
.warnings {
  background: #fff7ed;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 16px;
}

.warnings-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.warnings-header i {
  color: #f97316;
  font-size: 14px;
}

.warnings-header span {
  font-size: 12px;
  font-weight: 500;
  color: #c2410c;
}

.warnings p {
  font-size: 12px;
  color: #ea580c;
  margin-bottom: 4px;
}

.warnings p:last-child {
  margin-bottom: 0;
}

/* Footer */
.footer {
  text-align: center;
  font-size: 12px;
  color: #9ca3af;
  animation: fadeIn 1s ease 0.5s both;
}

/* Animations */
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Mode switch */
.mode-switch {
  display: flex;
  background: #f3f4f6;
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 16px;
  animation: fadeInUp 0.4s ease both;
}

.mode-btn {
  flex: 1;
  padding: 10px 8px;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  background: transparent;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.mode-btn.active {
  background: white;
  color: #3b82f6;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.mode-btn:hover:not(.active) {
  color: #374151;
}

.mode-btn i {
  font-size: 14px;
}

/* Multi cargo */
.cargo-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cargo-item {
  background: #f9fafb;
  border-radius: 12px;
  padding: 12px;
  position: relative;
  border: 1px solid #e5e7eb;
  transition: border-color 0.2s ease;
}

.cargo-item:hover {
  border-color: #c7d2fe;
}

.cargo-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.cargo-item-title {
  font-size: 13px;
  font-weight: 600;
  color: #6366f1;
  display: flex;
  align-items: center;
  gap: 4px;
}

.cargo-item-title i {
  font-size: 12px;
}

.btn-remove-cargo {
  width: 24px;
  height: 24px;
  border: none;
  background: #fee2e2;
  color: #ef4444;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all 0.15s ease;
}

.btn-remove-cargo:hover {
  background: #fecaca;
  transform: scale(1.1);
}

.cargo-item-inputs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.cargo-item-inputs .input-group label {
  font-size: 11px;
}

.cargo-item-inputs .input-group input {
  padding: 6px 8px;
  font-size: 13px;
}

.btn-add-cargo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  border: 2px dashed #d1d5db;
  border-radius: 12px;
  background: transparent;
  color: #9ca3af;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-add-cargo:hover {
  border-color: #6366f1;
  color: #6366f1;
  background: #eef2ff;
}

/* Multi result */
.multi-result-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.multi-result-box {
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

.multi-result-box.green {
  background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
}

.multi-result-box.red {
  background: linear-gradient(135deg, #fef2f2, #fff1f2);
}

.multi-result-box.blue {
  background: linear-gradient(135deg, #eff6ff, #eef2ff);
}

.multi-result-box.amber {
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
}

.multi-result-box .label {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
}

.multi-result-box .number {
  font-weight: 700;
  font-size: 24px;
}

.multi-result-box.green .number { color: #16a34a; }
.multi-result-box.red .number { color: #dc2626; }
.multi-result-box.blue .number { color: #2563eb; }
.multi-result-box.amber .number { color: #d97706; }

.multi-result-box .sub {
  font-size: 12px;
  color: #9ca3af;
}

.cargo-result-item {
  background: #f9fafb;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}

.cargo-result-item:last-child {
  margin-bottom: 0;
}

.cargo-result-item .name {
  font-weight: 600;
  color: #4b5563;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cargo-result-item .name i {
  color: #6366f1;
  font-size: 12px;
}

.cargo-result-item .detail {
  color: #6b7280;
}

.cargo-result-item .status {
  font-weight: 600;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 6px;
}

.cargo-result-item .status.ok {
  background: #dcfce7;
  color: #16a34a;
}

.cargo-result-item .status.overflow {
  background: #fee2e2;
  color: #dc2626;
}

.overflow-info {
  background: #fef2f2;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 16px;
}

.overflow-info .title {
  font-size: 12px;
  color: #991b1b;
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.overflow-info .title i {
  font-size: 14px;
}

.overflow-info p {
  font-size: 12px;
  color: #b91c1c;
  margin-bottom: 4px;
}

.overflow-info p:last-child {
  margin-bottom: 0;
}

.fit-info {
  background: #f0fdf4;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 16px;
}

.fit-info .title {
  font-size: 12px;
  color: #166534;
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.fit-info .title i {
  font-size: 14px;
}

.fit-info p {
  font-size: 12px;
  color: #15803d;
  margin-bottom: 4px;
}

.fit-info p:last-child {
  margin-bottom: 0;
}

/* Hidden */
.hidden {
  display: none !important;
}

/* ===== 响应式适配 ===== */

/* 小屏手机 (< 360px) */
@media (max-width: 359px) {
  body {
    padding: 8px;
  }

  .container {
    max-width: 100%;
  }

  .header-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
  }

  .header-icon i {
    font-size: 22px;
  }

  .header h1 {
    font-size: 20px;
  }

  .card {
    padding: 14px;
    border-radius: 12px;
  }

  .truck-btn {
    padding: 10px 4px;
    font-size: 12px;
    border-radius: 8px;
  }

  .input-group input {
    padding: 6px 8px;
    font-size: 13px;
  }

  .result-box.gray .number {
    font-size: 20px;
  }

  .result-box.green .number {
    font-size: 22px;
  }

  .result-box.blue .number,
  .result-box.purple .number {
    font-size: 17px;
  }

  .btn-calc, .btn-reset {
    padding: 10px;
    font-size: 14px;
  }
}

/* 普通手机 (360px - 480px) */
@media (min-width: 360px) and (max-width: 480px) {
  .container {
    max-width: 100%;
  }
}

/* 平板 (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
  .container {
    max-width: 520px;
  }

  .card {
    padding: 24px;
  }

  .truck-types {
    gap: 12px;
  }

  .truck-btn {
    padding: 14px 12px;
    font-size: 14px;
  }

  .cargo-inputs {
    gap: 16px;
  }

  .result-grid-2 {
    gap: 16px;
  }
}

/* 桌面端 (> 768px) */
@media (min-width: 769px) {
  body {
    padding: 32px 24px;
  }

  .container {
    max-width: 600px;
  }

  .header-icon {
    width: 72px;
    height: 72px;
    border-radius: 18px;
  }

  .header-icon i {
    font-size: 32px;
  }

  .header h1 {
    font-size: 28px;
  }

  .header p {
    font-size: 15px;
  }

  .card {
    padding: 28px;
    border-radius: 20px;
  }

  .card-title h2 {
    font-size: 17px;
  }

  .card-title i {
    font-size: 20px;
  }

  .truck-types {
    gap: 12px;
  }

  .truck-btn {
    padding: 14px 12px;
    font-size: 14px;
    border-radius: 14px;
  }

  .input-group input {
    padding: 10px 14px;
    font-size: 15px;
  }

  .info-bar {
    padding: 14px;
  }

  .info-bar span {
    font-size: 14px;
  }

  .btn-calc, .btn-reset {
    padding: 14px;
    font-size: 16px;
    border-radius: 14px;
  }

  .result-box {
    padding: 20px;
  }

  .result-box.gray .number {
    font-size: 28px;
  }

  .result-box.green .number {
    font-size: 32px;
  }

  .result-box.blue .number,
  .result-box.purple .number {
    font-size: 22px;
  }

  .remaining-grid .num {
    font-size: 22px;
  }
}

/* 超大屏 (> 1200px) */
@media (min-width: 1200px) {
  .container {
    max-width: 640px;
  }

  .card {
    padding: 32px;
  }
}
