﻿  * { box-sizing: border-box; margin: 0; padding: 0; }

  body {
    background: linear-gradient(160deg, #07090e 0%, #11161f 50%, #0a0d13 100%);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
    color: #e6edf7;
    -webkit-font-smoothing: antialiased;
  }

  .app {
    max-width: 940px;
    width: 100%;
    background: rgba(15, 19, 27, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 40px;
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 215, 0, 0.08);
    padding: 22px 20px 26px;
    position: relative;
    overflow: hidden;
  }

  .app::before {
    content: '';
    position: absolute;
    top: -30%;
    left: -20%;
    width: 70%;
    height: 60%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.06) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
  }

  .progress-line {
    position: absolute;
    top: 0; left: 0;
    height: 3px;
    background: linear-gradient(90deg, #ffd966, #f0b800);
    border-radius: 0 3px 3px 0;
    transition: width 0.4s ease;
    z-index: 10;
    box-shadow: 0 0 12px #ffd966;
  }

  .phase-banner {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    z-index: 11;
    transition: background 0.3s;
  }
  .phase-banner.pre-open { background: linear-gradient(90deg, #a78bfa, #7c3aed); box-shadow: 0 0 14px #7c3aed; }
  .phase-banner.intraday { background: linear-gradient(90deg, #ffd966, #f0b800); box-shadow: 0 0 14px #ffd966; }
  .phase-banner.post-close { background: linear-gradient(90deg, #38bdf8, #0284c7); box-shadow: 0 0 14px #0284c7; }

  #screenContainer {
    position: relative;
    z-index: 5;
  }

  .top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    position: relative;
    z-index: 6;
    gap: 8px;
    flex-wrap: wrap;
  }

  .round-badge {
    background: #1a202c;
    border: 1px solid #2a3444;
    border-radius: 40px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #9aa7bb;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
  }

  .round-badge .round-num {
    color: #ffd966;
    font-size: 17px;
    font-weight: 700;
  }

  .phase-badge {
    background: #1a202c;
    border: 1px solid #2a3444;
    border-radius: 40px;
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    transition: all 0.3s;
  }
  .phase-badge.pre-open { color: #a78bfa; border-color: #a78bfa60; }
  .phase-badge.intraday { color: #ffd966; border-color: #ffd96660; }
  .phase-badge.post-close { color: #38bdf8; border-color: #38bdf860; }

  .timer-badge {
    background: #1a202c;
    border: 1px solid #2a3444;
    border-radius: 40px;
    padding: 7px 14px;
    font-size: 15px;
    font-weight: 700;
    color: #ffd966;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    gap: 6px;
    font-variant-numeric: tabular-nums;
    transition: all 0.2s;
    white-space: nowrap;
  }

  .timer-badge.warning {
    color: #f87171;
    border-color: #f8717150;
    animation: pulse 0.8s infinite;
  }

  .timer-badge.paused {
    color: #a78bfa;
    border-color: #a78bfa60;
    animation: pausePulse 1.2s ease-in-out infinite;
  }

  @keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
  }

  @keyframes pausePulse {
    0%, 100% { box-shadow: 0 0 8px #a78bfa40; }
    50% { box-shadow: 0 0 18px #a78bfa80; }
  }

  .mood-icon {
    font-size: 26px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.6));
    transition: all 0.3s;
  }

  .margin-toggle-btn {
    background: #1a202c;
    border: 1px solid #2a3444;
    border-radius: 40px;
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 800;
    color: #9aa7bb;
    letter-spacing: 0.04em;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    transition: all 0.2s;
    font-family: inherit;
    position: relative;
    z-index: 100;
    pointer-events: auto !important;
  }
  .margin-toggle-btn:hover {
    border-color: #c4b5fd80;
    color: #c4b5fd;
    transform: translateY(-1px);
  }
  .margin-toggle-btn.on {
    background: linear-gradient(135deg, #2a1a3e, #1f1430);
    border-color: #c4b5fd;
    color: #c4b5fd;
    box-shadow: 0 0 12px #c4b5fd40;
  }

  .exit-btn {
    background: linear-gradient(135deg, #1a0f0f, #2a1414);
    border: 1px solid #f8717150;
    border-radius: 40px;
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 800;
    color: #f87171;
    letter-spacing: 0.04em;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    transition: all 0.2s;
    box-shadow: 0 4px 12px -4px rgba(248,113,113,0.3);
    font-family: inherit;
    position: relative;
    z-index: 100;
    pointer-events: auto !important;
  }
  .exit-btn:hover {
    background: linear-gradient(135deg, #2a1414, #3a1a1a);
    border-color: #f87171;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px -4px rgba(248,113,113,0.5);
  }
  .exit-btn:active { transform: translateY(0) scale(0.97); }

  .margin-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #1a1226 0%, #140e1c 100%);
    border: 1px solid #3a2450;
    border-radius: 16px;
    padding: 8px 14px;
    margin-bottom: 12px;
    position: relative;
    z-index: 6;
    font-size: 11px;
    flex-wrap: wrap;
  }

  .margin-bar .item {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #9aa7bb;
    font-weight: 600;
    letter-spacing: 0.03em;
  }

  .margin-bar .item .val {
    color: #c4b5fd;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
  }

  .margin-bar .item .val.warn { color: #f87171; }
  .margin-bar .item .val.ok { color: #4ade80; }

  .margin-bar .ratio-pill {
    margin-left: auto;
    background: #2a1a3e;
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 10px;
    font-weight: 800;
    color: #c4b5fd;
  }

  .margin-bar .ratio-pill.danger {
    background: #3a1414;
    color: #f87171;
    animation: pulse 1s infinite;
  }

  .main-grid {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 14px;
    margin-bottom: 14px;
    position: relative;
    z-index: 6;
  }

  @media (max-width: 720px) {
    .main-grid { grid-template-columns: 1fr; }
  }

  .kline-panel {
    background: linear-gradient(135deg, #131a26 0%, #0e131c 100%);
    border-radius: 22px;
    padding: 12px 12px 8px;
    border: 1px solid #222b3a;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.5), 0 8px 20px -8px black;
    display: flex;
    flex-direction: column;
  }

  .panel-title {
    font-size: 11px;
    color: #6b7a92;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .panel-title .legend {
    display: flex;
    gap: 8px;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
  }

  .legend .up { color: #f87171; }
  .legend .down { color: #4ade80; }
  .legend .cost { color: #c4b5fd; }

  .kline-canvas-wrap {
    flex: 1;
    min-height: 190px;
    position: relative;
  }

  #klineCanvas {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 10px;
    cursor: crosshair;
  }

  .kline-tooltip {
    position: fixed;
    background: rgba(12, 16, 24, 0.96);
    border: 1px solid #3a4a60;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 11px;
    color: #e0e8f4;
    line-height: 1.6;
    pointer-events: none;
    z-index: 500;
    box-shadow: 0 8px 24px -6px rgba(0,0,0,0.9);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.12s;
    font-variant-numeric: tabular-nums;
  }
  .kline-tooltip.show { opacity: 1; }
  .kline-tooltip .tt-title {
    font-weight: 800;
    color: #ffd966;
    margin-bottom: 3px;
    font-size: 11px;
  }
  .kline-tooltip .tt-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
  }
  .kline-tooltip .tt-row .k { color: #8a99b0; }
  .kline-tooltip .tt-row .v { font-weight: 700; }
  .kline-tooltip .tt-row .v.up { color: #f87171; }
  .kline-tooltip .tt-row .v.down { color: #4ade80; }

  .right-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .score-panel {
    background: linear-gradient(135deg, #131a26 0%, #0e131c 100%);
    border-radius: 18px;
    padding: 12px 16px;
    border: 1px solid #222b3a;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .score-label {
    font-size: 10px;
    color: #6b7a92;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-weight: 700;
    white-space: nowrap;
  }

  .score-bar-bg {
    flex: 1;
    height: 10px;
    background: #1a2233;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
  }

  .score-bar-fill {
    height: 100%;
    border-radius: 20px;
    transition: width 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.2), background 0.3s;
    box-shadow: 0 0 10px currentColor;
  }

  .score-value {
    font-size: 15px;
    font-weight: 800;
    color: #ffd966;
    min-width: 44px;
    text-align: right;
    font-variant-numeric: tabular-nums;
  }

  .combo-badge {
    position: absolute;
    top: -10px;
    right: 16px;
    background: linear-gradient(135deg, #ffd966, #f0b800);
    color: #0b0e14;
    font-size: 11px;
    font-weight: 800;
    padding: 3px 9px;
    border-radius: 20px;
    box-shadow: 0 4px 12px #ffd96660;
    opacity: 0;
    transform: translateY(6px) scale(0.9);
    transition: all 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.4);
    letter-spacing: 0.04em;
  }

  .combo-badge.show {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  .portfolio-panel {
    background: linear-gradient(135deg, #131a26 0%, #0e131c 100%);
    border-radius: 18px;
    padding: 12px 16px;
    border: 1px solid #222b3a;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.5), 0 8px 20px -8px black;
  }

  .portfolio-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 2px;
  }

  .portfolio-label {
    font-size: 10px;
    color: #6b7a92;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-weight: 600;
  }

  .portfolio-value {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.03em;
    transition: color 0.3s;
    line-height: 1.1;
  }

  .portfolio-value.gain { color: #f87171; }
  .portfolio-value.loss { color: #4ade80; }

  .pnl-row {
    display: flex;
    gap: 14px;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #1c2432;
  }

  .pnl-item { flex: 1; }

  .pnl-label {
    font-size: 9px;
    color: #5f6d82;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 1px;
  }

  .pnl-value {
    font-size: 13px;
    font-weight: 600;
  }

  .pnl-value.pos { color: #f87171; }
  .pnl-value.neg { color: #4ade80; }

  .position-line {
    font-size: 11px;
    color: #6b7a92;
    margin-top: 6px;
    letter-spacing: 0.02em;
  }

  .intraday-panel {
    background: #0c1018;
    border-radius: 18px;
    padding: 8px 10px 4px;
    border: 1px solid #1e2634;
    position: relative;
    height: 132px;
  }

  .intraday-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
  }

  .intraday-label {
    font-size: 10px;
    color: #6b7a92;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
  }

  .intraday-price {
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    transition: color 0.2s;
  }

  .intraday-canvas-wrap {
    height: 96px;
    position: relative;
  }

  #intradayCanvas {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 8px;
  }

  .news-feed {
    background: linear-gradient(135deg, #141b26 0%, #0e131c 100%);
    border-radius: 18px;
    padding: 14px 18px;
    border-left: 5px solid #ffd966;
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    z-index: 6;
    transition: border-color 0.3s, background 0.3s;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.5), 0 8px 24px -8px black;
    min-height: 76px;
  }

  .news-feed.special {
    border-left-color: #a78bfa;
    background: linear-gradient(135deg, #1a1430 0%, #130e26 100%);
    animation: specialGlow 1.5s ease-in-out infinite;
  }

  .news-feed.pulse {
    border-left-color: #fbbf24;
    background: linear-gradient(135deg, #2a1e10, #1a1408);
    animation: pulseGlow 0.8s ease-in-out infinite;
  }

  .news-feed.magnitude-2 { border-left-color: #fbbf24; }
  .news-feed.magnitude-3 { border-left-color: #f97316; }
  .news-feed.magnitude-4 { border-left-color: #ef4444; animation: specialGlow 1.2s ease-in-out infinite; }

  @keyframes specialGlow {
    0%, 100% { box-shadow: inset 0 1px 3px rgba(0,0,0,0.5), 0 0 20px #a78bfa30; }
    50% { box-shadow: inset 0 1px 3px rgba(0,0,0,0.5), 0 0 30px #a78bfa60; }
  }
  @keyframes pulseGlow {
    0%, 100% { box-shadow: inset 0 1px 3px rgba(0,0,0,0.5), 0 0 20px #fbbf2440; }
    50% { box-shadow: inset 0 1px 3px rgba(0,0,0,0.5), 0 0 34px #fbbf2490; }
  }

  .news-emoji {
    font-size: 36px;
    flex-shrink: 0;
    filter: drop-shadow(0 6px 12px rgba(0,0,0,0.6));
    line-height: 1;
  }

  .news-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .news-text {
    font-size: 14px;
    line-height: 1.45;
    color: #e0e8f4;
    font-weight: 600;
    letter-spacing: -0.01em;
  }

  .news-meta {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
  }

  .news-change {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    line-height: 1;
  }

  .news-price {
    font-size: 13px;
    font-weight: 600;
    color: #8a99b0;
  }

  .news-tag {
    font-size: 9px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 20px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }
  .news-tag.normal { background: #2a3444; color: #9aa7bb; }
  .news-tag.special { background: #a78bfa30; color: #a78bfa; border: 1px solid #a78bfa60; }
  .news-tag.pulse { background: #fbbf2430; color: #fbbf24; border: 1px solid #fbbf2460; }
  .news-tag.mag-1 { background: #2a3444; color: #9aa7bb; }
  .news-tag.mag-2 { background: #fbbf2430; color: #fbbf24; border: 1px solid #fbbf2460; }
  .news-tag.mag-3 { background: #f9731630; color: #f97316; border: 1px solid #f9731660; }
  .news-tag.mag-4 { background: #ef444430; color: #ef4444; border: 1px solid #ef444460; }

  .actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 8px;
    margin-top: 12px;
    position: relative;
    z-index: 6;
  }

  @media (max-width: 520px) {
    .actions-grid { grid-template-columns: 1fr 1fr; }
  }

  .action-btn {
    background: #1a212e;
    border: 1px solid #2a3444;
    border-radius: 16px;
    padding: 14px 8px;
    font-size: 14px;
    font-weight: 600;
    color: #cdd9ea;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    letter-spacing: -0.01em;
    box-shadow: 0 4px 8px -2px rgba(0,0,0,0.5);
    position: relative;
    overflow: hidden;
    font-family: inherit;
    z-index: 100;
    pointer-events: auto !important;
  }

  .action-btn:hover:not(:disabled) {
    background: #222c3e;
    border-color: #ffd96680;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px -4px rgba(0,0,0,0.7), 0 0 0 1px #ffd96630;
  }

  .action-btn:active:not(:disabled) { transform: translateY(0) scale(0.98); }

  .action-btn:disabled {
    opacity: 0.25;
    cursor: not-allowed;
    transform: none !important;
    border-color: #2a3444 !important;
    filter: grayscale(0.6);
  }

  .action-btn .btn-emoji { font-size: 20px; }

  .action-btn.buy { border-color: #f8717150; }
  .action-btn.buy:hover:not(:disabled) { border-color: #f87171; background: #261616; }
  .action-btn.sell { border-color: #4ade8050; }
  .action-btn.sell:hover:not(:disabled) { border-color: #4ade80; background: #16261e; }

  .action-btn .btn-hint {
    font-size: 9px;
    color: #6b7a92;
    font-weight: 500;
    letter-spacing: 0.02em;
  }

  .action-btn.pause-think {
    border-color: #a78bfa50;
  }
  .action-btn.pause-think:hover:not(:disabled) {
    border-color: #a78bfa;
    background: #1a1428;
  }
  .action-btn.pause-think.paused {
    background: linear-gradient(135deg, #2a1a3e, #1f1430);
    border-color: #a78bfa;
    color: #c4b5fd;
    box-shadow: 0 0 16px #a78bfa60;
  }
  .action-btn.pause-think.paused .btn-emoji {
    animation: pauseRotate 2s linear infinite;
  }
  @keyframes pauseRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
  }

  .action-btn.enter-post {
    background: linear-gradient(135deg, #1a2a3e, #0f1822);
    border-color: #38bdf880;
    color: #38bdf8;
    animation: enterPostBlink 1.2s ease-in-out infinite;
  }
  @keyframes enterPostBlink {
    0%, 100% {
      box-shadow: 0 0 10px #38bdf840, 0 0 0 0 #38bdf860;
      border-color: #38bdf880;
      background: linear-gradient(135deg, #1a2a3e, #0f1822);
    }
    50% {
      box-shadow: 0 0 26px #38bdf8b0, 0 0 0 6px #38bdf820;
      border-color: #38bdf8;
      background: linear-gradient(135deg, #24405a, #152434);
    }
  }
  .action-btn.enter-post .btn-emoji {
    animation: enterPostArrow 1s ease-in-out infinite;
  }
  @keyframes enterPostArrow {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(4px); }
  }

  .amount-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
  }
  .amount-overlay.show {
    opacity: 1;
    pointer-events: auto;
  }

  .amount-panel {
    background: linear-gradient(160deg, #141b26 0%, #0e131c 100%);
    border: 1px solid #2a3444;
    border-radius: 26px;
    padding: 20px 20px 18px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 30px 60px -12px rgba(0,0,0,0.95), 0 0 0 1px rgba(255,215,0,0.08);
    transform: translateY(10px) scale(0.97);
    transition: transform 0.25s cubic-bezier(0.2,0.9,0.3,1.2);
  }
  .amount-overlay.show .amount-panel {
    transform: translateY(0) scale(1);
  }

  .amount-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
  }

  .amount-title {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.01em;
  }
  .amount-title.buy { color: #f87171; }
  .amount-title.sell { color: #4ade80; }

  .amount-close {
    background: #1a212e;
    border: 1px solid #2a3444;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9aa7bb;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1;
  }
  .amount-close:hover { background: #2a3444; color: #e6edf7; }

  .amount-info {
    background: #0c1018;
    border-radius: 14px;
    padding: 10px 14px;
    margin-bottom: 14px;
    font-size: 11px;
    color: #8a99b0;
    line-height: 1.7;
    border: 1px solid #1e2634;
  }
  .amount-info .hl {
    color: #ffd966;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
  }
  .amount-info .hl-margin {
    color: #c4b5fd;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
  }
  .amount-info .hl-green {
    color: #4ade80;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
  }

  .amount-remaining {
    background: linear-gradient(135deg, #131a26, #0e131c);
    border: 1px dashed #3a4a60;
    border-radius: 12px;
    padding: 9px 14px;
    margin-bottom: 12px;
    font-size: 11px;
    color: #9aa7bb;
    line-height: 1.6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
  }
  .amount-remaining .label {
    font-weight: 600;
    letter-spacing: 0.03em;
  }
  .amount-remaining .value {
    color: #ffd966;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
  }
  .amount-remaining .value.green { color: #4ade80; }
  .amount-remaining .value.purple { color: #c4b5fd; }

  .amount-options {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
  }

  .amount-options-extra {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 14px;
  }

  .amount-opt {
    background: #1a212e;
    border: 1px solid #2a3444;
    border-radius: 14px;
    padding: 12px 6px;
    font-size: 14px;
    font-weight: 700;
    color: #cdd9ea;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    text-align: center;
  }
  .amount-opt:hover {
    background: #222c3e;
    border-color: #ffd96680;
    transform: translateY(-2px);
  }
  .amount-opt .opt-sub {
    font-size: 9px;
    font-weight: 500;
    color: #6b7a92;
    letter-spacing: 0.02em;
  }

  .amount-opt.buy:hover { border-color: #f87171; background: #261616; }
  .amount-opt.sell:hover { border-color: #4ade80; background: #16261e; }

  .amount-opt.full {
    background: linear-gradient(135deg, #2a1414, #1f1010);
    border-color: #f8717160;
    color: #f87171;
  }
  .amount-opt.full:hover {
    border-color: #f87171;
    background: linear-gradient(135deg, #3a1a1a, #2a1414);
    box-shadow: 0 0 16px #f8717140;
  }
  .amount-opt.full .opt-sub { color: #f8717190; }

  .amount-opt.full-margin {
    background: linear-gradient(135deg, #2a1a3e, #1f1430);
    border-color: #c4b5fd60;
    color: #c4b5fd;
  }
  .amount-opt.full-margin:hover {
    border-color: #c4b5fd;
    background: linear-gradient(135deg, #3a2450, #2a1a3e);
    box-shadow: 0 0 16px #c4b5fd40;
  }
  .amount-opt.full-margin .opt-sub { color: #c4b5fd90; }

  .amount-opt.full.sell-full {
    background: linear-gradient(135deg, #0e1a12, #10221a);
    border-color: #4ade8060;
    color: #4ade80;
  }
  .amount-opt.full.sell-full:hover {
    border-color: #4ade80;
    background: linear-gradient(135deg, #16261e, #0e1a12);
    box-shadow: 0 0 16px #4ade8040;
  }
  .amount-opt.full.sell-full .opt-sub { color: #4ade8090; }

  .amount-custom {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
  }

  .amount-custom input {
    flex: 1;
    background: #0c1018;
    border: 1px solid #2a3444;
    border-radius: 12px;
    padding: 11px 14px;
    font-size: 14px;
    font-weight: 700;
    color: #e6edf7;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
    -moz-appearance: textfield;
  }
  .amount-custom input::-webkit-outer-spin-button,
  .amount-custom input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
  }
  .amount-custom input:focus {
    border-color: #ffd96680;
  }
  .amount-custom input::placeholder {
    color: #4a5568;
    font-weight: 500;
  }

  .amount-confirm {
    background: linear-gradient(135deg, #1a212e, #222c3e);
    border: 1px solid #2a3444;
    border-radius: 12px;
    padding: 11px 16px;
    font-size: 13px;
    font-weight: 700;
    color: #cdd9ea;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    font-family: inherit;
  }
  .amount-confirm:hover {
    border-color: #ffd966;
    color: #ffd966;
  }

  .amount-hint {
    font-size: 10px;
    color: #6b7a92;
    text-align: center;
    line-height: 1.5;
    letter-spacing: 0.02em;
  }

  .locked-banner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.85);
    border: 2px solid #f87171;
    border-radius: 16px;
    padding: 10px 22px;
    font-size: 14px;
    font-weight: 800;
    color: #f87171;
    letter-spacing: 0.08em;
    z-index: 50;
    box-shadow: 0 0 30px #f8717160;
    text-align: center;
    pointer-events: none;
  }
  .locked-banner.down {
    border-color: #4ade80;
    color: #4ade80;
    box-shadow: 0 0 30px #4ade8060;
  }

  .phase-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
  }
  .phase-modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
  }
  .phase-modal {
    background: linear-gradient(160deg, #141b26 0%, #0e131c 100%);
    border: 1px solid #2a3444;
    border-radius: 28px;
    padding: 24px 22px 20px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 30px 80px -12px rgba(0,0,0,0.98), 0 0 0 1px rgba(255,215,0,0.10);
    transform: translateY(16px) scale(0.96);
    transition: transform 0.3s cubic-bezier(0.2,0.9,0.3,1.2);
    position: relative;
    overflow: hidden;
  }
  .phase-modal-overlay.show .phase-modal {
    transform: translateY(0) scale(1);
  }
  .phase-modal::before {
    content: '';
    position: absolute;
    top: 0; left: 16px; right: 16px;
    height: 3px;
    border-radius: 0 0 3px 3px;
  }
  .phase-modal.pre-open::before {
    background: linear-gradient(90deg, #a78bfa, #7c3aed);
    box-shadow: 0 0 18px #7c3aed;
  }
  .phase-modal.post-close::before {
    background: linear-gradient(90deg, #38bdf8, #0284c7);
    box-shadow: 0 0 18px #0284c7;
  }

  .phase-modal-head {
    text-align: center;
    margin-bottom: 16px;
  }
  .phase-modal-icon {
    font-size: 48px;
    line-height: 1;
    margin-bottom: 8px;
    filter: drop-shadow(0 6px 12px rgba(0,0,0,0.6));
  }
  .phase-modal-title {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
  }
  .phase-modal-title.pre-open { color: #a78bfa; }
  .phase-modal-title.post-close { color: #38bdf8; }
  .phase-modal-subtitle {
    font-size: 12px;
    color: #8a99b0;
    font-weight: 500;
  }

  .phase-modal-info {
    background: #0c1018;
    border-radius: 14px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 11px;
    color: #9aa7bb;
    line-height: 1.8;
    border: 1px solid #1e2634;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .phase-modal-info .row {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .phase-modal-info .row .label {
    color: #6b7a92;
    font-weight: 600;
  }
  .phase-modal-info .row .val {
    color: #e0e8f4;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
  }
  .phase-modal-info .row .val.up { color: #f87171; }
  .phase-modal-info .row .val.down { color: #4ade80; }
  .phase-modal-info .row .val.purple { color: #c4b5fd; }
  .phase-modal-info .row .val.gold { color: #ffd966; }

  .phase-modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
  }
  .phase-modal-btn {
    border-radius: 16px;
    padding: 16px 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-family: inherit;
    border: 1px solid #2a3444;
    background: #1a212e;
    color: #cdd9ea;
    position: relative;
    overflow: hidden;
  }
  .phase-modal-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px -6px rgba(0,0,0,0.8);
  }
  .phase-modal-btn:active:not(:disabled) {
    transform: translateY(0) scale(0.97);
  }
  .phase-modal-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    filter: grayscale(0.6);
  }
  .phase-modal-btn .pmb-emoji {
    font-size: 22px;
    line-height: 1;
  }
  .phase-modal-btn .pmb-label {
    font-size: 13px;
    font-weight: 700;
  }
  .phase-modal-btn .pmb-hint {
    font-size: 9px;
    font-weight: 500;
    color: #6b7a92;
    letter-spacing: 0.02em;
  }

  .phase-modal-btn.buy {
    border-color: #f8717160;
    background: linear-gradient(135deg, #261616, #1a1010);
    color: #f87171;
  }
  .phase-modal-btn.buy:hover:not(:disabled) {
    border-color: #f87171;
    background: linear-gradient(135deg, #3a1a1a, #261616);
    box-shadow: 0 0 24px #f8717140;
  }
  .phase-modal-btn.buy .pmb-hint { color: #f8717190; }

  .phase-modal-btn.sell {
    border-color: #4ade8060;
    background: linear-gradient(135deg, #16261e, #0e1a12);
    color: #4ade80;
  }
  .phase-modal-btn.sell:hover:not(:disabled) {
    border-color: #4ade80;
    background: linear-gradient(135deg, #1e3a28, #16261e);
    box-shadow: 0 0 24px #4ade8040;
  }
  .phase-modal-btn.sell .pmb-hint { color: #4ade8090; }

  .phase-modal-btn.skip {
    border-color: #3a4a60;
    background: linear-gradient(135deg, #1a202c, #12171f);
    color: #9aa7bb;
  }
  .phase-modal-btn.skip:hover:not(:disabled) {
    border-color: #6b7a92;
    background: linear-gradient(135deg, #222c3e, #1a202c);
    color: #cdd9ea;
  }

  .phase-modal-hint {
    font-size: 10px;
    color: #6b7a92;
    text-align: center;
    line-height: 1.5;
  }

  .history-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.78);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 420;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s;
  }
  .history-modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
  }
  .history-modal {
    background: linear-gradient(160deg, #141b26 0%, #0e131c 100%);
    border: 1px solid #2a3444;
    border-radius: 24px;
    padding: 20px 20px 16px;
    width: 100%;
    max-width: 520px;
    box-shadow: 0 30px 80px -12px rgba(0,0,0,0.98), 0 0 0 1px rgba(255,215,0,0.10);
    transform: translateY(14px) scale(0.97);
    transition: transform 0.28s cubic-bezier(0.2,0.9,0.3,1.2);
    position: relative;
  }
  .history-modal-overlay.show .history-modal {
    transform: translateY(0) scale(1);
  }
  .history-modal::before {
    content: '';
    position: absolute;
    top: 0; left: 16px; right: 16px;
    height: 3px;
    background: linear-gradient(90deg, #ffd966, #f0b800);
    border-radius: 0 0 3px 3px;
    box-shadow: 0 0 16px #ffd966;
  }
  .history-modal-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
  }
  .history-modal-title {
    font-size: 16px;
    font-weight: 800;
    color: #ffd966;
    letter-spacing: -0.01em;
    margin-bottom: 4px;
  }
  .history-modal-sub {
    font-size: 11px;
    color: #8a99b0;
    font-weight: 500;
    line-height: 1.6;
  }
  .history-modal-sub .up { color: #f87171; font-weight: 700; }
  .history-modal-sub .down { color: #4ade80; font-weight: 700; }
  .history-modal-close {
    background: #1a212e;
    border: 1px solid #2a3444;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9aa7bb;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1;
    flex-shrink: 0;
  }
  .history-modal-close:hover {
    background: #2a3444;
    color: #e6edf7;
  }
  .history-modal-canvas-wrap {
    height: 200px;
    background: #0c1018;
    border-radius: 14px;
    border: 1px solid #1e2634;
    padding: 8px;
    margin-bottom: 10px;
    position: relative;
  }
  #historyIntradayCanvas {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 8px;
  }
  .history-modal-legend {
    display: flex;
    gap: 12px;
    font-size: 10px;
    color: #6b7a92;
    font-weight: 600;
    flex-wrap: wrap;
    justify-content: center;
  }
  .history-modal-legend .item {
    display: flex;
    align-items: center;
    gap: 4px;
  }
  .history-modal-legend .dot {
    width: 8px; height: 8px; border-radius: 50%;
  }
  .history-modal-legend .dot.b { background: #f87171; }
  .history-modal-legend .dot.s { background: #4ade80; }
  .history-modal-legend .dot.cost { background: #c4b5fd; }
  .history-modal-legend .dot.base { background: #2a3444; }

  .float-feedback {
    position: fixed;
    top: 38%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.6);
    font-size: 52px;
    font-weight: 900;
    letter-spacing: -0.04em;
    pointer-events: none;
    z-index: 200;
    opacity: 0;
    text-shadow: 0 6px 30px currentColor, 0 2px 8px rgba(0,0,0,0.8);
    white-space: nowrap;
  }

  .float-feedback.animate {
    animation: floatPop 1.1s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
  }

  @keyframes floatPop {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    18% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
    35% { transform: translate(-50%, -50%) scale(1); }
    75% { opacity: 1; transform: translate(-50%, -70%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -120%) scale(0.9); }
  }

  .rating-feedback {
    position: fixed;
    top: 48%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 0.06em;
    pointer-events: none;
    z-index: 201;
    opacity: 0;
    text-shadow: 0 4px 16px rgba(0,0,0,0.9);
    white-space: nowrap;
    padding: 6px 18px;
    border-radius: 30px;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
  }

  .rating-feedback.animate {
    animation: ratingPop 1.3s ease-out forwards;
  }

  @keyframes ratingPop {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
    60% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -80%) scale(0.95); }
  }

  .inner-voice {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(120px);
    background: #1c2432;
    border: 1px solid #3a4a60;
    border-radius: 30px;
    padding: 10px 20px;
    font-size: 13px;
    color: #e0e8f4;
    font-weight: 500;
    box-shadow: 0 16px 40px -8px black, 0 0 0 1px #ffd96620;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 100;
    transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.1), opacity 0.3s;
    opacity: 0;
    max-width: 90vw;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .inner-voice.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }

  .commentator-float {
    position: fixed;
    right: 20px;
    bottom: 90px;
    width: 240px;
    background: linear-gradient(160deg, rgba(20, 27, 38, 0.96), rgba(14, 19, 28, 0.96));
    border: 1px solid #2a3444;
    border-radius: 18px;
    padding: 12px 14px 10px;
    box-shadow: 0 16px 40px -10px rgba(0,0,0,0.9), 0 0 0 1px rgba(255,215,0,0.05);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 90;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s, transform 0.4s;
    pointer-events: none;
  }
  .commentator-float.show {
    opacity: 1;
    transform: translateY(0);
  }
  .commentator-float::before {
    content: '';
    position: absolute;
    top: 0; left: 14px; right: 14px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #ffd96680, transparent);
    border-radius: 0 0 2px 2px;
  }

  .commentator-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #1e2634;
  }
  .commentator-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2a3444, #1a212e);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    border: 1px solid #3a4a60;
  }
  .commentator-meta {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
  }
  .commentator-name {
    font-size: 12px;
    font-weight: 800;
    color: #e0e8f4;
    letter-spacing: -0.01em;
  }
  .commentator-title {
    font-size: 9px;
    color: #6b7a92;
    font-weight: 600;
    letter-spacing: 0.03em;
  }
  .commentator-live {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 9px;
    font-weight: 800;
    color: #f87171;
    letter-spacing: 0.06em;
  }
  .commentator-live-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #f87171;
    animation: livePulse 1.2s ease-in-out infinite;
  }
  @keyframes livePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.7); }
  }

  .commentator-body {
    font-size: 12px;
    line-height: 1.55;
    color: #b7c3d6;
    min-height: 54px;
    font-weight: 500;
    transition: opacity 0.25s;
  }
  .commentator-body.switching {
    opacity: 0;
  }

  @media (max-width: 720px) {
    .commentator-float {
      width: 200px;
      right: 12px;
      bottom: 80px;
      padding: 10px 12px 8px;
    }
    .commentator-body { font-size: 11px; min-height: 48px; }
  }

  @media (max-width: 520px) {
    .commentator-float {
      width: 170px;
      right: 10px;
      bottom: 74px;
    }
    .commentator-name { font-size: 11px; }
    .commentator-body { font-size: 10px; min-height: 42px; }
  }

  .result-screen { animation: fadeUp 0.4s ease-out; }

  @keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .result-header { text-align: center; margin-bottom: 18px; }
  .result-header h2 { font-size: 25px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 6px; }

  .result-summary {
    background: #10151e;
    border-radius: 22px;
    padding: 16px 18px;
    margin-bottom: 14px;
    border: 1px solid #222b3a;
  }
  .result-summary p { font-size: 14px; line-height: 1.65; color: #b7c3d6; margin-bottom: 8px; }
  .result-summary p:last-child { margin-bottom: 0; }

  .quote-box {
    background: #ffd96608;
    border-left: 5px solid #ffd966;
    border-radius: 14px;
    padding: 14px 18px;
    font-size: 16px;
    font-weight: 600;
    color: #ffd966;
    margin: 14px 0;
    text-align: center;
    font-style: italic;
    line-height: 1.5;
  }

  .stats-vertical { display: flex; flex-direction: column; gap: 9px; margin: 16px 0; }
  .stat-row { display: flex; align-items: center; gap: 12px; }
  .stat-name { width: 108px; font-size: 13px; font-weight: 600; color: #9aa7bb; display: flex; align-items: center; gap: 5px; }
  .stat-bar-bg { flex: 1; height: 9px; background: #1a212e; border-radius: 20px; overflow: hidden; }
  .stat-bar-fill { height: 100%; border-radius: 20px; transition: width 0.6s ease; box-shadow: 0 0 8px currentColor; }
  .stat-pct { width: 42px; text-align: right; font-size: 13px; font-weight: 700; color: #cdd9ea; }

  .result-actions { display: flex; gap: 12px; margin-top: 18px; }
  .result-actions .action-btn { flex: 1; }

  .start-screen { text-align: center; padding: 16px 4px; }
  .start-screen .hero-emoji { font-size: 64px; display: block; margin-bottom: 10px; filter: drop-shadow(0 12px 20px black); }
  .start-screen h1 {
    font-size: 28px; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 8px;
    background: linear-gradient(135deg, #fff 30%, #ffd966);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  }
  .start-screen .lead { font-size: 14px; color: #8a99b0; line-height: 1.6; margin-bottom: 18px; max-width: 440px; margin-left: auto; margin-right: auto; }
  .start-screen .rules {
    background: #10151e; border-radius: 20px; padding: 14px 18px; text-align: left;
    font-size: 13px; color: #9aa7bb; line-height: 1.9; margin-bottom: 18px; border: 1px solid #1e2634;
  }
  .start-screen .rules .rule-icon { color: #ffd966; margin-right: 6px; }
  .start-screen .rules .rule-icon.purple { color: #a78bfa; }
  .start-screen .rules .rule-icon.blue { color: #38bdf8; }
  .start-screen .rules .rule-icon.red { color: #f87171; }

  .hidden { display: none !important; }

  @media (max-width: 420px) {
    .app { padding: 16px 12px 20px; border-radius: 32px; }
    .portfolio-value { font-size: 20px; }
    .action-btn { font-size: 12px; padding: 12px 6px; }
    .float-feedback { font-size: 40px; }
    .rating-feedback { font-size: 17px; }
    .news-emoji { font-size: 30px; }
    .news-text { font-size: 13px; }
    .news-change { font-size: 18px; }
    .round-badge, .timer-badge, .phase-badge, .exit-btn, .margin-toggle-btn { padding: 5px 10px; font-size: 11px; }
    .phase-modal { padding: 18px 16px 16px; border-radius: 22px; }
    .phase-modal-actions { grid-template-columns: 1fr; }
  }
