@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;700&display=swap');

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

body {
  background: #f5f5f0;
  color: #222;
  font-family: 'Noto Sans JP', sans-serif;
  min-height: 100vh;
  padding: 28px 16px 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.container {
  width: 100%;
  max-width: 560px;
}

header {
  margin-bottom: 24px;
}

.title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #222;
}

.subtitle {
  font-size: 0.8rem;
  color: #999;
  margin-top: 2px;
}

.card {
  background: #fff;
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid #e8e8e4;
}

.mode-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  background: #f0f0eb;
  padding: 4px;
  border-radius: 10px;
}

.tab {
  flex: 1;
  padding: 8px 0;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: #999;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.tab.active {
  background: #fff;
  color: #222;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

label {
  display: block;
  font-size: 0.72rem;
  color: #aaa;
  margin-bottom: 6px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

textarea {
  width: 100%;
  background: #fafaf8;
  border: 1.5px solid #e4e4e0;
  border-radius: 10px;
  color: #222;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 1.3rem;
  line-height: 1.8;
  padding: 12px 14px;
  resize: none;
  min-height: 80px;
  transition: border-color 0.15s;
  outline: none;
}

textarea:focus {
  border-color: #aaa;
}

textarea::placeholder {
  color: #ccc;
  font-size: 1rem;
}

.arrow {
  text-align: center;
  font-size: 1.1rem;
  color: #ccc;
  margin: 10px 0;
}

.output-wrap {
  position: relative;
}

.output-box {
  background: #fafaf8;
  border: 1.5px solid #e4e4e0;
  border-radius: 10px;
  padding: 12px 14px;
  padding-right: 70px;
  min-height: 64px;
  font-size: 1.5rem;
  line-height: 2;
  word-break: break-all;
  white-space: pre-wrap;
  color: #222;
}

.output-box.text-output {
  font-size: 1.3rem;
}

.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #f0f0eb;
  border: none;
  border-radius: 7px;
  color: #666;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 5px 10px;
  cursor: pointer;
  font-family: 'Noto Sans JP', sans-serif;
  transition: background 0.15s;
}

.copy-btn:hover { background: #e4e4e0; }

.placeholder-text {
  color: #ccc;
  font-size: 0.9rem;
  line-height: 2;
}

.table-card {
  background: #fff;
  border-radius: 14px;
  padding: 20px;
  border: 1px solid #e8e8e4;
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  cursor: pointer;
  user-select: none;
}

.table-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #555;
}

.toggle-icon {
  font-size: 0.75rem;
  color: #aaa;
  transition: transform 0.2s;
}

.toggle-icon.open { transform: rotate(180deg); }

.cipher-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}

.cipher-cell {
  border: 1px solid #f0f0eb;
  border-radius: 8px;
  padding: 7px 4px;
  text-align: center;
  background: #fafaf8;
}

.cipher-kana {
  font-size: 0.8rem;
  color: #888;
  display: block;
  font-weight: 700;
}

.cipher-emoji {
  font-size: 1.25rem;
  display: block;
  margin-top: 1px;
  line-height: 1.4;
}

.table-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.ctrl-btn {
  padding: 6px 14px;
  border: none;
  border-radius: 7px;
  background: #f0f0eb;
  color: #555;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.ctrl-btn:hover { background: #e4e4e0; }

.ctrl-btn.active-edit {
  background: #222;
  color: #fff;
}

.reset-btn { color: #c0392b; }
.reset-btn:hover { background: #fdecea; }

.cipher-cell.editing { background: #fff8f0; }

.emoji-input {
  display: block;
  width: 100%;
  border: 1.5px solid #e4e4e0;
  border-radius: 6px;
  background: #fff;
  font-size: 1.2rem;
  text-align: center;
  padding: 2px 0;
  outline: none;
  margin-top: 2px;
}

.emoji-input:focus { border-color: #aaa; }

.custom-chars-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #f0f0eb;
}

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

.custom-char-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid #f5f5f0;
}

.custom-char-row:last-child { border-bottom: none; }

.custom-char-value {
  min-width: 36px;
  font-size: 1rem;
  font-weight: 700;
  color: #333;
  text-align: center;
  background: #fafaf8;
  border: 1px solid #f0f0eb;
  border-radius: 6px;
  padding: 3px 6px;
}

.custom-char-arrow {
  color: #ccc;
  font-size: 0.9rem;
}

.custom-char-emoji {
  font-size: 1.3rem;
  min-width: 32px;
  text-align: center;
}

.custom-char-input {
  background: #fafaf8;
  border: 1.5px solid #e4e4e0;
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 0.9rem;
  font-family: 'Noto Sans JP', sans-serif;
  color: #222;
  outline: none;
  width: 64px;
  text-align: center;
  transition: border-color 0.15s;
}

.custom-char-input.emoji-wide { width: 80px; font-size: 1.1rem; }
.custom-char-input:focus { border-color: #aaa; }
.custom-char-input::placeholder { color: #ccc; font-size: 0.78rem; }

.favorites-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #f0f0eb;
}

.favorites-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #888;
  margin-bottom: 10px;
  letter-spacing: 0.04em;
}

.save-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.fav-name-input {
  flex: 1;
  background: #fafaf8;
  border: 1.5px solid #e4e4e0;
  border-radius: 8px;
  padding: 6px 10px;
  font-family: 'Noto Sans JP', sans-serif;
  font-size: 0.82rem;
  color: #222;
  outline: none;
  transition: border-color 0.15s;
}

.fav-name-input:focus { border-color: #aaa; }
.fav-name-input::placeholder { color: #ccc; }

.fav-save-btn { white-space: nowrap; }

.fav-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 0;
  border-bottom: 1px solid #f5f5f0;
}

.fav-item:last-child { border-bottom: none; }

.fav-name {
  flex: 1;
  font-size: 0.85rem;
  color: #333;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fav-load-btn { color: #2980b9; }
.fav-load-btn:hover { background: #eaf4fb; }

.fav-del-btn { color: #c0392b; }
.fav-del-btn:hover { background: #fdecea; }

.fav-empty {
  font-size: 0.78rem;
  color: #ccc;
  padding: 8px 0;
}

.dakuten-note {
  font-size: 0.75rem;
  color: #aaa;
  margin-bottom: 10px;
  padding: 8px 10px;
  background: #fafaf8;
  border-radius: 8px;
  border: 1px solid #f0f0eb;
}
