/* ============================================================
   mog-mog.jp — Common Stylesheet  v1.0
   下層ツールページ共通CSS
   使い方: <link rel="stylesheet" href="/common.css"> をheadに追加
   ※ ツール固有のスタイルは各ページの<style>に記述
   ============================================================ */

/* ── VARIABLES ── */
:root {
  --white:       #ffffff;
  --off-white:   #f5f5f5;
  --border:      #e0e0e0;
  --border-dark: #c0c0c0;
  --deepest:     #141414;
  --ink:         #1a1a1a;
  --ink-light:   #4e4e4e;
  --ink-xlight:  #707070;
  --orange:      #a151f4;       /* accent purple */
  --orange-light:#f5eeff;
  --cta:         #4f4f4f;
  --cta-hover:   #333333;
  --sans:  'Jost', sans-serif;
  --body:  'Noto Sans JP', sans-serif;
  --mono:  'DM Mono', monospace;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  background: var(--off-white);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.7;
  font-variant-numeric: normal;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button { font-family: inherit; }
ul { list-style: none; }

/* ── HEADER ── */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.6);
  border-bottom: 1px solid var(--border);
  height: 56px;
}
.header-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 clamp(20px,5vw,40px);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-logo {
  font-family: var(--sans);
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-decoration: none;
}
.site-logo em {
  font-style: normal;
  color: var(--orange);
}

/* ── BURGER ── */
.burger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 36px; height: 36px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: none;
  border: none;
  border-radius: 6px;
  transition: background 0.2s;
}
.burger:hover { background: var(--off-white); }
.burger span {
  display: block;
  width: 18px; height: 1.5px;
  background: var(--ink);
  transition: transform 0.2s, opacity 0.2s;
}

/* ── DRAWER ── */
.drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.drawer-overlay.open { opacity: 1; pointer-events: all; }
.drawer {
  position: fixed;
  top: 0; right: 0;
  width: min(584px, 100vw);
  height: 100%;
  background: var(--white);
  z-index: 201;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  overflow-y: auto;
}
.drawer.open { transform: translateX(0); }
.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.drawer-logo {
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--ink);
}
.drawer-logo em {
  font-style: normal;
  color: var(--orange);
}
.drawer-close {
  width: 32px; height: 32px;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-xlight);
  transition: color 0.2s;
}
.drawer-close:hover { color: var(--ink); }
.drawer-nav {
  display: flex;
  flex-direction: column;
  padding: 16px 0;
  align-items: stretch;
  gap: 2px;
}
.drawer-nav a {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  padding: 10px 24px;
  transition: background 0.15s, color 0.15s;
  display: flex;
  align-items: center;
  gap: 10px;
}
.drawer-nav a:hover { background: var(--off-white); color: var(--orange); }
.drawer-nav .drawer-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 24px;
}
.drawer-cta {
  margin: 8px 24px 24px;
  display: block;
  text-align: center;
  padding: 12px;
  background: var(--cta) !important;
  color: white !important;
  font-family: var(--body);
  font-size: 13px;
  font-weight: 500;
  border-radius: 999px !important;
  transition: background 0.2s !important;
}
.drawer-cta:hover { background: var(--ink) !important; color: white !important; }

@media (max-width: 650px) {
  .drawer { width: 100vw; border-left: none; }
}

/* ── MAIN ── */
main {
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(8px,1.5vw,12px) 18px 80px;
}

/* ── PAGE HEADER ── */
.page-header {
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(10px,1.5vw,16px) 18px 0;
}
.page-eyebrow {
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.page-eyebrow::before {
  content: '';
  width: 20px; height: 1px;
  background: var(--orange);
  flex-shrink: 0;
}
.page-header h1 {
  font-family: var(--sans);
  font-size: clamp(24px,3vw,32px);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink);
  margin-bottom: 6px;
  line-height: 1.2;
}
.page-header p {
  font-family: var(--body);
  font-size: 13px;
  color: var(--ink-light);
  font-weight: 400;
  line-height: 1.6;
  margin-bottom: 26px;
}

/* ── CARD ── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 25px;
  margin-bottom: 16px;
}
.card-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-light);
  margin-bottom: 17px;
}

/* ── TEXTAREA ── */
textarea {
  width: 100%;
  padding: 12px;
  font-family: var(--body);
  font-size: 13px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--border-dark);
  border-radius: 8px;
  resize: vertical;
  line-height: 1.7;
  margin-bottom: 8px;
  transition: border-color 0.2s;
}
textarea:focus { outline: none; border-color: var(--orange); }
textarea::placeholder { color: #b6b6b6; }

/* Shared form/layout helpers used across tool pages */
.input-area {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.field textarea,
.field input {
  width: 100%;
}
.field input,
.field textarea,
.output-wrap textarea,
.edit-textarea {
  margin-bottom: 0;
}
.field textarea {
  min-height: 96px;
}
.edit-textarea {
  display: none;
  min-height: 88px;
  margin-top: 4px;
}
.output-textarea {
  min-height: 140px;
}

/* ── BUTTONS ── */
/* 1カラム幅ボタン（日本語） */
.btn-primary, .btn-ghost {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 16px;
  border-radius: 999px;
  font-family: var(--body);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.btn-primary svg, .btn-ghost svg { width: 13px; height: 13px; }
.btn-primary {
  background: linear-gradient(to right, #7f41e5, #a151f4);
  color: white;
  border: none;
}
.btn-primary:hover { background: linear-gradient(to right, #6f35cc, #9040e0); }
.btn-add {
  min-height: 42px;
}
.btn-ghost {
  background: transparent;
  color: var(--ink-light);
  border: 1.5px solid var(--border-dark);
}
.btn-ghost:hover { background: linear-gradient(to right, #7f41e5, #a151f4); color: white; border-color: transparent; }

/* 2カラム幅ボタン（英語） */
.btn-export {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  background: transparent;
  color: var(--ink-light);
  border: 1.5px solid var(--border-dark);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.btn-export:hover { background: var(--ink-light); color: white; border-color: var(--ink-light); }
.btn-export-tool {
  min-height: 36px;
}

/* リセットボタン */
.reset-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--body);
  font-size: 12px;
  font-weight: 500;
  background: none;
  border: 1px solid var(--border-dark);
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--ink-light);
  white-space: nowrap;
  transition: border-color 0.2s, color 0.2s;
}
.reset-btn:hover { border-color: var(--cta); color: var(--cta); background: var(--orange-light); }
.reset-btn svg { width: 12px; height: 12px; }
.btn-reset-tool {
  min-height: 34px;
}

/* ヘルプボタン */
.help-btn {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--border-dark);
  background: none;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-xlight);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.2s, color 0.2s;
}
.help-btn:hover { border-color: var(--orange); color: var(--orange); }

/* ── TABS ── */
.tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.tab-btn {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 8px;
  font-family: var(--body);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--ink-xlight);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--ink-light); }
.tab-btn.active { color: var(--orange); border-bottom-color: var(--orange); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--white);
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  padding: 28px;
  position: relative;
  max-height: 80vh;
  overflow-y: auto;
}
.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 28px; height: 28px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-xlight);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}
.modal-close:hover { color: var(--ink); }
.modal h2 {
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 20px;
}
.modal-section { margin-bottom: 20px; }
.modal-section-title {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 8px;
}
.modal ul li {
  font-size: 13px;
  color: var(--ink-light);
  line-height: 1.7;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.modal ul li:last-child { border-bottom: none; }

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  min-width: 160px;
  background: var(--cta);
  color: white;
  border-radius: 999px;
  padding: 10px 20px;
  font-family: var(--body);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 400;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── PAGE TOP ── */
#back-to-top {
  position: fixed;
  bottom: 28px;
  right: 24px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: #b2b2b2;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, background 0.2s;
}
#back-to-top.visible { opacity: 1; pointer-events: all; }
#back-to-top:hover { background: #888888; }
#back-to-top svg { width: 16px; height: 16px; color: white; }

/* ── FOOTER ── */
footer {
  background: var(--white);
  border-top: 1px solid var(--border);
  padding: clamp(16px,3vw,24px) 0;
}
footer .inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 clamp(20px,5vw,40px);
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 4px 0;
}
.footer-logo {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--ink);
  grid-column: 1; grid-row: 1;
}
.footer-logo em { font-style: normal; color: var(--orange); }
.footer-links {
  display: flex;
  gap: 16px;
  grid-column: 2; grid-row: 1;
}
.footer-links a {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--ink-xlight);
  transition: color 0.2s;
}
.footer-links a:hover { color: var(--ink); }
.footer-copy {
  font-family: var(--sans);
  font-size: 11px;
  color: var(--ink-xlight);
  grid-column: 1 / -1; grid-row: 2;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  margin-top: 6px;
}
@media (max-width: 520px) {
  footer .inner {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    gap: 10px 0;
  }
  .footer-logo { grid-column: 1; grid-row: 1; }
  .footer-links { grid-column: 1; grid-row: 2; }
  .footer-copy { grid-column: 1; grid-row: 3; }
}

/* ── ICON BUTTONS ── */
.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-xlight);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  transition: color 0.2s;
}
.icon-btn:hover { color: var(--orange); }
.icon-btn svg { width: 15px; height: 15px; }

/* ── LIST AREA ── */
.list-area {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 80px;
  border: 1.5px dashed var(--border-dark);
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 16px;
  background-image: none;
}
.list-area.has-items {
  border-style: solid;
  border-color: var(--border);
  background-color: transparent;
}

/* ── DROP ZONE ── */
.drop-zone {
  border: 1.5px dashed var(--border-dark);
  background: var(--off-white);
  padding: 24px;
  border-radius: 8px;
  text-align: center;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--ink-xlight);
  text-transform: uppercase;
  transition: all 0.2s;
}
.drop-zone.dragover {
  border-color: var(--orange);
  background: var(--orange-light);
  color: var(--orange);
}

.drop-select-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 9px 14px;
  border: 1.5px solid var(--border-dark);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink-light);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.drop-select-btn:hover {
  background: var(--ink-light);
  color: white;
  border-color: var(--ink-light);
}

.drop-select-btn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 32px 0;
  font-size: 13px;
  color: var(--ink-xlight);
  border-radius: 8px;
}
.list-area .empty-state {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 12px;
}

/* ── CARD LABEL ROW (Result cards) ── */
.card-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 17px;
  gap: 10px;
}
.card-label-row .card-label { margin-bottom: 0; }
.card-label-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ── OPTIONS / RADIO ── */
.options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}
.option {
  display: flex;
  align-items: center;
  gap: 8px;
}
.option label {
  font-size: 13px;
  color: var(--ink-light);
  cursor: pointer;
}
.custom-radio {
  appearance: none;
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border: 1.5px solid var(--border-dark);
  border-radius: 50%;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  background: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.custom-radio:checked {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(161, 81, 244, 0.14);
}
.custom-radio:checked::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 8px; height: 8px;
  background: var(--orange);
  border-radius: 50%;
}
.custom-radio:focus-visible {
  outline: 2px solid rgba(161, 81, 244, 0.16);
  outline-offset: 2px;
}

.custom-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--border-dark);
  border-radius: 4px;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.2s, background 0.2s;
}

.custom-checkbox:checked {
  background: var(--ink);
  border-color: var(--ink);
}

.custom-checkbox:checked::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 8px;
  border-right: 1.5px solid white;
  border-bottom: 1.5px solid white;
  transform: translate(-50%, -58%) rotate(45deg);
}

.custom-checkbox:focus-visible {
  outline: 2px solid rgba(161, 81, 244, 0.16);
  outline-offset: 2px;
}

/* ── OUTPUT WRAP ── */
.output-wrap { position: relative; }
.output-wrap textarea {
  min-height: 140px;
  padding-right: 44px;
}
.select-all-row {
  margin-bottom: 12px;
}
.output-actions {
  position: absolute;
  top: 10px; right: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ── RESET WRAP ── */
.reset-wrap {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

/* ── BURGER OPEN STATE ── */
.burger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.burger.open span:nth-child(2) { opacity: 0; }
.burger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* ── DRAWER EXTRAS ── */
.drawer-close svg { width: 16px; height: 16px; }
.drawer-nav a::after { content: '→'; opacity: 0.3; font-size: 10px; }
.drawer-divider { height: 1px; background: var(--border); margin: 6px 0; }
.drawer-cta::after { display: none !important; }

/* ── MODAL EXTRAS ── */
.modal-close svg { width: 16px; height: 16px; }
.modal-section { margin-bottom: 20px; }
.modal-section:last-child { margin-bottom: 0; }
.modal-section ul li {
  font-size: 13px;
  color: var(--ink-light);
  padding-left: 18px;
  position: relative;
  line-height: 1.7;
}
.modal-section ul li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--ink-xlight);
}

@media (max-width: 560px) {
  .tab-bar {
    overflow-x: auto;
    scrollbar-width: thin;
  }
  .tab-btn {
    min-width: max-content;
    padding-inline: 14px;
    white-space: nowrap;
  }
  .card-label-row {
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .card-label-actions {
    width: 100%;
    justify-content: flex-end;
  }
  .output-wrap textarea {
    padding-right: 40px;
  }
}
