* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: #f5f5f5;
  color: #333;
  line-height: 1.6;
  overflow: hidden;
}

.splash-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.5s ease-out;
}

.splash-screen.fade-out {
  opacity: 0;
}

.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  animation: fade-in 0.6s ease-in;
}

.splash-icon {
  width: 80px;
  height: 80px;
  animation: scale-in 0.6s ease-out;
}

.splash-title {
  font-size: 32px;
  font-weight: 700;
  color: #1a1a1a;
  letter-spacing: -0.5px;
  margin: 0;
  animation: slide-up 0.6s ease-out 0.2s both;
}

.splash-tagline {
  font-size: 12px;
  color: #666;
  margin: 0;
  text-align: center;
  animation: slide-up 0.6s ease-out 0.4s both;
  line-height: 1.6;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes scale-in {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes slide-up {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.app {
  min-height: 100vh;
  background-color: #ffffff;
  display: flex;
  justify-content: center;
  padding: 0;
}

.container {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  background-color: #ffffff;
  min-height: 100vh;
}

.header {
  padding: 20px 16px;
  border-bottom: 1px solid #e0e0e0;
  background-color: #ffffff;
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-button,
.settings-button,
.share-button {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  opacity: 0.7;
  transition: opacity 0.2s, transform 0.2s;
  line-height: 1;
  flex-shrink: 0;
}

.ai-button:hover:not(:disabled),
.settings-button:hover,
.share-button:hover {
  opacity: 1;
  transform: scale(1.1);
}

.ai-button:active:not(:disabled),
.settings-button:active,
.share-button:active {
  opacity: 0.8;
  transform: scale(0.95);
}

.ai-button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.logo-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.title {
  font-size: 24px;
  font-weight: 700;
  color: #1a1a1a;
  letter-spacing: -0.5px;
  margin: 0;
}

.input-form {
  padding: 16px;
  border-bottom: 1px solid #e0e0e0;
  background-color: #ffffff;
}

.text-input-wrapper {
  position: relative;
  margin-bottom: 12px;
}

.text-input {
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  font-size: 16px;
  font-family: inherit;
  padding: 12px;
  padding-bottom: 32px;
  background-color: #f8f8f8;
  border-radius: 8px;
  color: #1a1a1a;
  line-height: 1.5;
  transition: background-color 0.2s;
}

.text-input:focus {
  background-color: #f0f0f0;
}

.text-input::placeholder {
  color: #999;
}

.char-count {
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-size: 13px;
  color: #999;
  pointer-events: none;
  transition: color 0.2s;
}

.char-count.warning {
  color: #ff9800;
}

.char-count.error {
  color: #f44336;
  font-weight: 600;
}

.submit-button {
  width: 100%;
  padding: 12px 24px;
  background-color: #1a1a1a;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s, opacity 0.2s;
}

.submit-button:hover:not(:disabled) {
  background-color: #333;
}

.submit-button:active:not(:disabled) {
  background-color: #000;
}

.submit-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.memos-list {
  padding: 8px 0;
}

.empty-state {
  padding: 60px 16px;
  text-align: center;
  color: #999;
}

.empty-state p {
  margin-bottom: 8px;
}

.empty-hint {
  font-size: 14px;
  color: #bbb;
}

.memo-item {
  padding: 16px;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s;
}

.memo-item:hover {
  background-color: #fafafa;
}

.memo-main {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.memo-content {
  flex: 1;
  min-width: 0;
}

.memo-text {
  font-size: 16px;
  color: #1a1a1a;
  margin-bottom: 8px;
  word-wrap: break-word;
  white-space: pre-wrap;
  line-height: 1.6;
}

.memo-date {
  font-size: 13px;
  color: #999;
  display: block;
  margin-bottom: 8px;
}

.memo-annotations {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.memo-annotation-tag {
  font-size: 12px;
  color: #666;
  background-color: #f0f0f0;
  padding: 4px 10px;
  border-radius: 12px;
  line-height: 1.5;
  display: inline-block;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
  user-select: none;
}

.memo-annotation-tag:hover {
  background-color: #e0e0e0;
}

.memo-annotation-tag.active {
  background-color: #1a1a1a;
  color: #ffffff;
}

.filter-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background-color: #f8f8f8;
  border-bottom: 1px solid #e0e0e0;
  margin-bottom: 8px;
}

.filter-label {
  font-size: 14px;
  color: #666;
}

.filter-clear {
  background: none;
  border: none;
  font-size: 20px;
  color: #999;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  transition: color 0.2s;
}

.filter-clear:hover {
  color: #1a1a1a;
}

.memo-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.annotation-button,
.delete-button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 4px 8px;
  opacity: 0.6;
  transition: opacity 0.2s;
  line-height: 1;
}

.annotation-button:hover,
.delete-button:hover {
  opacity: 1;
}

.annotation-button:active,
.delete-button:active {
  opacity: 0.8;
}

.annotation-editor {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f0f0f0;
}

.annotation-input {
  width: 100%;
  padding: 8px 12px;
  font-size: 16px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  background-color: #f8f8f8;
  color: #1a1a1a;
  outline: none;
  transition: background-color 0.2s, border-color 0.2s;
  margin-bottom: 8px;
}

.annotation-input:focus {
  background-color: #ffffff;
  border-color: #1a1a1a;
}

.annotation-editor-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.annotation-save-button,
.annotation-cancel-button {
  padding: 6px 16px;
  font-size: 14px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.2s;
  font-weight: 600;
}

.annotation-save-button {
  background-color: #1a1a1a;
  color: #ffffff;
}

.annotation-save-button:hover {
  opacity: 0.8;
}

.annotation-cancel-button {
  background-color: #f0f0f0;
  color: #666;
}

.annotation-cancel-button:hover {
  background-color: #e0e0e0;
}

.settings-import {
  margin-top: 16px;
}

.settings-import-button {
  width: 100%;
  padding: 12px 24px;
  background-color: #f0f0f0;
  color: #1a1a1a;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}

.settings-import-button:hover {
  background-color: #e0e0e0;
  border-color: #1a1a1a;
}

.settings-import-button:active {
  background-color: #d0d0d0;
}

/* スマホ対応 */
@media (max-width: 640px) {
  .splash-icon {
    width: 64px;
    height: 64px;
  }

  .splash-title {
    font-size: 28px;
  }

  .splash-tagline {
    font-size: 11px;
    padding: 0 20px;
  }

  .header {
    padding: 16px;
  }

  .logo-icon {
    width: 24px;
    height: 24px;
  }

  .title {
    font-size: 22px;
  }

  .ai-button,
  .settings-button,
  .share-button {
    font-size: 22px;
    padding: 6px;
  }

  .input-form {
    padding: 12px;
  }

  .text-input {
    font-size: 16px;
    padding: 10px;
    padding-bottom: 30px;
  }

  .char-count {
    bottom: 6px;
    right: 10px;
    font-size: 12px;
  }

  .submit-button {
    padding: 10px 20px;
    font-size: 15px;
  }

  .memo-item {
    padding: 14px 12px;
  }

  .memo-text {
    font-size: 15px;
  }

  .memo-date {
    font-size: 12px;
  }

  .annotation-button,
  .delete-button {
    font-size: 16px;
    padding: 6px;
  }

  .annotation-input {
    font-size: 16px;
    padding: 6px 10px;
  }

  .annotation-save-button,
  .annotation-cancel-button {
    padding: 5px 12px;
    font-size: 13px;
  }

  .filter-badge {
    padding: 10px 12px;
  }

  .filter-label {
    font-size: 13px;
  }

  .filter-clear {
    font-size: 18px;
    padding: 2px 6px;
  }
}

/* タッチデバイス向けの最適化 */
@media (hover: none) and (pointer: coarse) {
  .submit-button {
    padding: 14px 24px;
  }

  .delete-button {
    padding: 8px 12px;
    font-size: 22px;
  }
}

/* 設定画面 */
.settings-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fade-in 0.2s ease-out;
}

.settings-overlay.show {
  display: flex;
}

.settings-modal {
  background-color: #ffffff;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  animation: slide-up 0.3s ease-out;
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #e0e0e0;
}

.settings-title {
  font-size: 20px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0;
}

.settings-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #999;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color 0.2s;
}

.settings-close:hover {
  color: #1a1a1a;
}

.settings-content {
  padding: 24px;
}

.settings-section {
  margin-bottom: 24px;
}

.settings-label {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 8px;
}

.settings-description {
  font-size: 14px;
  color: #666;
  margin-bottom: 16px;
  line-height: 1.6;
}

.settings-input {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background-color: #f8f8f8;
  color: #1a1a1a;
  font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
  transition: background-color 0.2s, border-color 0.2s;
  margin-bottom: 16px;
}

.settings-input:focus {
  outline: none;
  background-color: #ffffff;
  border-color: #1a1a1a;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.settings-save-button {
  padding: 10px 24px;
  background-color: #1a1a1a;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

.settings-save-button:hover {
  background-color: #333;
}

.settings-save-button:active {
  background-color: #000;
}

/* スマホ対応 - 設定画面 */
@media (max-width: 640px) {
  .settings-modal {
    width: 100%;
    max-width: 100%;
    border-radius: 0;
    max-height: 100vh;
  }

  .settings-header {
    padding: 16px 20px;
  }

  .settings-title {
    font-size: 18px;
  }

  .settings-content {
    padding: 20px;
  }

  .settings-input {
    font-size: 15px;
  }
}

/* AIビュー */
.ai-view {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #ffffff;
  display: none;
  flex-direction: column;
  z-index: 10001;
}

.ai-view.show {
  display: flex;
}

.ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e0e0e0;
  background-color: #ffffff;
  flex-shrink: 0;
}

.ai-close {
  background: none;
  border: none;
  font-size: 16px;
  color: #1a1a1a;
  cursor: pointer;
  padding: 8px;
  transition: opacity 0.2s;
}

.ai-close:hover {
  opacity: 0.7;
}

.ai-title {
  font-size: 18px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0;
  flex: 1;
  text-align: center;
}

.ai-export {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.ai-export:hover {
  opacity: 1;
}

.ai-chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.ai-welcome {
  text-align: center;
  padding: 40px 20px;
}

.ai-welcome-text {
  font-size: 18px;
  color: #1a1a1a;
  margin-bottom: 24px;
}

.ai-suggestions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 400px;
  margin: 0 auto;
}

.ai-suggestion-btn {
  padding: 12px 20px;
  background-color: #f8f8f8;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 15px;
  color: #1a1a1a;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
  text-align: left;
}

.ai-suggestion-btn:hover {
  background-color: #f0f0f0;
  border-color: #1a1a1a;
}

.ai-messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

.ai-message {
  display: flex;
  max-width: 80%;
  animation: fade-in 0.3s ease-out;
}

.ai-message-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.ai-message-assistant {
  align-self: flex-start;
}

.ai-message-content {
  padding: 12px 16px;
  border-radius: 12px;
  line-height: 1.6;
  word-wrap: break-word;
}

.ai-message-user .ai-message-content {
  background-color: #1a1a1a;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.ai-message-assistant .ai-message-content {
  background-color: #f8f8f8;
  color: #1a1a1a;
  border-bottom-left-radius: 4px;
}

.ai-loading {
  opacity: 0.7;
}

.ai-loading-indicator {
  display: flex;
  gap: 4px;
  align-items: center;
}

.ai-loading-indicator span {
  width: 8px;
  height: 8px;
  background-color: #999;
  border-radius: 50%;
  animation: loading-bounce 1.4s ease-in-out infinite;
}

.ai-loading-indicator span:nth-child(1) {
  animation-delay: 0s;
}

.ai-loading-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.ai-loading-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes loading-bounce {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.ai-input-container {
  padding: 16px 20px;
  border-top: 1px solid #e0e0e0;
  background-color: #ffffff;
  flex-shrink: 0;
}

.ai-form {
  display: flex;
  gap: 12px;
  align-items: center;
}

.ai-input {
  flex: 1;
  padding: 12px 16px;
  font-size: 16px;
  border: 1px solid #e0e0e0;
  border-radius: 24px;
  background-color: #f8f8f8;
  color: #1a1a1a;
  outline: none;
  transition: background-color 0.2s, border-color 0.2s;
}

.ai-input:focus {
  background-color: #ffffff;
  border-color: #1a1a1a;
}

.ai-send-button {
  padding: 12px 24px;
  background-color: #1a1a1a;
  color: #ffffff;
  border: none;
  border-radius: 24px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
  white-space: nowrap;
}

.ai-send-button:hover:not(:disabled) {
  background-color: #333;
}

.ai-send-button:active:not(:disabled) {
  background-color: #000;
}

.ai-send-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* スマホ対応 - AIビュー */
@media (max-width: 640px) {
  .ai-header {
    padding: 12px 16px;
  }

  .ai-title {
    font-size: 16px;
  }

  .ai-chat-container {
    padding: 16px;
  }

  .ai-welcome {
    padding: 30px 16px;
  }

  .ai-welcome-text {
    font-size: 16px;
  }

  .ai-suggestions {
    max-width: 100%;
  }

  .ai-message {
    max-width: 85%;
  }

  .ai-input-container {
    padding: 12px 16px;
  }

  .ai-input {
    font-size: 15px;
    padding: 10px 14px;
  }

  .ai-send-button {
    padding: 10px 20px;
    font-size: 15px;
  }

  .ai-button {
    font-size: 22px;
    padding: 6px;
  }
}


