/* UI refinements v1 — viewport lock, clean chat header, scrollable sticky notes */

html[data-shell="angel-white"],
html[data-shell="angel-white"] body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

html[data-shell="angel-white"] #app {
  position: fixed;
  inset: 0;
  width: 100%;
  height: auto;
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

html[data-shell="angel-white"] #home-page {
  overscroll-behavior: none !important;
}

html[data-shell="angel-white"] #nav-bar::before {
  display: none;
}

/* Chat header reads as one compact terminal label instead of a second profile card. */
html[data-shell="angel-white"] #header .avatar {
  display: none !important;
}

html[data-shell="angel-white"] #header {
  gap: 0;
  padding-inline: max(13px, env(safe-area-inset-left, 0px)) max(12px, env(safe-area-inset-right, 0px));
}

html[data-shell="angel-white"] #header .name-group {
  padding-left: 0;
}

/* Keep the useful home avatar, but remove the bright double halo. */
html[data-shell="angel-white"] .home-note-avatar {
  border: 0 !important;
  box-shadow: none !important;
}

/* Sticky-note column matches the calendar and owns its scrolling. */
html[data-shell="angel-white"] #panel-memo.home-memo-window {
  position: relative;
  display: flex !important;
  flex-direction: column;
  align-self: stretch;
  box-sizing: border-box;
  height: auto;
  min-height: 0;
  max-height: none;
  overflow: hidden !important;
  contain: layout paint;
}

html[data-shell="angel-white"] #panel-memo .home-panel-list {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  height: 0;
  max-height: none;
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: scroll !important;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding-bottom: 56px;
  scrollbar-width: none;
}

html[data-shell="angel-white"] #panel-memo .home-panel-list::-webkit-scrollbar {
  display: none;
}

html[data-shell="angel-white"] #panel-memo .home-panel-item {
  display: block;
  flex: 0 0 auto;
  width: 100%;
  min-height: max-content;
  box-sizing: border-box;
  cursor: pointer;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
}

html[data-shell="angel-white"] #panel-memo :is(.edit-btn, .del-btn) {
  display: none !important;
}

html[data-shell="angel-white"] #panel-memo .memo-copy {
  width: 100%;
}

html[data-shell="angel-white"] #panel-memo .memo-text {
  display: block;
  overflow: visible;
  -webkit-line-clamp: unset;
}

html[data-shell="angel-white"] #panel-memo .memo-meta {
  display: block !important;
  min-height: 9px;
  overflow: visible;
}

/* Light shell: thin silver outlines, no floating card shadows. */
html[data-shell="angel-white"][data-theme="light"] #home-page :is(
  .home-cover-shell,
  .home-cover,
  .home-note,
  .software-window,
  .home-panel-item,
  .home-kk-button,
  .home-cover-btn,
  .home-cover-clear,
  #dignity-casino-entry,
  #memo-compose-toggle
) {
  box-shadow: none !important;
}

html[data-shell="angel-white"][data-theme="light"] :is(
  #status-picker,
  #paw-menu,
  #composer-plus-menu,
  #scroll-bottom-btn,
  .settings-card,
  .backup-sheet-card,
  .secondary-sheet,
  .home-day-detail,
  .favorite-item,
  .message-action-preview,
  .message-action-list button
) {
  box-shadow: none !important;
}

html[data-shell="angel-white"][data-theme="light"] .settings-card {
  border: 1px solid var(--border-light);
}

/* Pale paper still needs a crisp edge against the white shell. */
html[data-shell="angel-white"][data-theme="light"] #panel-memo .home-panel-item {
  border: .75px solid rgba(91, 116, 130, .38) !important;
}

/* Light-mode software bars: cool silver-blue instead of hard black. */
html[data-shell="angel-white"][data-theme="light"] :is(
  .week-wrap,
  .home-primary-card
) .window-titlebar {
  color: #536873;
  border-bottom: 1px solid rgba(91, 116, 130, .38);
  background: linear-gradient(180deg, #f1f5f6 0%, #d7e0e4 48%, #bdcbd1 100%);
  box-shadow: none;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .72);
}

html[data-shell="angel-white"][data-theme="light"] :is(
  .week-wrap,
  .home-primary-card
) .window-titlebar::after {
  opacity: .3;
  background: repeating-linear-gradient(0deg, transparent 0 2px, #667d88 2px 3px);
}

html[data-shell="angel-white"][data-theme="light"] :is(
  .week-wrap,
  .home-primary-card
) :is(.window-play, .window-status) {
  color: #647c87;
}

/* Dark-mode bars stay near-black, with a restrained violet signal tint. */
html[data-shell="angel-white"]:not([data-theme="light"]) :is(
  .week-wrap,
  .home-primary-card
) .window-titlebar {
  color: #ddd9e8;
  border-bottom-color: rgba(184, 166, 218, .22);
  background: linear-gradient(180deg, #292a35 0%, #191a22 52%, #0d0e12 100%);
}

html[data-shell="angel-white"]:not([data-theme="light"]) :is(
  .week-wrap,
  .home-primary-card
) .window-titlebar::after {
  opacity: .22;
  background: repeating-linear-gradient(0deg, transparent 0 2px, #a79abf 2px 3px);
}

/* Composer states: one clean edge for send, explicit recording controls. */
#send-btn.send-mode {
  box-sizing: border-box;
  overflow: hidden;
  border: .75px solid color-mix(in srgb, var(--accent) 62%, var(--text-dim)) !important;
  background: var(--accent) !important;
  background-image: none !important;
  background-clip: border-box;
  box-shadow: none !important;
}

html[data-shell="angel-white"][data-theme="light"] #send-btn.send-mode {
  color: #f9fbfc;
  border-color: color-mix(in srgb, var(--accent) 64%, #71858e) !important;
}

html[data-shell="angel-white"]:not([data-theme="light"]) #send-btn.send-mode {
  color: #0b0c0f;
  border-color: rgba(221, 215, 235, .22) !important;
}

#voice-recording-bar {
  display: none;
  flex: 1;
  min-width: 0;
  height: 36px;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  box-sizing: border-box;
  border: 1px solid var(--border-light);
  border-radius: 13px;
  color: var(--text-secondary);
  background: var(--bg-block);
  font: 500 12px/1 ui-monospace, "SF Mono", Menlo, monospace;
}

.input-row.recording-active #attach-btn,
.input-row.recording-active textarea,
.input-row.voice-ready #attach-btn,
.input-row.voice-ready textarea {
  display: none;
}

.input-row.recording-active #voice-recording-bar,
.input-row.voice-ready #voice-recording-bar {
  display: flex;
}

.input-row.voice-ready .voice-recording-dot {
  animation: none;
  background: var(--accent);
}

#send-btn.recording {
  width: 50px;
  border-radius: 12px;
}

.voice-stop-label {
  font: 500 11px/1 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: .04em;
}

.voice-recording-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  background: #ba6674;
  animation: voice-recording-dot 1.1s ease-in-out infinite;
}

#voice-recording-time { min-width: 39px; }

#voice-recording-play {
  display: none;
  padding: 5px 2px;
  border: 0;
  color: var(--accent);
  background: transparent;
  font: inherit;
}

.input-row.voice-ready #voice-recording-play {
  display: inline-block;
}

#voice-recording-cancel {
  margin-left: auto;
  padding: 5px 2px;
  border: 0;
  color: #b86674;
  background: transparent;
  font: inherit;
}

@keyframes voice-recording-dot { 50% { opacity: .38; } }

.msg-thinking .thinking-content,
.tool-call .tool-detail {
  -webkit-user-select: text;
  user-select: text;
  touch-action: pan-y;
}

html[data-shell="angel-white"] #memo-compose-toggle {
  position: absolute;
  right: 7px;
  bottom: 7px;
  z-index: 5;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--home-line);
  border-radius: 50%;
  color: #627681;
  background: color-mix(in srgb, var(--bg-block) 88%, transparent);
  box-shadow: 0 4px 12px rgba(38,49,57,.16), inset 0 1px 0 rgba(255,255,255,.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
}

html[data-shell="angel-white"] #memo-compose-toggle svg {
  width: 16px;
  height: 16px;
}

html[data-shell="angel-white"] #memo-compose-toggle.active {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}

html[data-shell="angel-white"] #panel-memo .home-panel-add {
  position: absolute;
  left: 7px;
  right: 47px;
  bottom: 7px;
  z-index: 4;
  display: none;
  margin: 0;
  padding: 0;
  border: 0;
}

html[data-shell="angel-white"] #panel-memo .home-panel-add.open {
  display: flex;
}

html[data-shell="angel-white"] #panel-memo .home-panel-add input {
  height: 34px;
  padding: 7px 9px;
  font-size: 10px;
  box-shadow: 0 4px 12px rgba(38,49,57,.12);
}

html[data-shell="angel-white"] #panel-memo .home-panel-add button {
  min-width: 42px;
  height: 34px;
  padding: 0 7px;
  font-size: 9px;
}

.memo-action-card {
  min-height: 0;
}

.memo-action-delete {
  color: #c86f79 !important;
}

html[data-shell="angel-white"]:not([data-theme="light"]) #memo-compose-toggle {
  color: #bbb3ca;
  border-color: rgba(210,216,228,.15);
  background: rgba(27,29,35,.9);
  box-shadow: 0 5px 14px rgba(0,0,0,.32), inset 0 1px 0 rgba(255,255,255,.055);
}

@media (max-width: 380px) {
  html[data-shell="angel-white"] #panel-memo.home-memo-window {
    height: 240px;
    max-height: 240px;
  }
}
