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

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

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

h1 {
  text-align: center;
  font-size: 1.4rem;
  margin-bottom: 16px;
  color: #333;
}

/* 電卓 */
.calculator {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  margin-bottom: 12px;
}

.display {
  background: #f5f5f5;
  border-radius: 10px;
  padding: 12px 16px;
  text-align: right;
  margin-bottom: 12px;
  min-height: 72px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.display-sub {
  font-size: 0.85rem;
  color: #999;
  min-height: 20px;
  word-break: break-all;
}

.display-main {
  font-size: 2rem;
  font-weight: bold;
  color: #222;
  word-break: break-all;
  line-height: 1.2;
}

.buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.btn {
  background: #f0f2f5;
  border: none;
  border-radius: 10px;
  padding: 16px 0;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.15s;
  color: #333;
}

.btn:active {
  background: #dde0e6;
}

.btn.span2 {
  grid-column: span 2;
}

.btn-clear {
  background: #ffe0e0;
  color: #d94040;
}

.btn-clear:active {
  background: #ffb3b3;
}

.btn-op {
  background: #e8f0fe;
  color: #4a90d9;
  font-weight: bold;
}

.btn-op:active {
  background: #c5d8f8;
}

.btn-eq {
  background: #4a90d9;
  color: #fff;
  font-weight: bold;
}

.btn-eq:active {
  background: #3a7bc8;
}

/* メモ保存 */
.memo-save {
  background: #fff;
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  margin-bottom: 12px;
  display: flex;
  gap: 8px;
}

.memo-save input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.95rem;
  outline: none;
  color: #333;
}

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

.btn-save {
  background: #4a90d9;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.btn-save:active {
  background: #3a7bc8;
}

/* メモ一覧 */
.memo-list-area {
  background: #fff;
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

.memo-header h2 {
  font-size: 1rem;
  color: #555;
}

.btn-clear-all {
  background: none;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.8rem;
  color: #999;
  cursor: pointer;
}

.btn-clear-all:active {
  background: #f5f5f5;
}

#memoList {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.memo-item {
  display: flex;
  align-items: center;
  background: #f8f9fb;
  border-radius: 10px;
  padding: 10px 12px;
  gap: 8px;
}

.memo-item-body {
  flex: 1;
  min-width: 0;
}

.memo-item-label {
  font-size: 0.85rem;
  color: #888;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.memo-item-value {
  font-size: 1.1rem;
  font-weight: bold;
  color: #333;
}

.memo-item-time {
  font-size: 0.75rem;
  color: #bbb;
  white-space: nowrap;
}

.memo-item-del {
  background: none;
  border: none;
  color: #ccc;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color 0.15s;
}

.memo-item-del:active {
  color: #d94040;
}

.empty-msg {
  text-align: center;
  color: #bbb;
  font-size: 0.9rem;
  padding: 16px 0;
}

@media (max-width: 400px) {
  .btn {
    padding: 14px 0;
    font-size: 1rem;
  }
  .display-main {
    font-size: 1.7rem;
  }
}
