
/* ==============================
   基本設定
============================== */

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body,
button,
input,
select,
textarea {
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Hiragino Sans",
    "Hiragino Kaku Gothic ProN",
    "Yu Gothic",
    Meiryo,
    sans-serif !important;
}

body {
  padding: 7px;
  background: #e8ebef;
  color: #354152;
  font-size: 12px;
}

/* ==============================
   全体レイアウト
============================== */

.app {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}

.main-layout {
  display: flex !important;
  flex-direction: row !important;
  align-items: stretch;
  gap: 7px;
  width: 100%;
  min-height: calc(100vh - 14px);
}

/* ==============================
   左側フォルダパネル
============================== */

.category-panel {
  display: flex;
  flex-direction: column;
  flex: 0 0 125px;
  width: 125px;
  min-width: 125px;
  min-height: calc(100vh - 14px);
  padding: 6px;
  background: linear-gradient(145deg, #f5f6f8, #dfe4ea);
  border: 1px solid #b9c3cf;
  border-radius: 9px;
  box-shadow: inset 0 1px 2px rgba(255,255,255,.8);
}

.category-list {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 4px;
}

/* アイコンとフォルダ名を横並び */

.category-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding: 8px 3px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #4b5869;
  font-size: 11px;
  cursor: pointer;
  min-width: 0;
}

.category-item.active {
  background: linear-gradient(145deg, #e2ebf5, #cbd9e9);
  border-color: #9db4ce;
  color: #315b85;
  font-weight: 600;
}

.folder-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 27px;
  width: 27px;
  height: 23px;
}

.folder-icon svg {
  display: block;
  width: 27px;
  height: 23px;
  overflow: visible;
}

.category-name {
  flex: 1;
  min-width: 0;
  text-align: left;
  overflow-wrap: anywhere;
}

.category-management {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}

.small-button {
  flex: 1;
  padding: 6px 1px;
  background: linear-gradient(#e9edf2, #cbd2dc);
  color: #465366;
  border: 1px solid #aeb9c7;
  border-radius: 5px;
  font-size: 10px;
}

.secondary-button {
  width: 100%;
  margin-top: 5px;
  padding: 7px 2px;
  background: linear-gradient(#edf1f5, #cbd3de);
  color: #3e5065;
  border: 1px solid #aab7c7;
  border-radius: 6px;
  font-size: 11px;
}

/* ==============================
   右側単語パネル
============================== */

.word-panel {
  display: block;
  flex: 1 1 0;
  width: 0;
  min-width: 0;
  padding: 8px;
  background: linear-gradient(145deg, #fafbfc, #e8edf2);
  border: 1px solid #b9c3cf;
  border-radius: 9px;
  box-shadow: inset 0 1px 2px rgba(255,255,255,.8);
}

.word-header h2 {
  display: none !important;
}

.word-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
  margin-bottom: 9px;
}

.word-header select {
  width: 100%;
  max-width: 190px;
}

/* ==============================
   ボタン
============================== */

button {
  border: 1px solid #7189a5;
  border-radius: 6px;
  padding: 8px 5px;
  background: linear-gradient(145deg, #8199b4, #536f90);
  color: #fff;
  font-size: 11px;
  cursor: pointer;
  box-shadow: inset 0 1px 1px rgba(255,255,255,.35);
}

button:active:not(:disabled) {
  transform: translateY(1px);
  filter: brightness(.94);
}

button:disabled {
  background: #cbd1d9;
  border-color: #c1c8d1;
  color: #f7f8fa;
  cursor: not-allowed;
  box-shadow: none;
}

.action-buttons {
  display: flex;
  gap: 4px;
  width: 100%;
  margin: 10px 0;
}

.action-buttons button {
  flex: 1;
  min-width: 0;
  padding: 8px 1px;
  font-size: 11px;
}

/* ==============================
   単語一覧
============================== */

.word-list-header,
.word-row {
  display: grid;
  grid-template-columns: 35px minmax(0, 1fr) minmax(0, 1fr);
  gap: 3px;
  align-items: center;
  width: 100%;
  padding: 8px 3px;
}

.word-list-header {
  background: linear-gradient(145deg, #e2e7ed, #d2dae4);
  border: 1px solid #c4cdd8;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
}

.word-row {
  border-bottom: 1px solid #dce1e7;
  font-size: 11px;
}

.word-row.new-word {
  color: #397bb5;
}

.word-row.registered-word {
  color: #778392;
}

.word-row input {
  justify-self: center;
  width: 14px;
  height: 14px;
  margin: 0;
}

.word-value {
  min-width: 0;
  overflow-wrap: anywhere;
}

.empty-message {
  padding: 20px 3px;
  text-align: center;
  color: #8b96a4;
  font-size: 11px;
}

/* ==============================
   入力欄・選択欄
============================== */

input,
select {
  width: 100%;
  min-width: 0;
  padding: 8px;
  border: 1px solid #b9c4d0;
  border-radius: 6px;
  background: #f9fafb;
  color: #354152;
  font-size: 12px;
}

/* ==============================
   ポップアップ
============================== */

dialog {
  width: min(360px, calc(100% - 28px));
  border: 1px solid #aab7c7;
  border-radius: 10px;
  padding: 0;
  background: linear-gradient(145deg, #f8fafc, #e3e8ee);
  box-shadow: 0 10px 30px rgba(38, 52, 70, .2);
  color: #354152;
}

dialog::backdrop {
  background: rgba(35, 47, 62, .38);
}

.dialog-content {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 16px;
}

.dialog-content h2 {
  margin: 0 0 5px;
  font-size: 15px;
  color: #455c76;
}

.dialog-content label {
  font-size: 11px;
  font-weight: 600;
}

.dialog-buttons {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.dialog-buttons button {
  flex: 1;
}

.cancel-button {
  background: linear-gradient(#edf0f4, #d2d9e2);
  border-color: #b6c0cd;
  color: #465366;
}

/* ==============================
   小さい画面でも左右を維持
============================== */

@media (max-width: 650px) {
  .main-layout {
    display: flex !important;
    flex-direction: row !important;
  }

  .category-panel {
    flex: 0 0 125px;
    width: 125px;
    min-width: 125px;
  }

  .word-panel {
    flex: 1 1 0;
    width: 0;
    min-width: 0;
  }
}


/* ==============================
   フォルダアイコン選択
============================== */

.category-color-options {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 3px 0 8px;
}

.color-option {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 52px;
  width: 52px;
  height: 54px;
  padding: 8px;
  background: linear-gradient(145deg, #f8fafc, #e5eaf0);
  border: 1px solid #c2ccd8;
  border-radius: 9px;
  box-shadow: inset 0 1px 2px rgba(255,255,255,.9);
}

.color-option svg {
  display: block;
  width: 34px;
  height: 30px;
}

.color-option.selected {
  border: 2px solid #4385d5;
  background: linear-gradient(145deg, #edf5ff, #dceaff);
  box-shadow:
    0 0 0 1px rgba(67,133,213,.15),
    inset 0 1px 2px rgba(255,255,255,.9);
}

.color-option-divider {
  width: 1px;
  height: 42px;
  margin: 0 2px;
  background: #c4ccd6;
}


/* ==============================
   コピー完了ポップアップ
============================== */

.copy-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 12px);
  z-index: 1000;

  padding: 11px 18px;
  border-radius: 9px;

  background: rgba(38, 52, 70, .94);
  color: #ffffff;
  font-size: 12px;
  text-align: center;
  white-space: nowrap;

  opacity: 0;
  visibility: hidden;
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}

.copy-toast.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

/* コピーできる文字 */
.copyable-text {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.copyable-text:active {
  opacity: .55;
}
