* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  --market-page-surface: #f7f9fc;
  --fullscreen-safe-left: env(safe-area-inset-left, 0px);
  width: 100%;
  height: auto;
  min-height: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  background: var(--market-page-surface);
  color: #1f2937;
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "PingFang SC",
    "Helvetica Neue",
    Arial,
    sans-serif;
}

body {
  overflow-x: hidden;
  overflow-y: auto;
}

body.is-page-locked {
  position: fixed;
  left: 0;
  width: 100%;
  overflow: hidden;
}

.market-detail-page {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 0 0 124px;
  background: var(--market-page-surface);
}

.fullscreen-exit-button {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  right: 14px;
  z-index: 120;
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
}

.fullscreen-exit-button img {
  display: block;
  width: 22px;
  height: 22px;
}

.fullscreen-enter-button {
  position: absolute;
  left: 12px;
  bottom: 56px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #9ca3af;
}

.fullscreen-enter-button svg {
  display: block;
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body.is-fullscreen .fullscreen-exit-button {
  display: inline-flex;
}

body.is-fullscreen .fullscreen-enter-button {
  display: none;
}

body.is-fullscreen .market-detail-page {
  position: relative;
  padding-left: var(--fullscreen-safe-left);
  padding-bottom: 0;
}

body.is-fullscreen .market-detail-page::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--fullscreen-safe-left);
  background: var(--market-page-surface);
  z-index: 1;
  pointer-events: none;
}

body.is-fullscreen .quote-panel__main {
  display: block;
}

body.is-fullscreen .quote-panel__stats,
body.is-fullscreen .metric-grid {
  display: none;
}

body.is-fullscreen .quote-panel {
  padding: 4px 12px 4px 12px;
}

body.is-fullscreen .quote-panel__price-block {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  gap: 6px;
  min-height: 22px;
  flex-wrap: nowrap;
  overflow: hidden;
}

body.is-fullscreen .quote-panel__name {
  display: block;
  flex: 0 1 auto;
  max-width: 120px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
  color: #475569;
}

body.is-fullscreen .quote-panel__meta {
  display: none;
}

body.is-fullscreen .quote-panel__price-line {
  order: 1;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

body.is-fullscreen .quote-panel__price {
  font-size: 18px;
  line-height: 1;
}

body.is-fullscreen .quote-panel__unit {
  padding-bottom: 0;
  font-size: 10px;
  line-height: 1;
}

body.is-fullscreen .quote-panel__change {
  order: 2;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  line-height: 1;
}

body.is-fullscreen #changeValue,
body.is-fullscreen #changeRate {
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.quote-panel {
  padding: 4px 16px 2px;
  background: #f7f9fc;
}

.quote-panel__head,
.quote-panel__main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.quote-panel__identity {
  min-width: 0;
  flex: 1;
}

.quote-panel__name {
  display: none;
}

.quote-panel__meta {
  display: none;
}

.quote-panel__status {
  flex-shrink: 0;
  padding-top: 1px;
  font-size: 12px;
  font-weight: 700;
}

.quote-panel__main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-top: 0;
  align-items: center;
  column-gap: 16px;
}

.quote-panel__price-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  min-width: 0;
}

.quote-panel__price-line {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.quote-panel__price {
  font-size: 34px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.quote-panel__unit {
  padding-bottom: 3px;
  font-size: 12px;
  color: #8b95a1;
}

.quote-panel__change {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
}

.quote-panel__stats {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex-shrink: 0;
  min-width: 0;
  padding-left: 12px;
}

.quote-panel__stat {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  width: 108px;
  margin-bottom: 8px;
  padding: 0 6px;
  text-align: left;
}

.quote-panel__stat-label {
  display: block;
  width: 32px;
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  line-height: 1;
  letter-spacing: 0.01em;
  text-align: center;
}

.quote-panel__stat-value {
  display: block;
  width: 56px;
  font-size: 13px;
  font-weight: 700;
  color: #9aa4b2;
  line-height: 1;
  letter-spacing: -0.01em;
  text-align: right;
}

.chart-panel {
  display: flex;
  flex-direction: column;
  flex: none;
  margin-top: 0;
  padding: 0;
  background: #f7f9fc;
}

.chart-toolbar {
  position: relative;
  padding: 4px 16px 0;
}

.chart-toolbar__row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 34px;
}

.chart-toolbar__periods {
  position: relative;
  min-width: 0;
  flex: 1 1 auto;
}

.period-tabs {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  min-height: 24px;
  padding: 0;
  min-width: 0;
  flex: 0 0 auto;
  overflow: visible;
}

.period-tabs::-webkit-scrollbar {
  display: none;
}

.period-tabs__item {
  position: relative;
  flex-shrink: 0;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 15px;
  font-weight: 400;
  line-height: 1;
  color: #9ca3af;
  white-space: nowrap;
}

.period-tabs__label {
  display: inline-flex;
  align-items: center;
  height: 20px;
}

.period-tabs__line {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: transparent;
}

.period-tabs__item.is-active {
  color: #111827;
  font-weight: 800;
}

.period-tabs__item.is-active .period-tabs__line {
  background: #111827;
}

.period-tabs__item--more .period-tabs__label {
  gap: 2px;
}

.period-tabs__item--more svg {
  display: block;
  width: 15px;
  height: 15px;
  transition: transform 0.2s ease;
}

.period-tabs__item--more.is-open svg {
  transform: rotate(180deg);
}

.period-more-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 8;
  min-width: 112px;
  padding: 8px;
  border: 1px solid rgba(209, 213, 219, 0.96);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.period-more-menu.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.period-more-menu__item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #4b5563;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  text-align: left;
}

.period-more-menu__item + .period-more-menu__item {
  margin-top: 2px;
}

.period-more-menu__item.is-active {
  background: rgba(17, 24, 39, 0.08);
  color: #111827;
  font-weight: 800;
}

.indicator-settings-trigger {
  margin-left: auto;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #6b7280;
  line-height: 1;
}

.indicator-settings-trigger img,
.indicator-settings-trigger svg {
  display: block;
  width: 22px;
  height: 22px;
}

.indicator-settings-aside {
  display: none;
}

.chart-panel__wrap {
  display: flex;
  flex: none;
  height: 560px;
  min-height: 560px;
  margin-top: 0;
  position: relative;
  border-top: 1px solid rgba(209, 213, 219, 0.9);
  border-radius: 0;
  background: #f7f9fc;
  overflow: hidden;
}

.indicator-settings-mask {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(15, 23, 42, 0.22);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.indicator-settings-mask.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.indicator-settings-panel {
  width: 100%;
  min-height: 50vh;
  height: 50vh;
  max-height: 50vh;
  padding: 18px 16px calc(env(safe-area-inset-bottom) + 34px);
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  background: rgba(248, 250, 252, 0.98);
  box-shadow: 0 -12px 32px rgba(15, 23, 42, 0.14);
  transform: translateY(100%);
  transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}

.indicator-settings-mask.is-visible .indicator-settings-panel {
  transform: translateY(0);
}

.indicator-settings-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.indicator-settings-panel__title {
  font-size: 16px;
  line-height: 1.2;
  font-weight: 800;
  color: #111827;
}

.indicator-settings-panel__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #6b7280;
  font-size: 28px;
  line-height: 1;
  font-weight: 400;
}

.indicator-settings-group {
  margin-top: 18px;
}

.indicator-settings-group__title {
  font-size: 13px;
  line-height: 1.2;
  font-weight: 800;
  color: #111827;
}

.indicator-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.indicator-options__item {
  min-width: 68px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(195, 203, 214, 0.96);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  color: #4b5563;
  font-size: 13px;
  font-weight: 700;
  line-height: 34px;
  text-align: center;
}

.indicator-options__item.is-active {
  border-color: rgba(17, 24, 39, 0.92);
  background: #111827;
  color: #ffffff;
}

body.is-fullscreen .indicator-settings-trigger,
body.is-fullscreen .indicator-settings-mask {
  display: none !important;
}

body.is-fullscreen .indicator-settings-aside {
  position: relative;
  z-index: 2;
  display: flex;
  flex: 0 0 84px;
  flex-direction: column;
  gap: 10px;
  padding: 10px 8px;
  border-left: 1px solid rgba(209, 213, 219, 0.92);
  background: rgba(247, 249, 252, 0.98);
}

body.is-fullscreen .indicator-settings-aside__divider {
  height: 1px;
  background: rgba(209, 213, 219, 0.92);
}

body.is-fullscreen .indicator-settings-group--aside {
  margin-top: 0;
}

body.is-fullscreen .indicator-settings-group--aside .indicator-settings-group__title {
  font-size: 11px;
  text-align: center;
  color: #64748b;
}

body.is-fullscreen .indicator-options--aside {
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 8px;
  margin-top: 8px;
}

body.is-fullscreen .indicator-options--aside .indicator-options__item {
  width: 100%;
  min-width: 0;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #9ca3af;
  font-size: 12px;
  font-weight: 400;
  line-height: 1;
}

body.is-fullscreen .indicator-options--aside .indicator-options__item.is-active {
  border-color: transparent;
  background: transparent;
  color: #111827;
  font-weight: 800;
}

.chart-panel__canvas {
  width: 100%;
  flex: 1 1 auto;
  height: 100%;
  touch-action: pan-y pinch-zoom;
}

.chart-panel__canvas.is-page-scroll-active {
  touch-action: pan-y;
}

.chart-panel__canvas.is-chart-scroll-active,
.chart-panel__canvas.is-crosshair-active,
.chart-panel__canvas.is-multi-touch-active {
  touch-action: none;
}

.crosshair-panel {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: none;
  min-width: 110px;
  max-width: 148px;
  padding: 10px 10px 8px;
  border: 1px solid rgba(189, 199, 214, 0.96);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
  pointer-events: none;
}

body.is-fullscreen .crosshair-panel {
  right: 92px;
}

.crosshair-panel.is-visible {
  display: block;
}

.crosshair-panel__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  white-space: nowrap;
}

.crosshair-panel__item + .crosshair-panel__item {
  margin-top: 7px;
}

.crosshair-panel__label {
  font-size: 10px;
  line-height: 1;
  color: #8b95a1;
  flex-shrink: 0;
}

.crosshair-panel__value {
  font-size: 12px;
  line-height: 1.15;
  font-weight: 700;
  color: #111827;
  text-align: right;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  margin-top: 0;
  padding: 12px 16px calc(env(safe-area-inset-bottom) + 10px);
  background: rgba(251, 252, 254, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.metric-grid__item {
  min-width: 0;
  text-align: center;
}

.metric-grid__label {
  display: block;
  font-size: 10px;
  color: #8b95a1;
  line-height: 1.15;
  white-space: nowrap;
}

.metric-grid__value {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #1f2937;
  line-height: 1.1;
}

.is-up {
  color: #d92d20;
}

.is-down {
  color: #16a34a;
}

@media screen and (max-width: 375px) {
  .quote-panel__main {
    gap: 8px;
  }

  .chart-panel__canvas {
    height: 380px;
  }

  .metric-grid {
    gap: 8px 4px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .metric-grid__label {
    font-size: 9px;
  }

  .metric-grid__value {
    font-size: 12px;
  }
}
