@import "antd/dist/reset.css";

:root {
  --ss-app-height: 100vh;
  --ss-safe-area-top: env(safe-area-inset-top, 0px);
  --ss-safe-area-right: env(safe-area-inset-right, 0px);
  --ss-safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --ss-safe-area-left: env(safe-area-inset-left, 0px);
  --ss-font-family:
    "PingFang SC", "PingFangTC-Regular", "Hiragino Sans GB", "Hiragino Sans", "STHeiti", "Heiti SC",
    "Noto Sans CJK SC", "Noto Sans SC", "Source Han Sans SC", "Microsoft YaHei UI",
    "Microsoft YaHei", "微软雅黑", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
}

@supports (height: 100dvh) {
  :root {
    --ss-app-height: 100dvh;
  }
}

/* iOS 使用固定根容器覆盖可视区域，避免首帧/交互后视口高度抖动产生白边 */
html.platform-ios,
html.platform-ios body {
  height: 100%;
  min-height: 100%;
}

html,
body,
#root {
  height: var(--ss-app-height);
  min-height: var(--ss-app-height);
  margin: 0;
  padding: 0;
  overflow: hidden;
  user-select: none;
  background: var(--ss-bg-color, #f5f5f5);
  font-family: var(--ss-font-family);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

#root {
  width: 100%;
  padding-top: var(--ss-safe-area-top);
  padding-right: var(--ss-safe-area-right);
  padding-bottom: var(--ss-safe-area-bottom);
  padding-left: var(--ss-safe-area-left);
  box-sizing: border-box;
}

html.platform-ios #root {
  position: fixed;
  inset: 0;
  height: auto;
  min-height: 0;
}

html.platform-android {
  --ss-safe-area-top: max(env(safe-area-inset-top, 0px), 24px);
}

input,
textarea {
  user-select: text;
  font-family: var(--ss-font-family);
}

button,
select {
  font-family: var(--ss-font-family);
}

.ant-typography,
.ant-btn,
.ant-input,
.ant-input-affix-wrapper,
.ant-select,
.ant-select-selection-item,
.ant-message-notice-content {
  font-family: var(--ss-font-family) !important;
}

.ss-sidebar {
  color: var(--ss-sidebar-text, var(--ss-text-main));
}

.ss-sidebar .ant-menu {
  background-color: transparent !important;
}

.ss-sidebar .ant-menu-item {
  color: var(--ss-sidebar-text, var(--ss-text-main));
  height: 40px !important;
  line-height: 42px !important;
  border-radius: 6px !important;
}

.ss-sidebar .ant-menu-item-selected {
  background-color: var(--ss-sidebar-active-bg, var(--ss-item-hover, transparent)) !important;
  color: var(
    --ss-sidebar-active-text,
    var(--ant-color-primary, var(--ss-sidebar-text, var(--ss-text-main)))
  );
}

/* 移动平台（iOS/Android）小屏设备适配 */
@media (max-width: 768px) {
  /* 侧边栏菜单项增大触摸区域 */
  html.platform-ios .ss-sidebar .ant-menu-item,
  html.platform-android .ss-sidebar .ant-menu-item {
    min-height: 48px;
    font-size: 16px;
  }

  /* 按钮和输入框保持合适大小 */
  html.platform-ios .ant-btn,
  html.platform-android .ant-btn {
    min-height: 40px;
  }

  html.platform-ios .ant-input,
  html.platform-ios .ant-select-selector,
  html.platform-ios .ant-input-number,
  html.platform-android .ant-input,
  html.platform-android .ant-select-selector,
  html.platform-android .ant-input-number {
    min-height: 40px;
    font-size: 16px;
  }

  /* 表格单元格增加内边距 */
  html.platform-ios .ant-table th,
  html.platform-ios .ant-table td,
  html.platform-android .ant-table th,
  html.platform-android .ant-table td {
    padding-top: 12px;
    padding-bottom: 12px;
  }

  /* 模态框全屏 */
  html.platform-ios .ant-modal,
  html.platform-android .ant-modal {
    max-width: 100vw !important;
    width: 100vw !important;
    margin: 0 !important;
    padding: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
  }

  html.platform-ios .ant-modal-content,
  html.platform-android .ant-modal-content {
    height: 100vh !important;
    border-radius: 0 !important;
    display: flex !important;
    flex-direction: column !important;
  }

  html.platform-ios .ant-modal-body,
  html.platform-android .ant-modal-body {
    flex: 1 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
  }

  html.platform-ios .ant-modal-wrap,
  html.platform-android .ant-modal-wrap {
    overflow: hidden !important;
  }

  /* 下拉菜单高度限制 */
  html.platform-ios .ant-select-dropdown,
  html.platform-android .ant-select-dropdown {
    max-height: 50vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  /* 表格横向滚动 */
  html.platform-ios .ant-table-wrapper,
  html.platform-android .ant-table-wrapper {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
}

.ss-table-center .ant-table th,
.ss-table-center .ant-table td {
  text-align: center;
}

.ss-operation-drawer .ant-drawer-header {
  -webkit-app-region: drag;
  user-select: none;
}

.ss-operation-drawer .ant-drawer-header .ant-drawer-close,
.ss-operation-drawer .ant-drawer-header button {
  -webkit-app-region: no-drag;
}

html.platform-macos,
html.platform-macos body {
  background: transparent;
}

/* macOS：保留原生窗口圆角与 squircle（由 NSWindow 在系统层裁剪），
   不再用 CSS border-radius 覆盖，避免圆弧破坏原生连续曲率。 */

.ss-group-board-modal .ant-modal {
  max-height: calc(100vh - 24px);
  top: 0;
}

.ss-group-board-modal .ant-modal-content {
  max-height: calc(100vh - 24px);
  display: flex;
  flex-direction: column;
}

.ss-group-board-modal .ant-modal-body {
  overflow: hidden;
}

.ss-reward-morph-modal {
  --ss-modal-from-x: 0px;
  --ss-modal-from-y: 0px;
  --ss-modal-scale-x: 1;
  --ss-modal-scale-y: 1;
}

.ss-reward-morph-modal.is-preparing {
  opacity: 0;
}

.ss-reward-morph-modal .ant-modal-content {
  transform-origin: center;
  will-change: transform, opacity;
}

.ss-reward-morph-wrap.ss-reward-noop-motion-enter,
.ss-reward-morph-wrap.ss-reward-noop-motion-appear,
.ss-reward-morph-wrap.ss-reward-noop-motion-leave,
.ss-reward-morph-wrap.ss-reward-noop-motion-enter-active,
.ss-reward-morph-wrap.ss-reward-noop-motion-appear-active,
.ss-reward-morph-wrap.ss-reward-noop-motion-leave-active,
.ss-reward-morph-root .ss-reward-morph-modal.ss-reward-noop-motion-enter,
.ss-reward-morph-root .ss-reward-morph-modal.ss-reward-noop-motion-appear,
.ss-reward-morph-root .ss-reward-morph-modal.ss-reward-noop-motion-leave,
.ss-reward-morph-root .ss-reward-morph-modal.ss-reward-noop-motion-enter-active,
.ss-reward-morph-root .ss-reward-morph-modal.ss-reward-noop-motion-appear-active,
.ss-reward-morph-root .ss-reward-morph-modal.ss-reward-noop-motion-leave-active {
  animation: none !important;
  transition: none !important;
}

.ss-reward-morph-modal.is-enter .ant-modal-content {
  animation: ss-reward-modal-morph-in 300ms cubic-bezier(0.2, 0.82, 0.22, 1) both;
}

.ss-home-operation-morph-modal .ant-modal-content {
  transform-origin: center;
  will-change: transform, opacity;
}

.ss-operation-mask-fade-enter,
.ss-operation-mask-fade-appear {
  opacity: 0 !important;
}

.ss-operation-mask-fade-enter-active,
.ss-operation-mask-fade-appear-active {
  opacity: 1 !important;
  transition: opacity 260ms cubic-bezier(0.2, 0, 0, 1) !important;
}

.ss-operation-mask-fade-leave {
  opacity: 1 !important;
}

.ss-operation-mask-fade-leave-active {
  opacity: 0 !important;
  transition: opacity 220ms cubic-bezier(0.4, 0, 1, 1) !important;
}

@keyframes ss-reward-modal-morph-in {
  from {
    transform: translate3d(var(--ss-modal-from-x), var(--ss-modal-from-y), 0)
      scale(var(--ss-modal-scale-x), var(--ss-modal-scale-y));
    opacity: 0.94;
  }

  to {
    transform: translate3d(0, 0, 0) scale(1, 1);
    opacity: 1;
  }
}

.ss-immersive-sidebar {
  --ss-sidebar-width: 200px;
  height: 100%;
  display: flex;
  flex-shrink: 0;
  width: var(--ss-sidebar-width);
  overflow: hidden;
  background: var(--ss-sidebar-bg);
  opacity: 1;
  transform: translateX(0);
  transition:
    width 260ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 220ms ease,
    transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: width, opacity, transform;
}

.ss-immersive-sidebar .ant-layout-sider {
  height: 100% !important;
}

.ss-immersive-sidebar.is-hidden {
  width: 0;
  opacity: 0;
  transform: translateX(-10px);
  pointer-events: none;
}

.ss-immersive-toolbar {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
  transition:
    width 420ms cubic-bezier(0.2, 1.2, 0.26, 1),
    opacity 200ms ease,
    transform 320ms cubic-bezier(0.2, 1.2, 0.26, 1);
  will-change: width, opacity, transform;
}

.ss-immersive-toolbar.is-hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(16px) scale(0.98);
  pointer-events: none;
}

.ss-settings-mobile-nav-list {
  display: flex;
  flex-direction: column;
}

.ss-settings-mobile-nav-item.ant-btn {
  min-height: 48px;
  width: 100%;
  border-radius: 0;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  color: var(--ss-text-main);
  border-bottom: 1px solid var(--ss-divider, rgba(5, 5, 5, 0.06));
}

.ss-settings-mobile-nav-item.ant-btn:last-child {
  border-bottom: none;
}

.ss-settings-mobile-nav-item.ant-btn:hover,
.ss-settings-mobile-nav-item.ant-btn:focus-visible {
  background: var(--ss-item-hover, rgba(0, 0, 0, 0.04));
}

.ss-settings-mobile-nav-item.ant-btn.is-active {
  color: var(--ant-color-primary, #1677ff);
  background: color-mix(in srgb, var(--ant-color-primary, #1677ff) 10%, transparent);
}

.ss-settings-mobile-nav-item.ant-btn[disabled] {
  color: var(--ss-text-secondary);
  opacity: 0.65;
}

.ss-settings-mobile-nav-item-label {
  font-size: 15px;
  font-weight: 500;
}

.ss-settings-mobile-nav-item-arrow {
  font-size: 12px;
}

.ss-route-page {
  min-height: 100%;
}

.ss-route-page.is-board-page {
  height: 100%;
  overflow: hidden;
}

.ss-content-scroll-container {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--ss-text-secondary) 55%, transparent) transparent;
}

.ss-content-scroll-container::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.ss-content-scroll-container::-webkit-scrollbar-track {
  background: transparent;
}

.ss-content-scroll-container::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--ss-text-secondary) 55%, transparent);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.ss-content-scroll-container::-webkit-scrollbar-corner {
  background: transparent;
}

.ss-route-page.is-subpage-enter {
  animation: ss-subpage-enter 240ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes ss-subpage-enter {
  from {
    opacity: 0;
    transform: translate3d(20px, 0, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ss-immersive-sidebar,
  .ss-immersive-toolbar,
  .ss-route-page.is-subpage-enter {
    transition: none !important;
    animation: none !important;
  }
}
