:root {
  color-scheme: light;
  --ink: #172b32;
  --muted: #5d7077;
  --subtle: #829198;
  --line: #d8e1e4;
  --paper: #f2f5f5;
  --surface: #ffffff;
  --teal: #126e75;
  --teal-dark: #0e5359;
  --teal-soft: #d8edeb;
  --amber: #b9652d;
  --shadow: 0 14px 40px rgba(21, 45, 52, .14);
  font-family: "Yu Gothic UI", "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; color: var(--ink); background: var(--paper); }
button, input { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

.topbar { position: sticky; z-index: 5; top: 0; display: flex; align-items: center; justify-content: space-between; min-height: 66px; padding: 10px max(18px, env(safe-area-inset-left)); background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand > span:last-child { display: grid; gap: 1px; }
.brand strong { font-size: 15px; line-height: 1.2; }
.brand small { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .12em; }
.brand-mark { display: flex; align-items: center; gap: 2px; width: 30px; height: 30px; padding: 6px; background: var(--teal); border-radius: 7px; }
.brand-mark i { display: block; width: 4px; border-radius: 3px; background: #f3c37a; }
.brand-mark i:nth-child(1) { height: 9px; }
.brand-mark i:nth-child(2) { height: 15px; }
.brand-mark i:nth-child(3) { height: 11px; }
.top-actions { display: flex; align-items: center; gap: 7px; }
.connection-status, .save-status { color: var(--muted); font-size: 11px; white-space: nowrap; }
.connection-status::before { display: inline-block; width: 7px; height: 7px; margin-right: 5px; content: ""; background: #2c8a63; border-radius: 50%; }
.connection-status.is-offline::before { background: var(--amber); }

.icon-button, .button, .close-button, .view-tab, .search-box button, .crumb-button, .destination-choice, .restore-button, .assign-here { min-height: 42px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); cursor: pointer; touch-action: manipulation; }
.icon-button { min-width: 49px; padding: 0 9px; color: var(--teal-dark); font-size: 12px; font-weight: 750; }
.icon-button:active, .button:active, .destination-choice:active { transform: translateY(1px); }
main { width: min(100%, 920px); margin: 0 auto; padding: 20px 16px calc(108px + env(safe-area-inset-bottom)); }
.welcome-panel { max-width: 620px; margin: clamp(35px, 12vh, 110px) auto 0; padding: clamp(24px, 6vw, 48px); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.eyebrow { margin: 0 0 7px; color: var(--teal); font-size: 10px; font-weight: 800; letter-spacing: .13em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(23px, 6vw, 32px); line-height: 1.25; }
.welcome-copy { max-width: 42em; margin: 14px 0 22px; color: var(--muted); font-size: 14px; line-height: 1.8; }
.transfer-steps { display: grid; gap: 9px; margin: 0 0 22px; padding-left: 22px; color: var(--ink); font-size: 13px; line-height: 1.65; }
.transfer-steps li { padding-left: 3px; }
.fine-print { margin: 15px 0 0; color: var(--subtle); font-size: 11px; line-height: 1.7; }
.button { padding: 0 16px; color: var(--ink); font-weight: 700; }
.button-primary { color: #fff; background: var(--teal); border-color: var(--teal); }
.button-primary:hover { background: var(--teal-dark); }
.button:disabled { opacity: .45; cursor: not-allowed; }

.workspace-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 8px 2px 18px; }
.workspace-heading h1 { margin: 0; font-size: 25px; }
.save-status { padding-bottom: 3px; }
.view-tabs { position: sticky; z-index: 4; top: 66px; display: grid; grid-template-columns: repeat(3,1fr); gap: 4px; margin: 0 -2px 18px; padding: 4px; background: #e3e9e9; border: 1px solid var(--line); border-radius: 8px; }
.view-tab { min-height: 42px; border: 0; background: transparent; color: var(--muted); font-size: 13px; font-weight: 750; }
.view-tab span { display: inline-grid; min-width: 19px; height: 19px; margin-left: 3px; padding: 0 4px; place-items: center; background: rgba(23,43,50,.08); border-radius: 10px; font-size: 10px; }
.view-tab.is-active { color: var(--teal-dark); background: var(--surface); box-shadow: 0 1px 4px rgba(23,43,50,.11); }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin: 0 0 12px; }
.section-heading h2 { margin: 0 0 3px; font-size: 17px; }
.section-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.search-box { display: flex; align-items: center; gap: 9px; min-height: 46px; margin: 0 0 17px; padding: 0 12px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.search-box span { font-size: 21px; line-height: 1; }
.search-box input { width: 100%; min-width: 0; height: 42px; padding: 0; color: var(--ink); background: transparent; border: 0; outline: 0; font-size: 14px; }
.search-box input::placeholder { color: #87969b; }
.search-box button { width: 32px; min-height: 32px; border: 0; color: var(--muted); background: transparent; font-size: 20px; }
.pool-groups { display: grid; gap: 20px; }
.group-section { min-width: 0; }
.group-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 2px 7px; padding-bottom: 6px; border-bottom: 1px solid #cbd8da; }
.group-heading h3 { margin: 0; color: var(--teal-dark); font-size: 13px; }
.group-heading span { color: var(--muted); font-size: 11px; }
.prompt-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
.prompt-card { display: grid; align-content: start; min-width: 0; min-height: 76px; padding: 11px 12px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.prompt-card:hover { border-color: #80aaa9; }
.prompt-card.is-selected { background: var(--teal-soft); border-color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal); }
.prompt-ja { overflow-wrap: anywhere; font-size: 14px; font-weight: 750; line-height: 1.45; }
.prompt-en { overflow-wrap: anywhere; margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.selection-dock { position: fixed; z-index: 6; right: 0; bottom: 0; left: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px max(16px,calc((100vw - 888px)/2)) calc(12px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.97); border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(21,45,52,.08); backdrop-filter: blur(12px); }
.selection-copy { display: grid; min-width: 0; gap: 2px; }
.selection-label { color: var(--muted); font-size: 10px; }
.selection-copy strong { overflow: hidden; max-width: 44vw; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.selection-dock .button { flex: 0 0 auto; min-height: 46px; }
.breadcrumbs { display: flex; align-items: center; gap: 5px; overflow-x: auto; margin: 0 0 14px; padding: 2px 0 5px; white-space: nowrap; scrollbar-width: thin; }
.crumb-button { flex: 0 0 auto; min-height: 35px; padding: 0 10px; color: var(--teal-dark); font-size: 12px; }
.crumb-separator { color: var(--subtle); }
.tree-list, .trash-list { display: grid; gap: 7px; }
.tree-row, .trash-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; padding: 11px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.tree-row-main, .trash-row-main { display: grid; min-width: 0; gap: 3px; }
.tree-row-main strong, .trash-row-main strong { overflow-wrap: anywhere; font-size: 14px; }
.tree-row-main small, .trash-row-main small { overflow-wrap: anywhere; color: var(--muted); font-size: 11px; }
.tree-row-category { width: 100%; text-align: left; cursor: pointer; }
.tree-row-category::after { flex: 0 0 auto; color: var(--teal); content: "›"; font-size: 25px; line-height: 1; }
.restore-button { flex: 0 0 auto; min-height: 38px; padding: 0 10px; color: var(--teal-dark); font-size: 12px; font-weight: 700; }
.empty-state { margin: 16px 0; padding: 25px 18px; text-align: center; background: var(--surface); border: 1px dashed #b9c8ca; border-radius: 7px; }
.empty-state h2 { margin: 0 0 6px; font-size: 15px; }
.empty-state p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.destination-dialog { width: min(100% - 20px,560px); max-width: 560px; max-height: min(82dvh,760px); padding: 0; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.destination-dialog::backdrop { background: rgba(12,31,36,.52); backdrop-filter: blur(3px); }
.dialog-shell { display: grid; gap: 12px; padding: 17px; }
.dialog-heading { display: flex; align-items: start; justify-content: space-between; }
.dialog-heading h2 { margin: 0; font-size: 19px; }
.close-button { width: 42px; padding: 0; color: var(--muted); font-size: 22px; }
.destination-candidate { margin: 0; padding: 9px 11px; background: var(--teal-soft); border-radius: 5px; font-size: 13px; font-weight: 700; }
.assign-here { display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 0 13px; text-align: left; color: var(--teal-dark); background: var(--teal-soft); border-color: #a5cdca; font-weight: 750; }
.assign-here:disabled { opacity: .48; cursor: not-allowed; }
.destination-list { display: grid; gap: 6px; overflow-y: auto; max-height: 40dvh; padding-bottom: 3px; }
.destination-choice { display: flex; align-items: center; justify-content: space-between; min-height: 46px; padding: 0 12px; text-align: left; font-size: 13px; }
.destination-choice span:last-child { color: var(--teal); font-size: 19px; }
.toast { position: fixed; z-index: 10; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); left: 16px; width: fit-content; max-width: min(520px,calc(100vw - 32px)); margin: 0 auto; padding: 11px 14px; color: #fff; background: #173b40; border-radius: 6px; box-shadow: var(--shadow); font-size: 13px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity .18s ease,transform .18s ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }

@media (min-width:700px) {
  main { padding-top: 30px; }
  .prompt-list { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; }
  .prompt-card { min-height: 82px; padding: 13px 14px; }
  .group-heading h3 { font-size: 14px; }
}
@media (max-width:370px) {
  .topbar { padding-right: 10px; padding-left: 10px; }
  .top-actions { gap: 4px; }
  .connection-status { font-size: 10px; }
  .icon-button { min-width: 43px; padding: 0 7px; }
  main { padding-right: 11px; padding-left: 11px; }
  .prompt-list { grid-template-columns: 1fr; }
}