
:root {
  --bg-color: #fdfaf6;
  --text-color: #2c1f14;
  --primary-color: #b54c2e;
  --sunday-bg: #fbeaea;
  --saturday-bg: #e8f1f8;
  --today-border: 2px solid #f0a830;
  --event-bg: #d8b08c;
}

body {
  background: var(--bg-color);
  color: var(--text-color);
  font-family: 'Yu Mincho', serif;
  margin: 0;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}
header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
#header-icon {
  width: 36px;
  height: 36px;
  filter: drop-shadow(0 0 1px #333);
}
h1 {
  color: var(--primary-color);
  margin: 0;
  font-size: 1.6rem;
}
#settings-btn {
  background: none;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  margin-left: auto;
  color: var(--primary-color);
  transition: color 0.3s ease;
}
#settings-btn:hover, #settings-btn:focus {
  color: #983f2a;
  outline: none;
}

#calendar {
  max-width: 720px;
  width: 100%;
  background: white;
  padding: 10px;
  border-radius: 8px;
  box-shadow: 0 0 8px rgba(0,0,0,0.1);
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

#calendar-header {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
#month-year {
  font-weight: bold;
  font-size: 1.2rem;
  min-width: 140px;
  text-align: center;
}

button {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.3s ease;
}
button:hover {
  background-color: #983f2a;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
th, td {
  border: 1px solid #ccc;
  padding: 6px;
  height: 80px;
  text-align: center;
  vertical-align: top;
  cursor: pointer;
  user-select: none;
}
th {
  background: var(--primary-color);
  color: white;
}
td.sunday { background: var(--sunday-bg); color: #d00; }
td.saturday { background: var(--saturday-bg); color: #0078d7; }
td.today { border: var(--today-border); background: #fff8e1; }
.event {
  background: var(--event-bg);
  color: #111;
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 13px;
  margin-top: 4px;
  display: inline-block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right: 4px;
}
.event-tag {
  padding: 0 4px;
  margin-left: 4px;
  border-radius: 3px;
  font-size: 0.75em;
  color: white;
  display: inline-block;
}
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}
#modal, #settings-modal {
  background: white;
  border-radius: 8px;
  padding: 20px;
  width: 90%;
  max-width: 400px;
  box-sizing: border-box;
}
textarea, input[type="time"], input[type="color"], input[type="text"] {
  width: 100%;
  margin-top: 5px;
  margin-bottom: 10px;
  box-sizing: border-box;
}
.modal-buttons {
  text-align: right;
}
.modal-buttons button {
  margin-left: 8px;
}
#today-button {
  display: block;
  margin: 20px auto 0;
  background: #444;
  width: 100px;
}
#tag-color-list > div {
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
#tag-color-list label {
  flex-grow: 1;
}
#tag-color-list input[type="color"] {
  width: 40px;
  height: 30px;
  border: none;
  cursor: pointer;
  padding: 0;
}
.tag-row {
  border: 1px solid #ccc;
  padding: 4px 6px;
  border-radius: 5px;
}
.tag-row:hover {
  background: #f0f0f0;
}
.tag-row button {
  background: #b54c2e;
  border: none;
  color: white;
  cursor: pointer;
  border-radius: 3px;
  padding: 2px 5px;
  margin-left: 5px;
  font-size: 0.8em;
}
.tag-row button:hover {
  background: #983f2a;
}
