@import url("../fonts/inter.css");

:root {
  --frame-bg: #000;
  --frame-ring: #1f2937;
  --screen-bg: #F4F5F7;
  --brand: #4C75F2;
  --brand-deep: #3A5CCC;
  --brand-gradient: linear-gradient(135deg, #4C75F2 0%, #3A5CCC 100%);
  --surface-card: #FFFFFF;
  --surface-page: #F4F5F7;
  --text-primary: #1A1A1A;
  --text-secondary: #999999;
  --text-muted: #A0A4B0;
  --color-success: #10B981;
  --color-warning: #F5A623;
  --color-premium: #8B5CF6;
  --color-star: rgba(255, 215, 0, 0.8);
  --color-star-inactive: #E5E7EB;
  --tint-blue: #EEF2FF;
  --tint-amber: #FFF9EE;
  --tint-violet: #F2EEFF;
  --tint-green: #EEFFF5;
  --border-subtle: #EAECEF;
  --shadow-cta: 0 10px 25px rgba(76, 117, 242, 0.3);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.06);
  --shadow-chip-active: 0 4px 12px rgba(76, 117, 242, 0.22);
  --radius-button: 18px;
  --radius-card: 20px;
  --radius-card-lg: 24px;
  --radius-icon: 16px;
  --radius-chip: 999px;
  --color-review: #D97706;
  --color-revise: #C05621;
  --tint-review: #FFF9EE;
  --tint-revise: #FFF4E5;
  --tint-success-soft: #ECFDF5;
  --color-success-deep: #059669;
  --tint-error-soft: #FEF2F2;
  --color-error-deep: #DC2626;
  --surface-sheet: linear-gradient(160deg, #F8FAFF 0%, #EEF2FF 48%, #E8EDF5 100%);
  --font-family-base: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-size-body: 14px;
  --font-size-caption: 11px;
  --font-size-subheading: 17px;
  --status-bar-image: url("../images/status-bar-black.svg");
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 24px 16px;
  background: #f3f5fe;
  font-family: var(--font-family-base);
  -webkit-font-smoothing: antialiased;
  overflow-x: auto;
}

.ios-frame-wrapper {
  display: inline-block;
  flex-shrink: 0;
  padding: 12px;
  background: var(--frame-bg);
  border-radius: 60px;
  box-shadow: 0 0 0 2px var(--frame-ring), 0 20px 60px rgba(0, 0, 0, 0.3);
}

.ios-screen {
  position: relative;
  width: 393px;
  height: 852px;
  border-radius: 48px;
  overflow: hidden;
  background: var(--screen-bg);
  isolation: isolate;
}

.status-bar {
  position: absolute;
  padding-top: 6px;
  left: 0;
  width: 100%;
  height: 54px;
  z-index: 20;
  pointer-events: none;
  background-image: var(--status-bar-image);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

.dynamic-island {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 124px;
  height: 36px;
  background: #000;
  border-radius: 999px;
  z-index: 30;
}

.screen-layout {
  position: absolute;
  top: 54px;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  overflow: hidden;
}

.screen-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--screen-bg);
}

.home-panel {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.home-panel[hidden] {
  display: none !important;
}

.title-bar {
  flex-shrink: 0;
  height: 52px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 14;
}

.title-bar__class-wrap {
  position: relative;
  flex-shrink: 0;
}

.title-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
  color: var(--brand);
  font-size: 14px;
  font-weight: 600;
  min-height: 44px;
  padding: 0 4px;
  border: none;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
  transition: transform 0.18s ease;
}

.title-btn:active {
  transform: scale(0.96);
}

.title-btn--class {
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 1px;
  min-height: 44px;
  padding: 5px 10px 5px 9px;
  border-radius: 12px;
  background: var(--tint-blue);
  border: 1px solid rgba(76, 117, 242, 0.28);
  box-shadow: 0 2px 10px rgba(76, 117, 242, 0.1);
}

.title-btn--class__hint {
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--brand-deep);
  letter-spacing: 0.02em;
}

.title-btn--class__main {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.title-btn--class__name {
  font-size: 14px;
  font-weight: 700;
  color: var(--brand);
  line-height: 1.2;
}

.title-btn--class__icon {
  font-size: 10px;
  color: var(--brand);
  opacity: 0.85;
  transition: transform 0.28s cubic-bezier(0.33, 1, 0.68, 1);
}

.title-btn--class.is-coach-pulse {
  animation: class-btn-pulse 2s ease-in-out infinite;
}

@keyframes class-btn-pulse {
  0%, 100% {
    box-shadow: 0 2px 10px rgba(76, 117, 242, 0.1), 0 0 0 0 rgba(76, 117, 242, 0.35);
  }
  50% {
    box-shadow: 0 4px 14px rgba(76, 117, 242, 0.18), 0 0 0 4px rgba(76, 117, 242, 0.12);
  }
}

.ios-screen.is-drawer-open .title-btn--class {
  background: var(--brand-gradient);
  border-color: transparent;
  box-shadow: var(--shadow-chip-active);
}

.ios-screen.is-drawer-open .title-btn--class__hint {
  color: rgba(255, 255, 255, 0.92);
}

.ios-screen.is-drawer-open .title-btn--class__name,
.ios-screen.is-drawer-open .title-btn--class__icon {
  color: #fff;
}

.ios-screen.is-drawer-open .title-btn--class__icon {
  transform: rotate(180deg);
  opacity: 1;
}

.class-switch-coach {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 20;
  max-width: 168px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-card);
  border: 1px solid rgba(76, 117, 242, 0.2);
  box-shadow: 0 8px 24px rgba(76, 117, 242, 0.18);
  pointer-events: none;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.class-switch-coach::before {
  content: "";
  position: absolute;
  top: -5px;
  left: 18px;
  width: 10px;
  height: 10px;
  background: var(--surface-card);
  border-left: 1px solid rgba(76, 117, 242, 0.2);
  border-top: 1px solid rgba(76, 117, 242, 0.2);
  transform: rotate(45deg);
}

.class-switch-coach.is-hidden {
  opacity: 0;
  transform: translateY(-4px);
  visibility: hidden;
}

.class-switch-coach__text {
  position: relative;
  z-index: 1;
  display: block;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--text-primary);
}

@media (prefers-reduced-motion: reduce) {
  .title-btn--class.is-coach-pulse {
    animation: none;
  }
}

.ios-screen.is-drawer-open .title-text {
  font-size: 15px;
}

.title-center {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 44px;
  padding: 2px 8px;
  border: none;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.title-text {
  margin: 0;
  font-size: var(--font-size-subheading);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.title-center__arrow {
  font-size: 11px;
  color: var(--text-secondary);
  transition: transform 0.15s;
}

.title-center:active .title-center__arrow {
  transform: translateX(2px);
}

.title-bar .clock-status {
  flex-shrink: 0;
  padding-right: 4px;
}

.screen-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.screen-content::-webkit-scrollbar {
  display: none;
}

.screen-main .home-indicator {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 140px;
  height: 5px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 999px;
  bottom: 10px;
  z-index: 11;
  pointer-events: none;
}

.app-shell {
  position: relative;
  min-height: 100%;
  padding: 12px 16px 8px;
}

/* ===== 底部 Tab 导航 ===== */
.bottom-tab-bar {
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  gap: 4px;
  padding: 0 8px 18px;
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid var(--border-subtle);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 15;
  position: relative;
}

.bottom-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
  min-height: 44px;
  padding: 4px 8px 0;
  color: var(--text-muted);
  transition: color 0.2s ease, transform 0.18s ease;
}

.bottom-tab:active {
  transform: scale(0.94);
}

.bottom-tab.is-active {
  color: var(--brand);
}

.bottom-tab__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  font-size: 20px;
  line-height: 1;
}

.bottom-tab__label {
  font-size: var(--font-size-caption);
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
}

.bottom-tab.is-active .bottom-tab__label {
  font-weight: 600;
  color: var(--brand);
}

.bottom-tab--camera {
  position: relative;
  padding-top: 0;
}

.bottom-tab__fab {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-top: -22px;
  margin-bottom: 2px;
  border-radius: 50%;
  background: var(--brand-gradient);
  color: #fff;
  font-size: 22px;
  border: 4px solid #fff;
  box-shadow: var(--shadow-cta);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.bottom-tab--camera:active .bottom-tab__fab {
  transform: scale(0.94);
  box-shadow: 0 6px 16px rgba(76, 117, 242, 0.28);
}

.bottom-tab--camera .bottom-tab__label {
  color: var(--text-secondary);
  font-weight: 500;
}

.bottom-tab--personal-only {
  display: none;
}

.ios-screen.is-personal-mode .bottom-tab--org-only {
  display: none;
}

.ios-screen.is-personal-mode .bottom-tab--personal-only {
  display: flex;
}

.personal-tab-panel {
  flex: 1 1 auto;
  min-height: 0;
  background: linear-gradient(180deg, #dce6ff 0%, #eef2ff 18%, var(--screen-bg) 220px);
}

.personal-tab-panel[hidden] {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .bottom-tab,
  .bottom-tab__fab {
    transition: none;
  }
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(76, 117, 242, 0.4);
}

textarea {
  font-family: inherit;
}

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* 移动端全屏，隐藏设备壳 */
@media (max-width: 768px) {
  body {
    display: block;
    padding: 0;
    background: var(--screen-bg);
    overflow-x: hidden;
  }

  .ios-frame-wrapper {
    display: block;
    padding: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    transform: none;
  }

  .ios-screen {
    width: 100vw;
    width: 100dvw;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
  }

  .status-bar,
  .dynamic-island,
  .home-indicator {
    display: none;
  }

  .screen-layout {
    top: 0;
  }
}
