* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background: #f7f7f7;
  color: #202124;
}

button,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: .45;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: #fff;
  border-bottom: 1px solid #e4e4e4;
}

.menu-button {
  display: none;
  border: 0;
  background: transparent;
  font-size: 22px;
}

.logo {
  font-size: 20px;
}

.server-status {
  margin-left: auto;
  font-size: 12px;
  color: #777;
}

.layout {
  display: grid;
  grid-template-columns: 180px 1fr;
  min-height: calc(100vh - 56px);
}

.sidebar {
  padding: 14px 8px;
  background: #fff;
  border-right: 1px solid #e4e4e4;
}

.folder {
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
}

.folder.active,
.folder:not(:disabled):hover {
  background: #eeeeee;
}

.content {
  width: min(1400px, 100%);
  margin: 0 auto;
  padding: 20px;
}

.composer {
  max-width: 640px;
  margin: 0 auto 24px;
  background: #fff;
  border: 1px solid #dcdcdc;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

.composer:focus-within {
  border-color: #aaa;
  box-shadow: 0 2px 7px rgba(0,0,0,.11);
}

.composer textarea {
  width: 100%;
  min-height: 82px;
  padding: 14px;
  resize: vertical;
  border: 0;
  outline: 0;
  background: transparent;
  line-height: 1.5;
}

.composer-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 12px 10px 14px;
  font-size: 12px;
  color: #777;
}

.composer-actions {
  display: flex;
  gap: 7px;
}

.save-button,
.text-button,
.direction-button {
  border: 0;
  border-radius: 7px;
}

.save-button {
  padding: 7px 14px;
  background: #202124;
  color: #fff;
}

.text-button {
  padding: 7px 10px;
  background: transparent;
  color: #555;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.sort-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.toolbar select {
  padding: 7px 8px;
  border: 1px solid #d5d5d5;
  border-radius: 7px;
  background: #fff;
}

.direction-button {
  padding: 8px 9px;
  background: #ececec;
  white-space: nowrap;
}

.memo-grid {
  column-width: 230px;
  column-count: auto;
  column-gap: 12px;
}

.memo-card {
  position: relative;
  break-inside: avoid;
  margin: 0 0 12px;
  padding: 14px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
}

.memo-card:hover {
  border-color: #bbb;
}

.memo-content {
  margin: 0;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.memo-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.memo-date {
  font-size: 11px;
  color: #999;
}

.memo-actions {
  display: flex;
  gap: 3px;
}

.memo-actions button {
  padding: 4px 6px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #777;
  font-size: 12px;
}

.memo-actions button:hover {
  background: #eee;
  color: #222;
}

.empty-message {
  margin: 60px 0;
  text-align: center;
  color: #999;
}

.hidden {
  display: none !important;
}

.drawer-backdrop {
  display: none;
}

@media (max-width: 700px) {

  .menu-button {
    display: inline-block;
  }

  .layout {
    display: block;
  }

  .sidebar {
    position: fixed;
    z-index: 40;
    top: 56px;
    bottom: 0;
    left: 0;
    width: 220px;
    transform: translateX(-100%);
    transition: transform .14s ease;
    box-shadow: 4px 0 12px rgba(0,0,0,.12);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .drawer-backdrop {
    position: fixed;
    z-index: 30;
    inset: 56px 0 0 0;
    background: rgba(0,0,0,.16);
  }

  .drawer-backdrop.open {
    display: block;
  }

  .content {
    padding: 12px;
  }

  .composer {
    margin-bottom: 18px;
  }

  .toolbar {
    align-items: flex-start;
  }

  .sort-controls {
    flex-shrink: 0;
  }

  .toolbar select {
    max-width: 145px;
  }

  .memo-grid {
    column-width: 150px;
    column-count: auto;
    column-gap: 10px;
  }
}

.group-row {
  display: flex;
  align-items: center;
  gap: 2px;
}

.group-row .folder {
  flex: 1;
}

.group-tools {
  display: none;
  border: 0;
  background: transparent;
  padding: 6px;
  color: #888;
}

.group-row:hover .group-tools {
  display: block;
}

.group-count {
  margin-left: auto;
  padding-left: 8px;
  color: #999;
  font-size: 11px;
}

.add-group {
  margin-top: 5px;
}

.composer-options {
  padding: 0 12px 4px;
}

.composer-options select {
  max-width: 220px;
  padding: 5px 7px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
}

.memo-group {
  display: inline-block;
  margin-top: 10px;
  padding: 2px 6px;
  border-radius: 5px;
  background: #f1f1f1;
  color: #777;
  font-size: 11px;
}

.group-picker {
  position: relative;
  display: inline-block;
}

.group-picker summary {
  cursor: pointer;
  list-style: none;
  padding: 5px 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  font-size: 12px;
}

.group-picker summary::-webkit-details-marker {
  display: none;
}

.group-checkboxes {
  position: absolute;
  z-index: 25;
  top: calc(100% + 4px);
  left: 0;
  min-width: 190px;
  max-height: 240px;
  overflow-y: auto;
  padding: 6px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 5px 18px rgba(0,0,0,.12);
}

.group-checkbox-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 6px;
  cursor: pointer;
}

.group-checkbox-row:hover {
  background: #f3f3f3;
}

.memo-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 10px;
}


/* =========================================================
   mioMemo common UI theme + scale
   ========================================================= */

:root {
  --app-scale: 1;

  --bg: #f7f7f7;
  --surface: #ffffff;
  --surface-soft: #f1f1f1;
  --surface-hover: #eeeeee;

  --text: #202124;
  --text-soft: #777777;
  --text-faint: #999999;

  --line: #dddddd;
  --line-strong: #bbbbbb;

  --button: #202124;
  --button-text: #ffffff;

  --overlay: rgba(0, 0, 0, .16);
  --shadow: rgba(0, 0, 0, .10);
}

html {
  font-size: calc(16px * var(--app-scale));
}

html[data-theme="black"] {
  --bg: #151617;
  --surface: #202224;
  --surface-soft: #292c2f;
  --surface-hover: #303438;

  --text: #f2f2f2;
  --text-soft: #b7b7b7;
  --text-faint: #898989;

  --line: #373b3f;
  --line-strong: #555b61;

  --button: #f2f2f2;
  --button-text: #18191a;

  --overlay: rgba(0, 0, 0, .48);
  --shadow: rgba(0, 0, 0, .28);
}

html[data-theme="peach"] {
  --bg: #fff4f0;
  --surface: #fffaf8;
  --surface-soft: #fbe7e1;
  --surface-hover: #f7ddd5;

  --text: #392b28;
  --text-soft: #806963;
  --text-faint: #a58c85;

  --line: #ecd4cc;
  --line-strong: #d8b4a9;

  --button: #8b5f55;
  --button-text: #ffffff;

  --overlay: rgba(93, 58, 49, .16);
  --shadow: rgba(93, 58, 49, .10);
}

html[data-theme="cyan"] {
  --bg: #eef9fb;
  --surface: #f9feff;
  --surface-soft: #dff3f6;
  --surface-hover: #d3edf1;

  --text: #18363b;
  --text-soft: #55777d;
  --text-faint: #77979d;

  --line: #c7e4e8;
  --line-strong: #9ccbd2;

  --button: #237c8a;
  --button-text: #ffffff;

  --overlay: rgba(20, 78, 87, .16);
  --shadow: rgba(20, 78, 87, .10);
}

body {
  background: var(--bg);
  color: var(--text);
}

.topbar,
.sidebar,
.composer,
.memo-card,
.group-checkboxes {
  background: var(--surface);
  color: var(--text);
}

.topbar,
.sidebar {
  border-color: var(--line);
}

.composer,
.memo-card,
.group-picker summary,
.composer-options select,
.toolbar select {
  border-color: var(--line);
}

.folder.active,
.folder:not(:disabled):hover,
.memo-actions button:hover,
.group-checkbox-row:hover {
  background: var(--surface-hover);
}

.memo-group,
.direction-button {
  background: var(--surface-soft);
  color: var(--text-soft);
}

.composer textarea,
.toolbar select,
.composer-options select,
.group-picker summary {
  background: var(--surface);
  color: var(--text);
}

.server-status,
.composer-footer,
.memo-date,
.group-count,
.group-tools {
  color: var(--text-soft);
}

.empty-message {
  color: var(--text-faint);
}

.save-button {
  background: var(--button);
  color: var(--button-text);
}

.composer {
  box-shadow: 0 1px 4px var(--shadow);
}

.composer:focus-within {
  border-color: var(--line-strong);
  box-shadow: 0 2px 7px var(--shadow);
}

.memo-card:hover {
  border-color: var(--line-strong);
}

.drawer-backdrop {
  background: var(--overlay);
}

.topbar-tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: .65rem;
}

.zoom-control,
.theme-control {
  display: flex;
  align-items: center;
  gap: .25rem;
}

.icon-tool,
.zoom-value {
  min-width: 1.8rem;
  height: 1.8rem;
  padding: 0 .35rem;
  border: 1px solid var(--line);
  border-radius: .4rem;
  background: var(--surface);
  color: var(--text);
}

.zoom-value {
  min-width: 3.4rem;
  font-size: .72rem;
}

.theme-dot {
  width: 1.25rem;
  height: 1.25rem;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--line-strong);
}

.theme-dot.active {
  border-color: var(--text);
}

.theme-white {
  background: #ffffff;
}

.theme-black {
  background: #202224;
}

.theme-peach {
  background: #efb8aa;
}

.theme-cyan {
  background: #77d4df;
}

@media (max-width: 700px) {
  .topbar {
    padding-left: .55rem;
    padding-right: .55rem;
    gap: .4rem;
  }

  .topbar-tools {
    gap: .35rem;
  }

  .theme-control {
    gap: .18rem;
  }

  .theme-dot {
    width: 1rem;
    height: 1rem;
  }

  .icon-tool {
    min-width: 1.55rem;
    height: 1.55rem;
  }

  .zoom-value {
    min-width: 2.9rem;
    height: 1.55rem;
    font-size: .65rem;
  }

  .server-status {
    display: none;
  }
}


/* =========================================================
   2n4u central login
   ========================================================= */

.auth-controls {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .78rem;
  color: var(--text-soft);
}

.auth-gate {
  min-height: calc(100vh - 56px);
  display: grid;
  place-items: center;
  padding: 1.2rem;
  background: var(--bg);
}

.login-panel {
  width: min(22rem, 100%);
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: .8rem;
  background: var(--surface);
  box-shadow: 0 .3rem 1.3rem var(--shadow);
}

.login-panel h1 {
  margin: 0;
  text-align: center;
  font-size: 1.55rem;
}

.login-subtitle {
  margin: .35rem 0 1.3rem;
  text-align: center;
  color: var(--text-soft);
  font-size: .82rem;
}

.login-panel label {
  display: block;
  margin-top: .8rem;
}

.login-panel label span {
  display: block;
  margin-bottom: .3rem;
  color: var(--text-soft);
  font-size: .75rem;
}

.login-panel input {
  width: 100%;
  padding: .7rem .75rem;
  border: 1px solid var(--line);
  border-radius: .45rem;
  outline: none;
  background: var(--surface);
  color: var(--text);
}

.login-panel input:focus {
  border-color: var(--line-strong);
}

.login-button {
  width: 100%;
  margin-top: 1.1rem;
}

.login-error {
  margin: .8rem 0 0;
  color: #b43a3a;
  font-size: .78rem;
  line-height: 1.45;
}

html[data-theme="black"] .login-error {
  color: #ff8e8e;
}


/* =========================================================
   mioMemo service enrollment
   ========================================================= */

.enrollment-panel {
  width: min(38rem, 100%);
}

.legal-list {
  display: grid;
  gap: .65rem;
  margin: 1rem 0;
}

.legal-item {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: .55rem;
  background: var(--surface);
}

.legal-check {
  display: flex !important;
  align-items: flex-start;
  gap: .55rem;
  margin: 0 !important;
  padding: .7rem .8rem;
}

.legal-check input {
  width: auto;
  margin-top: .15rem;
}

.legal-check span {
  margin: 0 !important;
  color: var(--text) !important;
  font-size: .8rem !important;
}

.legal-check small {
  margin-left: .25rem;
  color: var(--text-soft);
}

.legal-item details {
  border-top: 1px solid var(--line);
}

.legal-item summary {
  padding: .5rem .8rem;
  cursor: pointer;
  color: var(--text-soft);
  font-size: .72rem;
}

.legal-item pre {
  max-height: 16rem;
  margin: 0;
  padding: .8rem;
  overflow: auto;

  white-space: pre-wrap;
  word-break: break-word;

  background:
    var(--surface-soft);

  color:
    var(--text);

  font-family:
    inherit;

  font-size:
    .72rem;

  line-height:
    1.55;
}

.enrollment-cancel {
  display: block;
  width: 100%;
  margin-top: .65rem;
  text-align: center;
}


/* =========================================================
   mioMemo sidebar theme text fix
   ========================================================= */

/*
 * button/input 등 form control은 브라우저 기본 글자색을
 * 사용할 수 있으므로 사이드바에서는 현재 테마 글자색을
 * 명시적으로 적용한다.
 */

aside,
.sidebar,
#sidebar {
  color: var(--text);
}

aside button,
aside a,
aside [role="button"],
.sidebar button,
.sidebar a,
.sidebar [role="button"],
#sidebar button,
#sidebar a,
#sidebar [role="button"] {
  color: var(--text) !important;
}

aside button:disabled,
.sidebar button:disabled,
#sidebar button:disabled {
  color: var(--text-soft) !important;
}

/*
 * 사이드바 내부의 일반 텍스트도 테마를 상속하도록 한다.
 * 개별 accent/count 색이 명시된 요소는 그 규칙을 유지한다.
 */
aside button *,
.sidebar button *,
#sidebar button * {
  color: inherit;
}


/* =========================================================
   mioMemo central registration v0.8.2
   ========================================================= */

.auth-secondary-button {
  display: block;
  width: 100%;
  margin-top: .65rem;
  text-align: center;
}

.registration-panel {
  width: min(42rem, 100%);
}

.registration-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 .75rem;
}

.username-check-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .5rem;
  align-items: center;
}

.username-check-row input {
  min-width: 0;
}

.compact-button {
  min-height: 2.5rem;
  padding: .55rem .75rem;
  border: 1px solid var(--line);
  border-radius: .5rem;
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.compact-button:hover:not(:disabled) {
  background: var(--surface);
}

.compact-button:disabled {
  cursor: wait;
  opacity: .6;
}

.username-availability {
  margin: -.2rem 0 .7rem;
  font-size: .75rem;
  line-height: 1.45;
}

.username-availability.available {
  color: var(--accent);
}

.username-availability.unavailable {
  color: #b23a3a;
}

html[data-theme="black"] .username-availability.unavailable {
  color: #ff8e8e;
}

.registration-help,
.common-legal-note {
  color: var(--text-soft);
  font-size: .72rem;
  line-height: 1.5;
}

.registration-help {
  margin: .15rem 0 .9rem;
}

.registration-section-title {
  margin: 1rem 0 .4rem;
  color: var(--text);
  font-size: .82rem;
  font-weight: 700;
}

.registration-legal-list {
  margin-top: .45rem;
}

.common-legal-note {
  margin: 0;
  padding: 0 .8rem .7rem 2.1rem;
}

@media (max-width: 640px) {
  .registration-fields {
    grid-template-columns: 1fr;
  }

  .registration-panel {
    width: 100%;
  }
}


/* =========================================================
   mioMemo v0.9.0 topbar menus / icon sort / PWA
   ========================================================= */

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.topbar-tools {
  margin-left: auto;
  gap: .3rem;
}

.server-status {
  margin-left: 0;
  padding: .22rem .5rem;
  border-radius: 999px;
  background: #fff0f0;
  color: #a52d2d;
  font-size: .7rem;
  white-space: nowrap;
}

html[data-theme="black"] .server-status {
  background: #4a2525;
  color: #ffaaaa;
}

.topbar-menu-wrap {
  position: relative;
}

.topbar-icon-button {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-soft);
}

.topbar-icon-button:hover,
.topbar-icon-button[aria-expanded="true"] {
  background: var(--surface-hover);
  color: var(--text);
}

.topbar-icon-button svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: currentColor;
}

.topbar-popover {
  position: absolute;
  z-index: 80;
  top: calc(100% + .45rem);
  right: 0;
  min-width: 14.5rem;
  overflow: hidden;
  padding: .35rem;
  border: 1px solid var(--line);
  border-radius: .7rem;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 .45rem 1.4rem var(--shadow);
}

.menu-row {
  width: 100%;
  min-height: 2.5rem;
  display: grid;
  grid-template-columns: 1.6rem 1fr auto;
  align-items: center;
  gap: .4rem;
  padding: .48rem .55rem;
  border: 0;
  border-radius: .45rem;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.menu-row:hover {
  background: var(--surface-hover);
}

.menu-row-icon {
  width: 1.45rem;
  display: inline-grid;
  place-items: center;
  color: var(--text-soft);
  font-size: 1rem;
}

.menu-row-chevron {
  color: var(--text-soft);
  font-size: 1.15rem;
  transition: transform .12s ease;
}

#appearanceMenuButton[aria-expanded="true"]
  .menu-row-chevron {
  transform: rotate(90deg);
}

.appearance-panel {
  margin: 0 .35rem .35rem;
  padding: .6rem;
  border-radius: .5rem;
  background: var(--surface-soft);
}

.settings-label {
  margin: .15rem 0 .35rem;
  color: var(--text-soft);
  font-size: .68rem;
}

.appearance-panel .zoom-control {
  margin-bottom: .6rem;
}

.appearance-panel .theme-control {
  padding: .1rem .05rem .2rem;
}

.menu-version {
  padding: .35rem .55rem .2rem 2.55rem;
  color: var(--text-faint);
  font-size: .65rem;
}

.update-ready {
  font-weight: 700;
}

.update-ready .menu-row-icon {
  color: #0b8a56;
}

.user-menu {
  min-width: 13rem;
}

.user-summary {
  display: grid;
  gap: .15rem;
  padding: .6rem .65rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: .25rem;
}

.user-summary-label {
  color: var(--text-faint);
  font-size: .65rem;
}

.user-summary strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .8rem;
}

.danger-row {
  color: #a83232;
}

html[data-theme="black"] .danger-row {
  color: #ff9999;
}

.sort-controls {
  gap: .35rem;
}

.sort-field-buttons {
  display: flex;
  align-items: center;
  gap: .2rem;
  padding: .18rem;
  border: 1px solid var(--line);
  border-radius: .55rem;
  background: var(--surface);
}

.sort-icon-button,
.sort-direction {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: .4rem;
  background: transparent;
  color: var(--text-soft);
}

.sort-icon-button:hover,
.sort-direction:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.sort-icon-button.active {
  background: var(--surface-soft);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.sort-icon-button svg,
.sort-direction svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: currentColor;
}

.sort-direction {
  border: 1px solid var(--line);
  background: var(--surface);
}

.direction-arrow {
  transition: transform .12s ease;
}

.sort-direction[data-direction="asc"]
  .direction-arrow {
  transform: rotate(180deg);
}

.app-toast {
  position: fixed;
  z-index: 120;
  left: 50%;
  bottom: 1.2rem;
  transform: translateX(-50%);
  max-width: min(28rem, calc(100vw - 2rem));
  padding: .6rem .85rem;
  border: 1px solid var(--line);
  border-radius: .65rem;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 .4rem 1.4rem var(--shadow);
  font-size: .76rem;
  text-align: center;
}

@media (max-width: 700px) {
  .topbar-tools {
    gap: .1rem;
  }

  .topbar-icon-button {
    width: 1.9rem;
    height: 1.9rem;
  }

  .topbar-popover {
    position: fixed;
    top: 3.45rem;
    right: .5rem;
    max-width: calc(100vw - 1rem);
  }

  .server-status:not(.hidden) {
    display: inline-flex !important;
    max-width: 7rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .toolbar {
    align-items: center;
  }

  .sort-icon-button,
  .sort-direction {
    width: 1.9rem;
    height: 1.9rem;
  }
}


/* =========================================================
   mioMemo v0.9.1 compact memo preview + floating editor
   ========================================================= */

.memo-content {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 10;
  overflow: hidden;
  max-height: 15em;
  cursor: pointer;
}

.memo-content:focus-visible {
  outline: 2px solid var(--line-strong);
  outline-offset: 3px;
  border-radius: .2rem;
}

.memo-meta {
  flex-wrap: wrap;
}

.memo-fab {
  position: fixed;
  z-index: 70;
  right: max(1.1rem, env(safe-area-inset-right));
  bottom: max(1.1rem, calc(env(safe-area-inset-bottom) + .6rem));
  width: 4rem;
  height: 4rem;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 1.25rem;
  background: var(--button);
  color: var(--button-text);
  box-shadow: 0 .45rem 1.25rem var(--shadow);
}

.memo-fab span {
  transform: translateY(-.06em);
  font-size: 2.35rem;
  font-weight: 300;
  line-height: 1;
}

.memo-fab:hover {
  transform: translateY(-1px);
}

.memo-fab:active {
  transform: translateY(1px);
}

.memo-editor-open {
  overflow: hidden;
}

.memo-editor-overlay {
  position: fixed;
  z-index: 110;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1.2rem;
  background: var(--overlay);
}

.memo-editor-panel {
  width: min(44rem, 100%);
  max-height: min(90vh, 52rem);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 .8rem 2.2rem var(--shadow);
}

.memo-editor-header {
  position: sticky;
  z-index: 3;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 3.2rem;
  padding: .65rem .8rem .65rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.memo-editor-header strong {
  font-size: 1rem;
}

.memo-editor-close {
  width: 2.2rem;
  height: 2.2rem;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-soft);
  font-size: 1.65rem;
  line-height: 1;
}

.memo-editor-close:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.memo-editor-composer {
  max-width: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.memo-editor-composer:focus-within {
  border-color: transparent;
  box-shadow: none;
}

.memo-editor-composer textarea {
  min-height: 20rem;
  max-height: 58vh;
  resize: vertical;
  font-size: 1rem;
}

.memo-editor-composer .composer-footer {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

@media (min-width: 360px) and (max-width: 520px) {
  .memo-grid {
    column-width: auto;
    column-count: 2;
    column-gap: .6rem;
  }
}

@media (max-width: 700px) {
  .content {
    padding: .65rem;
    padding-bottom: 5.4rem;
  }

  .memo-card {
    margin-bottom: .6rem;
    padding: .75rem;
    border-radius: .8rem;
  }

  .memo-content {
    -webkit-line-clamp: 8;
    max-height: 12em;
    line-height: 1.5;
  }

  .memo-actions {
    margin-left: auto;
  }

  .memo-actions button {
    padding: .25rem .3rem;
    font-size: .68rem;
  }

  .memo-date {
    font-size: .65rem;
  }

  .memo-fab {
    right: max(1rem, env(safe-area-inset-right));
    bottom: max(1rem, calc(env(safe-area-inset-bottom) + .45rem));
    width: 4.25rem;
    height: 4.25rem;
    border-radius: 1.35rem;
  }

  .memo-editor-overlay {
    place-items: stretch;
    padding: 0;
    background: var(--surface);
  }

  .memo-editor-panel {
    width: 100%;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .memo-editor-header {
    min-height: 3.5rem;
    padding-top: max(.65rem, env(safe-area-inset-top));
  }

  .memo-editor-composer textarea {
    min-height: calc(100dvh - 11rem);
    max-height: none;
    resize: none;
    font-size: 1.02rem;
  }

  .memo-editor-composer .composer-footer {
    padding-bottom: max(.65rem, env(safe-area-inset-bottom));
  }
}

@media (max-width: 359px) {
  .memo-grid {
    column-width: 140px;
    column-count: auto;
  }
}
