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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #fafafa;
  color: #1a1a1a;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 40px 20px 60px;
}

.container {
  max-width: 600px;
  width: 100%;
  text-align: center;
}

/* Header */
header {
  margin-bottom: 30px;
  padding-bottom: 22px;
  background: linear-gradient(90deg, transparent, #ddd, transparent) no-repeat bottom center / 80% 1px;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 6px;
}

.logo-icon {
  flex-shrink: 0;
}

.logo-text {
  font-family: 'Montserrat', sans-serif;
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #1a1a1a;
}

.subtitle {
  font-size: 15px;
  color: #999;
  font-weight: 400;
  letter-spacing: 0.5px;
}

/* Result */
.result-area {
  margin: 40px 0 30px;
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.result {
  font-size: 128px;
  font-weight: 900;
  color: #111;
  word-break: break-all;
  line-height: 1.1;
  transition: font-size 0.2s;
}

.result.multiple {
  font-size: 32px;
  line-height: 1.6;
  font-weight: 700;
}

.result-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 0 10px;
}

.result-grid .result-num {
  display: inline-block;
  padding: 12px 18px;
  background: #f3f3f3;
  border-radius: 10px;
  font-size: 32px;
  font-weight: 700;
  color: #222;
  font-family: 'Inter', sans-serif;
}

/* Smaller chips when many numbers */
.result-grid.size-md .result-num {
  padding: 10px 14px;
  font-size: 24px;
}

.result-grid.size-sm .result-num {
  padding: 8px 12px;
  font-size: 18px;
}

.result.exhausted {
  font-size: 36px;
  font-weight: 700;
  color: #555;
}

.result.spinning {
  color: #bbb;
}

/* Buttons */
.btn-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.generate-btn {
  padding: 14px 48px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: #1a1a1a;
  border: 2px solid #1a1a1a;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 1px;
  font-family: inherit;
}

.generate-btn:hover {
  background: #333;
  border-color: #333;
}

.generate-btn:active {
  transform: scale(0.97);
}

.generate-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.reset-btn {
  display: none;
  margin-bottom: 10px;
  padding: 6px 20px;
  font-size: 13px;
  font-weight: 500;
  color: #999;
  background: none;
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  letter-spacing: 0.5px;
}

.reset-btn:hover {
  color: #555;
  border-color: #aaa;
}

/* Timestamp */
.timestamp {
  margin-top: 12px;
  font-size: 12px;
  color: #aaa;
  letter-spacing: 0.3px;
}

/* Actions */
.actions {
  display: none;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.actions.visible {
  display: flex;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
  color: #888;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.action-btn:hover {
  color: #444;
  border-color: #bbb;
}

.action-btn.copied {
  color: #2e7d32;
  border-color: #a5d6a7;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 10px 24px;
  background: #1a1a1a;
  color: #fff;
  font-size: 13px;
  font-family: inherit;
  border-radius: 8px;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
  z-index: 100;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Settings */
.settings {
  margin-top: 28px;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  padding: 24px 28px;
  text-align: left;
}

.setting-group {
  margin-bottom: 20px;
}

.setting-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #888;
  margin-bottom: 8px;
}

.range-inputs {
  display: flex;
  align-items: center;
  gap: 10px;
}

.range-inputs input,
.count-input {
  flex: 1;
  max-width: 180px;
  padding: 10px 14px;
  font-size: 16px;
  font-family: inherit;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  text-align: center;
  background: #fafafa;
  transition: border-color 0.15s;
  outline: none;
}

.range-inputs input:focus,
.count-input:focus {
  border-color: #1a1a1a;
  background: #fff;
}

.range-sep {
  font-size: 14px;
  color: #999;
  font-weight: 600;
}

.range-label {
  font-size: 13px;
  color: #aaa;
  font-weight: 500;
  text-transform: lowercase;
}

.count-input {
  max-width: 140px;
}

/* Checkboxes */
.checkbox-group {
  margin-bottom: 10px;
}

.checkbox-group:last-child {
  margin-bottom: 0;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #555;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #1a1a1a;
  cursor: pointer;
  flex-shrink: 0;
}

/* History */
.history {
  display: none;
  margin-top: 20px;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 12px;
  padding: 18px 22px;
  text-align: left;
}

.history.visible {
  display: block;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.history-header .setting-label {
  margin-bottom: 0;
}

.history-clear {
  font-size: 12px;
  font-family: inherit;
  color: #bbb;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.history-clear:hover {
  color: #888;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #f8f8f8;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.1s;
}

.history-item:hover {
  background: #f0f0f0;
}

.history-item-result {
  font-weight: 600;
  color: #333;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 10px;
}

.history-item-meta {
  font-size: 11px;
  color: #aaa;
  white-space: nowrap;
}

/* Screenshot card (hidden, used for image export) */
.screenshot-card {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 500px;
  padding: 40px;
  background: #fff;
  text-align: center;
  font-family: 'Inter', sans-serif;
}

.sc-header {
  font-family: 'Montserrat', sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: #1a1a1a;
  margin-bottom: 24px;
  letter-spacing: -0.3px;
}

.sc-result {
  font-size: 72px;
  font-weight: 900;
  color: #111;
  word-break: break-all;
  line-height: 1.2;
  margin-bottom: 20px;
}

.sc-result.sc-multiple {
  font-size: 28px;
  line-height: 1.5;
}

.sc-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-bottom: 20px;
}

.sc-grid .sc-chip {
  display: inline-block;
  padding: 5px 10px;
  background: #f0f0f0;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 700;
  color: #222;
  font-family: 'Inter', sans-serif;
}

.sc-range {
  font-size: 13px;
  color: #999;
  margin-bottom: 6px;
}

.sc-time {
  font-size: 11px;
  color: #bbb;
}

/* ========== Mobile ========== */

@media (max-width: 480px) {
  body {
    padding: 24px 16px 40px;
  }

  .logo-text {
    font-size: 30px;
  }

  .logo-icon {
    width: 30px;
    height: 30px;
  }

  .subtitle {
    font-size: 13px;
  }

  .result-area {
    margin: 24px 0 20px;
    min-height: 100px;
  }

  .result {
    font-size: 80px;
  }

  .result.multiple {
    font-size: 24px;
  }

  .result.exhausted {
    font-size: 26px;
  }

  .generate-btn {
    padding: 14px 36px;
    font-size: 15px;
  }

  .settings, .history {
    padding: 18px 16px;
    border-radius: 10px;
  }

  .range-inputs {
    gap: 6px;
  }

  .range-inputs input {
    max-width: 120px;
    padding: 10px;
    font-size: 15px;
  }

  .count-input {
    max-width: 120px;
  }

  .checkbox-label {
    font-size: 13px;
  }

  .actions {
    gap: 6px;
  }

  .action-btn {
    padding: 6px 10px;
    font-size: 11px;
  }
}

@media (max-width: 360px) {
  .result {
    font-size: 60px;
  }

  .range-inputs input {
    max-width: 100px;
  }
}
