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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f5f5;
  color: #333;
  min-height: 100vh;
}

header {
  background: #e07b39;
  color: #fff;
  padding: 16px 20px;
  text-align: center;
}

header h1 {
  font-size: 1.3rem;
  font-weight: bold;
  letter-spacing: 0.05em;
}

main {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px 12px 40px;
}

/* セクション共通 */
section {
  background: #fff;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

h2 {
  font-size: 1rem;
  font-weight: bold;
  margin-bottom: 12px;
  color: #444;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* フォーム */
.form-group {
  margin-bottom: 12px;
}

label {
  display: block;
  font-size: 0.82rem;
  color: #666;
  margin-bottom: 4px;
  font-weight: bold;
}

input[type="text"],
input[type="date"],
textarea,
#search-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s;
}

input[type="text"]:focus,
input[type="date"]:focus,
textarea:focus,
#search-input:focus {
  border-color: #e07b39;
}

textarea {
  resize: vertical;
  font-family: inherit;
}

.btn-primary {
  display: block;
  width: 100%;
  padding: 11px;
  background: #e07b39;
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  margin-top: 4px;
  transition: background 0.15s;
}

.btn-primary:hover {
  background: #c9652a;
}

/* 検索 */
.search-section {
  padding: 12px 16px;
}

#search-input {
  border-radius: 20px;
  padding: 9px 16px;
}

/* ランキング */
.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ranking-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #fff8f4;
  border-left: 4px solid #e07b39;
  border-radius: 4px;
}

.rank-num {
  font-size: 0.85rem;
  font-weight: bold;
  color: #e07b39;
  width: 22px;
  text-align: center;
  flex-shrink: 0;
}

.rank-name {
  flex: 1;
  font-size: 0.9rem;
  font-weight: bold;
}

.rank-count {
  font-size: 0.85rem;
  color: #e07b39;
  font-weight: bold;
  white-space: nowrap;
}

/* 件数バッジ */
.count-badge {
  font-size: 0.75rem;
  color: #fff;
  background: #e07b39;
  border-radius: 12px;
  padding: 2px 8px;
  font-weight: normal;
}

/* レコード一覧 */
.record-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.record-card {
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 12px 14px;
  position: relative;
}

.record-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.record-device {
  font-size: 0.95rem;
  font-weight: bold;
  color: #333;
}

.record-date {
  font-size: 0.78rem;
  color: #888;
  white-space: nowrap;
  margin-top: 2px;
}

.record-content {
  font-size: 0.88rem;
  color: #555;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
}

.delete-btn {
  background: none;
  border: none;
  color: #ccc;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 4px;
  flex-shrink: 0;
  line-height: 1;
  transition: color 0.15s;
}

.delete-btn:hover {
  color: #e05555;
}

.empty-msg {
  color: #aaa;
  font-size: 0.88rem;
  text-align: center;
  padding: 12px 0;
}

/* レスポンシブ */
@media (max-width: 400px) {
  header h1 {
    font-size: 1.1rem;
  }
  section {
    padding: 14px 12px;
  }
}
