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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f4f6f9;
  color: #333;
  min-height: 100vh;
  padding: 16px;
}

.container {
  max-width: 480px;
  margin: 0 auto;
}

h1 {
  text-align: center;
  font-size: 1.5rem;
  color: #4a90d9;
  margin-bottom: 20px;
  font-weight: 700;
}

/* カテゴリタブ */
.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  justify-content: center;
}

.tab {
  padding: 8px 16px;
  border: 2px solid #4a90d9;
  background: #fff;
  color: #4a90d9;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s;
}

.tab.active,
.tab:hover {
  background: #4a90d9;
  color: #fff;
}

/* 変換パネル */
.converter-panel {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  margin-bottom: 20px;
}

.input-group {
  display: flex;
  gap: 10px;
  align-items: center;
}

.input-group input {
  flex: 1;
  padding: 12px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1.1rem;
  outline: none;
  transition: border-color 0.2s;
}

.input-group input:focus {
  border-color: #4a90d9;
}

.input-group input[readonly] {
  background: #f8f9fb;
  color: #555;
}

.input-group select {
  padding: 12px 8px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 0.9rem;
  background: #fff;
  cursor: pointer;
  outline: none;
  min-width: 110px;
  transition: border-color 0.2s;
}

.input-group select:focus {
  border-color: #4a90d9;
}

.arrow-row {
  display: flex;
  justify-content: center;
  margin: 14px 0;
}

#swapBtn {
  background: #4a90d9;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

#swapBtn:hover {
  background: #357abd;
  transform: rotate(180deg);
}

/* 履歴 */
.history-section {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-weight: 600;
  color: #555;
  font-size: 0.9rem;
}

#clearHistoryBtn {
  background: none;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.8rem;
  cursor: pointer;
  color: #888;
  transition: all 0.2s;
}

#clearHistoryBtn:hover {
  background: #fee;
  border-color: #f88;
  color: #d44;
}

#historyList {
  list-style: none;
  max-height: 200px;
  overflow-y: auto;
}

#historyList li {
  padding: 8px 10px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.85rem;
  color: #555;
  display: flex;
  justify-content: space-between;
}

#historyList li:last-child {
  border-bottom: none;
}

#historyList li .hist-category {
  color: #4a90d9;
  font-size: 0.75rem;
  align-self: center;
  margin-left: 8px;
  flex-shrink: 0;
}

.empty-history {
  text-align: center;
  color: #bbb;
  font-size: 0.85rem;
  padding: 12px 0;
}

@media (max-width: 400px) {
  .input-group {
    flex-direction: column;
    align-items: stretch;
  }

  .input-group select {
    min-width: unset;
  }
}
