* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f7f3ec;
  color: #1a1a1a;
  display: flex;
  justify-content: center;
  padding: 24px 12px;
}

.card {
  width: 100%;
  max-width: 480px;
  text-align: center;
}

.app-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px;
}

.app-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

h1 {
  font-size: 1.4rem;
  margin: 0 0 4px;
  color: #1a1a1a;
}

.beta-badge {
  display: inline-block;
  vertical-align: middle;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #1a7a4c;
  background: #e3f3ea;
  border-radius: 999px;
  padding: 2px 8px;
}

.subtitle {
  color: #666;
  font-size: 0.9rem;
  margin: 0 0 4px;
}

.limit-notice {
  color: #888;
  font-size: 0.8rem;
  margin: 0 0 8px;
}

.disclaimer {
  color: #a15c00;
  background: #fff6e5;
  border-radius: 8px;
  font-size: 0.78rem;
  padding: 8px 10px;
  margin: 0 0 20px;
}

/* Mode tabs */

.mode-tabs {
  display: flex;
  gap: 4px;
  background: #eee;
  border-radius: 10px;
  padding: 4px;
  margin: 0 0 16px;
}

.mode-tab {
  flex: 1;
  margin: 0;
  padding: 8px 6px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: #666;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.2;
}

.mode-tab.active {
  background: #fff;
  color: #1a1a1a;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.mode-panel {
  text-align: left;
}

.mode-help {
  color: #555;
  font-size: 0.82rem;
  line-height: 1.4;
  margin: 0 0 12px;
}

.toggle-help {
  color: #888;
  font-size: 0.76rem;
  line-height: 1.3;
  margin: 4px 0 4px;
}

.toggle-explain {
  background: #f7f5fb;
  border: 1px solid #eee2fa;
  border-radius: 8px;
  padding: 8px 10px;
  margin: 0 0 8px;
}

.toggle-explain p {
  color: #555;
  font-size: 0.76rem;
  line-height: 1.35;
  margin: 0;
}

.toggle-explain p + p {
  margin-top: 5px;
}

.toggle-explain strong {
  color: #5b3fa0;
}

/* Shared form elements */

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 8px;
}

input[type="text"],
input[type="number"],
select {
  padding: 10px 11px;
  border: 1px solid #ccc;
  border-radius: 8px;
  background: #fff;
  color: #1a1a1a;
  font-size: 0.88rem;
  min-width: 0;
  width: 100%;
}

.full-field {
  width: 100%;
  margin: 0 0 8px;
}

/* Crop / border toggle */

.toggle-row {
  display: flex;
  gap: 4px;
  background: #eee;
  border-radius: 8px;
  padding: 3px;
  margin: 0 0 8px;
}

.toggle-option {
  flex: 1;
  margin: 0;
  padding: 7px 6px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #666;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.toggle-option.active {
  background: #8a63d2;
  color: #fff;
}

/* Standard-size preset chips (Mode 2) */

.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
}

.preset-chip {
  margin: 0;
  width: auto;
  padding: 5px 10px;
  background: #f2edfa;
  color: #5b3fa0;
  border: 1px solid #ddd0f2;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
}

.preset-chip:hover {
  background: #e7dcf5;
}

.cf-turnstile {
  margin-top: 12px;
}

button#calculate-btn {
  margin-top: 16px;
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: #1a7a4c;
  color: white;
  font-size: 1rem;
  cursor: pointer;
}

button#calculate-btn:disabled {
  background: #aaa;
  cursor: not-allowed;
}

#status {
  min-height: 1.2em;
  color: #444;
  font-size: 0.9rem;
}

#status a {
  color: #1a7a4c;
  font-weight: 600;
}

#result {
  margin-top: 16px;
  text-align: left;
}

.result-heading {
  font-weight: 700;
  font-size: 1rem;
  margin: 0 0 8px;
  color: #1a1a1a;
}

.result-line {
  font-size: 0.88rem;
  color: #333;
  margin: 0 0 4px;
}

.result-line strong {
  color: #1a7a4c;
}

.size-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  margin-top: 8px;
}

.size-table th {
  text-align: left;
  color: #666;
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 6px 6px;
  border-bottom: 2px solid #ddd;
}

.size-table td {
  padding: 7px 6px;
  border-bottom: 1px solid #eee;
  vertical-align: top;
}

.size-table tr.native-ratio-row td {
  background: #f2edfa;
}

.size-value {
  font-weight: 700;
  color: #1a1a1a;
}

.size-sub {
  display: block;
  font-size: 0.7rem;
  color: #888;
  font-style: italic;
}

.crop-percent {
  font-weight: 700;
  color: #8a63d2;
}

.crop-percent.full-frame {
  color: #1a7a4c;
}
